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, AddFile, AddRandomFile, AddRandomFileFromDir, AddRequestParameter, AreaData, AreaName, AreaNameEncoded, AreaNext, AreaTbl, AreaXML, Authenticate, AutoTitleData, AutoTitleID, AutoTitleNext, BankAccountInfo, BankChainName, BankChainNext, BanListMgr, BaseCharClassName, BaseCharClassNext, BehaviorData, BehaviorID, BehaviorNext, CatalogItemNext, CatalogMobNext, ChannelBackLogNext, ChannelNext, CharClassData, CharClassID, CharClassName, CharClassNext, CheckAuthCode, CheckReqParm, ChkReqParmBreak, ClanData, ClanID, ClanNext, ClassRaceNext, CoffeeTableRows, ControlPanel, CrossBaseClassAbilities, CrossClassAbilities, DeityData, DeityID, DeityNext, ExitData, ExpertiseData, ExpertiseID, ExpertiseNext, FactionData, FactionID, FactionName, FactionNext, FileData, FileInfo, FileMgr, FileNext, HelpTopics, HolidayData, HolidayID, HolidayNext, HTTPclientIP, HTTPstatus, HTTPstatusInfo, INIModify, INIValue, 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, QuestData, QuestMaker, QuestMgr, QuestNext, RaceCatNext, RaceClassNext, RaceData, RaceID, RaceName, RaceNext, RebuildReferenceDocs, RequestParameter, RequestParameterEncoded, RequestParametersEncoded, ResourceMgr, RoomData, RoomID, RoomName, RoomNext, SocialData, SocialID, SocialNext, SocialTbl, StatRejuvCharts, StdWebMacro, SystemFunction, SystemInfo, ThinPlayerData, TimsItemTable, WebServerName, WebServerPort, WebServerVersion

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
 java.lang.String getFilename(ExternalHTTPRequests httpReq, java.lang.String filename)
          If this macro returns true from isAWebPath(), this will be the substitute filename to use as a page for returning to the caller.
 java.lang.String getSpecialContentHeader(java.lang.String filename)
          Whether this macro returns an attachment instead of something displayable.
 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(ExternalHTTPRequests httpReq, java.lang.String parm)
          This method is executed only if this macro returns true for preferBinary().
 java.lang.String runMacro(ExternalHTTPRequests httpReq, java.lang.String parm)
          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

Returns:
The public name of this macro

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(ExternalHTTPRequests, String), runMacro(ExternalHTTPRequests, String)

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

getSpecialContentHeader

java.lang.String getSpecialContentHeader(java.lang.String filename)
Whether this macro returns an attachment instead of something displayable. If true, the content-disposition will reflect the filename parameter.

Parameters:
filename - the filename from getFilename
Returns:
this is an attachment macro, so send back header
See Also:
getFilename(ExternalHTTPRequests, String)

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
See Also:
getFilename(ExternalHTTPRequests, String)

getFilename

java.lang.String getFilename(ExternalHTTPRequests httpReq,
                             java.lang.String filename)
If this macro returns true from isAWebPath(), this will be the substitute filename to use as a page for returning to the caller. It may simply return what is given to it.

Parameters:
httpReq - the requests object
filename - the default filename
Returns:
usually the default filename again
See Also:
isAWebPath(), ExternalHTTPRequests

runBinaryMacro

byte[] runBinaryMacro(ExternalHTTPRequests httpReq,
                      java.lang.String parm)
                      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.

Parameters:
httpReq - the external requests object
parm - any parameter strigs given to the macro
Returns:
the binary stream result of running this macro
Throws:
HTTPServerException
See Also:
preferBinary(), ExternalHTTPRequests

runMacro

java.lang.String runMacro(ExternalHTTPRequests httpReq,
                          java.lang.String parm)
                          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.

Parameters:
httpReq - the external requests object
parm - any parameter strigs given to the macro
Returns:
the string result of running this macro
Throws:
HTTPServerException
See Also:
preferBinary(), ExternalHTTPRequests