com.planet_ink.coffee_mud.WebMacros.interfaces
Interface WebMacro

All Superinterfaces:
java.lang.Cloneable, CMObject, java.lang.Comparable<CMObject>
All Known Implementing Classes:
AbilityAffectNext, AbilityBlessingNext, AbilityCursesNext, AbilityData, AbilityDomainNext, AbilityGainReport, AbilityID, AbilityName, AbilityNext, AbilityPlayerNext, AbilityPowersNext, AbilityRaceNext, AbilityRecipeData, AbilityTypeNext, AccountCreate, AccountData, AccountID, AccountNext, AccountOnline, AccountPlayerNext, AchievementData, AchievementID, AchievementNext, AddFile, AddRandomFile, AddRandomFileFromDir, AddRequestParameter, AllQualifyData, AllQualifyNext, AreaData, AreaID, AreaIDEncoded, AreaName, AreaNameEncoded, AreaNext, AreaScriptData, AreaScriptKey, AreaScriptNext, AreaTbl, AreaXML, Authenticate, AutoTitleData, AutoTitleID, AutoTitleNext, BankAccountInfo, BankChainName, BankChainNext, BanListMgr, BaseCharClassName, BaseCharClassNext, BehaviorData, BehaviorID, BehaviorNext, CatalogCatNext, CatalogItemNext, CatalogMobNext, ChannelBackLogNext, ChannelInfo, ChannelNext, CharClassData, CharClassID, CharClassName, CharClassNext, CheckAuthCode, CheckReqParm, ChkReqParmBreak, ClanData, ClanGovernmentData, ClanGovernmentID, ClanGovernmentNext, ClanID, ClanNext, ClassRaceNext, CoffeeTableRows, CommandJournalInfo, CommandJournalNext, ComponentData, ComponentID, ComponentNext, ComponentPieceData, ComponentPieceID, ComponentPieceNext, ControlPanel, CrossBaseClassAbilities, CrossClassAbilities, DeityData, DeityID, DeityNext, ExitData, ExpertiseData, ExpertiseID, ExpertiseNext, FactionData, FactionID, FactionName, FactionNext, FileData, FileInfo, FileMgr, FileNext, ForumInfo, ForumJournalNext, HelpTopics, HolidayData, HolidayID, HolidayNext, HTTPclientIP, HTTPstatus, HTTPstatusInfo, ImageVerificationImage, INIModify, INIValue, IsAccountSystem, IsDisabled, IsExpirationSystem, ItemData, JournalFunction, JournalInfo, JournalMessageNext, JournalName, JournalNext, LevelNext, LevelNumber, LogViewer, MobData, MUDGrinder, MudInfo, MUDServerPort, MUDServerStatus, MUDServerVersion, NumPlayers, PlayerData, PlayerDelete, PlayerID, PlayerList, PlayerNext, PlayerOnline, PlayerPortrait, PollData, PollID, PollNext, PrideStat, QuestData, QuestMaker, QuestMgr, QuestNext, RaceCatNext, RaceClassNext, RaceData, RaceID, RaceName, RaceNext, RandomAreaTemplates, RebuildReferenceDocs, RequestParameter, RequestParameterEncoded, RequestParametersEncoded, ResourceMgr, RoomData, RoomID, RoomName, RoomNext, SipletInterface, SocialData, SocialID, SocialNext, SocialTbl, StatRejuvCharts, StdWebMacro, SystemFunction, SystemInfo, ThinPlayerData, TimsItemTable, Unsubscribe, WebServerName, WebServerPort, WebServerVersion, WebSock

public interface WebMacro
extends CMObject

Web Macros are special commands which can be inserted into coffeemud web page (cmvp) files, and can have those command strings substituted with calculated results. They can include parameters, and can access the other URL parameters.


Method Summary
 boolean isAdminMacro()
          Whether this macro is restricted to the admin web server.
 boolean isAWebPath()
          Whether this macro substitutes as an aspect of the web path instead of a standard web macro.
 java.lang.String name()
          The public name of this macro
 boolean preferBinary()
          Whether the runMacro or runBinaryMacro executor should be called.
 byte[] runBinaryMacro(com.planet_ink.coffee_web.interfaces.HTTPRequest httpReq, java.lang.String parm, com.planet_ink.coffee_web.interfaces.HTTPResponse httpResp)
          This method is executed only if this macro returns true for preferBinary().
 java.lang.String runMacro(com.planet_ink.coffee_web.interfaces.HTTPRequest httpReq, java.lang.String parm, com.planet_ink.coffee_web.interfaces.HTTPResponse httpResp)
          This method is executed only if this macro returns false for preferBinary().
 
Methods inherited from interface com.planet_ink.coffee_mud.core.interfaces.CMObject
copyOf, ID, initializeClass, newInstance
 
Methods inherited from interface java.lang.Comparable
compareTo
 

Method Detail

name

java.lang.String name()
The public name of this macro

Specified by:
name in interface CMObject
Returns:
The public name of this macro
See Also:
Environmental.Name()

preferBinary

boolean preferBinary()
Whether the runMacro or runBinaryMacro executor should be called.

Returns:
whether the runBinaryMacro executor should be called instead of runMacro
See Also:
runBinaryMacro(HTTPRequest, String, HTTPResponse), runMacro(HTTPRequest, String, HTTPResponse)

isAdminMacro

boolean isAdminMacro()
Whether this macro is restricted to the admin web server.

Returns:
true if the macro is restricted to the admin web server

isAWebPath

boolean isAWebPath()
Whether this macro substitutes as an aspect of the web path instead of a standard web macro. If true is returned, URLs such as: http://mydomain.com/mymacroname?firstparm=value&secondparm=value might succeeed

Returns:
whether this is a wierd URL macro

runBinaryMacro

byte[] runBinaryMacro(com.planet_ink.coffee_web.interfaces.HTTPRequest httpReq,
                      java.lang.String parm,
                      com.planet_ink.coffee_web.interfaces.HTTPResponse httpResp)
                      throws HTTPServerException
This method is executed only if this macro returns true for preferBinary(). It will execute the macro and return its results as a binary byte array. The response object is used to set cookies and headers only. Any response body is in the return object. Since 99% of macros are only filling in an existing page, nothing will be done with that anyway, and is only important when isAWebPath return true.

Parameters:
httpReq - the external requests object
parm - any parameter strings given to the macro
httpResp - the response, with headers
Returns:
the binary stream result of running this macro
Throws:
HTTPServerException - a http error to pass to the user
See Also:
preferBinary(), HTTPRequest

runMacro

java.lang.String runMacro(com.planet_ink.coffee_web.interfaces.HTTPRequest httpReq,
                          java.lang.String parm,
                          com.planet_ink.coffee_web.interfaces.HTTPResponse httpResp)
                          throws HTTPServerException
This method is executed only if this macro returns false for preferBinary(). It will execute the macro and return its results as a string, which is then substituted for the macro reference in the web page where the macro was found. The response object is used to set cookies and headers only. Any response body is in the return object. Since 99% of macros are only filling in an existing page, nothing will be done with that anyway, and is only important when isAWebPath return true.

Parameters:
httpReq - the external requests object
parm - any parameter strings given to the macro
httpResp - the response, with headers
Returns:
the string result of running this macro
Throws:
HTTPServerException - a http error to pass to the user
See Also:
preferBinary(), HTTPRequest