com.planet_ink.coffee_mud.WebMacros
Class StdWebMacro

java.lang.Object
  extended by com.planet_ink.coffee_mud.WebMacros.StdWebMacro
All Implemented Interfaces:
CMObject, WebMacro, java.lang.Cloneable, java.lang.Comparable<CMObject>
Direct Known Subclasses:
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, 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, SystemFunction, SystemInfo, ThinPlayerData, TimsItemTable, WebServerName, WebServerPort, WebServerVersion

public class StdWebMacro
extends java.lang.Object
implements WebMacro


Constructor Summary
StdWebMacro()
           
 
Method Summary
protected  java.lang.String clearWebMacros(java.lang.String s)
           
protected  java.lang.String clearWebMacros(java.lang.StringBuffer s)
           
protected  java.lang.StringBuffer colorwebifyOnly(java.lang.StringBuffer s)
           
 int compareTo(CMObject o)
           
 CMObject copyOf()
          Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.
 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.
protected  java.lang.StringBuffer helpHelp(java.lang.StringBuffer s)
           
protected  java.lang.StringBuffer helpHelp(java.lang.StringBuffer s, int limit)
           
protected  java.lang.String htmlIncomingFilter(java.lang.String buf)
           
protected  java.lang.StringBuffer htmlIncomingFilter(java.lang.StringBuffer buf)
           
protected  java.lang.String htmlOutgoingFilter(java.lang.String buf)
           
protected  java.lang.StringBuffer htmlOutgoingFilter(java.lang.StringBuffer buf)
           
 java.lang.String ID()
          The CoffeeMud Java Class ID shared by all instances of this object.
 void initializeClass()
          Called ONCE after all objects are loaded, but before the map is read in during initialization.
 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
 CMObject newInstance()
          Returns a new instance of this class.
protected  DVector parseOrderedParms(java.lang.String parm)
           
protected  java.util.Hashtable parseParms(java.lang.String parm)
           
 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().
protected  java.lang.StringBuffer webify(java.lang.StringBuffer s)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StdWebMacro

public StdWebMacro()
Method Detail

ID

public java.lang.String ID()
Description copied from interface: CMObject
The CoffeeMud Java Class ID shared by all instances of this object. Unlike the Java Class name, this method does not include package information. However, it must return a String value unique to its class category in the ClassLoader. Class categories include Libraries, Common, Areas, Abilities, Behaviors, CharClasses, Commands, Exits Locales, MOBS, Races, WebMacros, Basic Items, Armor, Weapons, ClanItems, MiscTech. The name is typically identical to the class name.

Specified by:
ID in interface CMObject
Returns:
the name of this class

name

public java.lang.String name()
Description copied from interface: WebMacro
The public name of this macro

Specified by:
name in interface WebMacro
Returns:
The public name of this macro

isAWebPath

public boolean isAWebPath()
Description copied from interface: WebMacro
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

Specified by:
isAWebPath in interface WebMacro
Returns:
whether this is a wierd URL macro
See Also:
WebMacro.getFilename(ExternalHTTPRequests, String)

preferBinary

public boolean preferBinary()
Description copied from interface: WebMacro
Whether the runMacro or runBinaryMacro executor should be called.

Specified by:
preferBinary in interface WebMacro
Returns:
whether the runBinaryMacro executor should be called instead of runMacro
See Also:
WebMacro.runBinaryMacro(ExternalHTTPRequests, String), WebMacro.runMacro(ExternalHTTPRequests, String)

isAdminMacro

public boolean isAdminMacro()
Description copied from interface: WebMacro
Whether this macro is restricted to the admin web server.

Specified by:
isAdminMacro in interface WebMacro
Returns:
true if the macro is restricted to the admin web server

newInstance

public CMObject newInstance()
Description copied from interface: CMObject
Returns a new instance of this class.

Specified by:
newInstance in interface CMObject
Returns:
a new instance of this class

initializeClass

public void initializeClass()
Description copied from interface: CMObject
Called ONCE after all objects are loaded, but before the map is read in during initialization.

Specified by:
initializeClass in interface CMObject

copyOf

public CMObject copyOf()
Description copied from interface: CMObject
Similar to Cloneable.clone(), but does its best to make sure that any internal objects to this class are also copyOfed.

Specified by:
copyOf in interface CMObject
Returns:
a clone of this object

getSpecialContentHeader

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

Specified by:
getSpecialContentHeader in interface WebMacro
Parameters:
filename - the filename from getFilename
Returns:
this is an attachment macro, so send back header
See Also:
WebMacro.getFilename(ExternalHTTPRequests, String)

runBinaryMacro

public byte[] runBinaryMacro(ExternalHTTPRequests httpReq,
                             java.lang.String parm)
                      throws HTTPServerException
Description copied from interface: WebMacro
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.

Specified by:
runBinaryMacro in interface WebMacro
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:
WebMacro.preferBinary(), ExternalHTTPRequests

runMacro

public java.lang.String runMacro(ExternalHTTPRequests httpReq,
                                 java.lang.String parm)
                          throws HTTPServerException
Description copied from interface: WebMacro
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.

Specified by:
runMacro in interface WebMacro
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:
WebMacro.preferBinary(), ExternalHTTPRequests

compareTo

public int compareTo(CMObject o)
Specified by:
compareTo in interface java.lang.Comparable<CMObject>

getFilename

public java.lang.String getFilename(ExternalHTTPRequests httpReq,
                                    java.lang.String filename)
Description copied from interface: WebMacro
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.

Specified by:
getFilename in interface WebMacro
Parameters:
httpReq - the requests object
filename - the default filename
Returns:
usually the default filename again
See Also:
WebMacro.isAWebPath(), ExternalHTTPRequests

colorwebifyOnly

protected java.lang.StringBuffer colorwebifyOnly(java.lang.StringBuffer s)

webify

protected java.lang.StringBuffer webify(java.lang.StringBuffer s)

clearWebMacros

protected java.lang.String clearWebMacros(java.lang.String s)

clearWebMacros

protected java.lang.String clearWebMacros(java.lang.StringBuffer s)

helpHelp

protected java.lang.StringBuffer helpHelp(java.lang.StringBuffer s)

helpHelp

protected java.lang.StringBuffer helpHelp(java.lang.StringBuffer s,
                                          int limit)

parseOrderedParms

protected DVector parseOrderedParms(java.lang.String parm)

htmlIncomingFilter

protected java.lang.String htmlIncomingFilter(java.lang.String buf)

htmlIncomingFilter

protected java.lang.StringBuffer htmlIncomingFilter(java.lang.StringBuffer buf)

htmlOutgoingFilter

protected java.lang.String htmlOutgoingFilter(java.lang.String buf)

htmlOutgoingFilter

protected java.lang.StringBuffer htmlOutgoingFilter(java.lang.StringBuffer buf)

parseParms

protected java.util.Hashtable parseParms(java.lang.String parm)