com.planet_ink.coffee_mud.core.http
Class ProcessHTTPrequest
java.lang.Object
java.lang.Thread
com.planet_ink.coffee_mud.core.http.ProcessHTTPrequest
- All Implemented Interfaces:
- CMObject, CMLibrary, ExternalHTTPRequests, java.lang.Cloneable, java.lang.Comparable<CMObject>, java.lang.Runnable
public class ProcessHTTPrequest
- extends java.lang.Thread
- implements ExternalHTTPRequests
| Nested classes/interfaces inherited from class java.lang.Thread |
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler |
| Fields inherited from class java.lang.Thread |
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY |
|
Method Summary |
boolean |
activate()
|
void |
addRequestParameters(java.lang.String key,
java.lang.String value)
|
boolean |
byteCompare(byte[] buf,
int start,
byte[] to)
|
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. |
byte[] |
doVirtualPage(byte[] data)
|
java.lang.String |
doVirtualPage(java.lang.String data)
|
java.lang.StringBuffer |
doVirtualPage(java.lang.StringBuffer s)
|
java.util.Vector |
getAllRequestParameterKeys(java.lang.String keyMask)
|
java.lang.String |
getBoundary(java.util.Vector data)
|
int |
getContentLength(java.util.Vector data)
|
java.lang.String |
getContentType(java.util.Vector data)
|
protected java.util.Vector |
getData(java.io.InputStream sin)
|
java.lang.String |
getHTTPclientIP()
|
java.lang.String |
getHTTPRequest(java.io.InputStream sin)
|
java.lang.String |
getHTTPstatus()
|
java.lang.String |
getHTTPstatusInfo()
|
java.lang.String |
getMimeType(java.lang.String a_extension)
|
MudHost |
getMUD()
|
java.lang.String |
getPageContent(java.lang.String filename)
|
java.lang.String |
getRequestEncodedParameters()
|
java.util.Hashtable |
getRequestObjects()
|
java.lang.String |
getRequestParameter(java.lang.String key)
|
java.net.InetAddress |
getServerAddress()
|
ThreadEngine.SupportThread |
getSupportThread()
|
java.util.Hashtable |
getVirtualDirectories()
|
HTTPserver |
getWebServer()
|
java.lang.String |
getWebServerPartialName()
|
int |
getWebServerPort()
|
java.lang.String |
getWebServerPortStr()
|
CMFile |
grabFile(java.lang.String fn)
|
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 |
isRequestParameter(java.lang.String key)
|
java.lang.String |
makeRedirectPage(java.lang.String url)
|
protected int |
myBack(java.lang.StringBuffer s,
int i)
|
protected int |
myElse(java.lang.StringBuffer s,
int i,
int end)
|
protected int |
myEndif(java.lang.StringBuffer s,
int i)
|
CMObject |
newInstance()
Returns a new instance of this class. |
protected java.lang.String |
parseFoundMacro(java.lang.StringBuffer s,
int i,
boolean lookOnly)
|
protected java.lang.String |
preFilter(java.lang.StringBuffer input)
|
protected boolean |
process(java.lang.String inLine)
|
void |
removeRequestParameter(java.lang.String key)
|
void |
resetRequestEncodedParameters()
|
void |
run()
|
protected java.lang.String |
runMacro(java.lang.String foundMacro)
|
java.lang.String |
ServerVersionString()
|
boolean |
shutdown()
|
| Methods inherited from class java.lang.Thread |
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, start, stop, stop, suspend, toString, yield |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
command
protected java.lang.String command
request
protected java.lang.String request
requestMain
protected java.lang.String requestMain
requestParametersEncoded
protected java.lang.String requestParametersEncoded
mimetype
protected java.lang.String mimetype
headersOnly
protected boolean headersOnly
isAdminServer
protected boolean isAdminServer
status
protected java.lang.String status
statusExtra
protected java.lang.String statusExtra
virtualPage
public boolean virtualPage
ProcessHTTPrequest
public ProcessHTTPrequest()
ProcessHTTPrequest
public ProcessHTTPrequest(java.net.Socket a_sock,
HTTPserver a_webServer,
CMProps a_page,
boolean a_isAdminServer)
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
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
compareTo
public int compareTo(CMObject o)
- Specified by:
compareTo in interface java.lang.Comparable<CMObject>
getVirtualDirectories
public java.util.Hashtable getVirtualDirectories()
- Specified by:
getVirtualDirectories in interface ExternalHTTPRequests
getWebServer
public HTTPserver getWebServer()
getHTTPstatus
public java.lang.String getHTTPstatus()
- Specified by:
getHTTPstatus in interface ExternalHTTPRequests
getHTTPstatusInfo
public java.lang.String getHTTPstatusInfo()
- Specified by:
getHTTPstatusInfo in interface ExternalHTTPRequests
activate
public boolean activate()
- Specified by:
activate in interface CMLibrary
shutdown
public boolean shutdown()
- Specified by:
shutdown in interface CMLibrary
getSupportThread
public ThreadEngine.SupportThread getSupportThread()
- Specified by:
getSupportThread in interface CMLibrary
grabFile
public CMFile grabFile(java.lang.String fn)
- Specified by:
grabFile in interface ExternalHTTPRequests
getMimeType
public java.lang.String getMimeType(java.lang.String a_extension)
- Specified by:
getMimeType in interface ExternalHTTPRequests
process
protected boolean process(java.lang.String inLine)
throws java.lang.Exception
- Throws:
java.lang.Exception
getRequestObjects
public java.util.Hashtable getRequestObjects()
- Specified by:
getRequestObjects in interface ExternalHTTPRequests
resetRequestEncodedParameters
public void resetRequestEncodedParameters()
addRequestParameters
public void addRequestParameters(java.lang.String key,
java.lang.String value)
- Specified by:
addRequestParameters in interface ExternalHTTPRequests
isRequestParameter
public boolean isRequestParameter(java.lang.String key)
- Specified by:
isRequestParameter in interface ExternalHTTPRequests
removeRequestParameter
public void removeRequestParameter(java.lang.String key)
- Specified by:
removeRequestParameter in interface ExternalHTTPRequests
getRequestParameter
public java.lang.String getRequestParameter(java.lang.String key)
- Specified by:
getRequestParameter in interface ExternalHTTPRequests
getAllRequestParameterKeys
public java.util.Vector getAllRequestParameterKeys(java.lang.String keyMask)
- Specified by:
getAllRequestParameterKeys in interface ExternalHTTPRequests
getRequestEncodedParameters
public java.lang.String getRequestEncodedParameters()
- Specified by:
getRequestEncodedParameters in interface ExternalHTTPRequests
parseFoundMacro
protected java.lang.String parseFoundMacro(java.lang.StringBuffer s,
int i,
boolean lookOnly)
myBack
protected int myBack(java.lang.StringBuffer s,
int i)
preFilter
protected java.lang.String preFilter(java.lang.StringBuffer input)
myEndif
protected int myEndif(java.lang.StringBuffer s,
int i)
runMacro
protected java.lang.String runMacro(java.lang.String foundMacro)
throws HTTPRedirectException,
HTTPServerException
- Throws:
HTTPRedirectException
HTTPServerException
myElse
protected int myElse(java.lang.StringBuffer s,
int i,
int end)
doVirtualPage
public byte[] doVirtualPage(byte[] data)
throws HTTPRedirectException
- Specified by:
doVirtualPage in interface ExternalHTTPRequests
- Throws:
HTTPRedirectException
doVirtualPage
public java.lang.String doVirtualPage(java.lang.String data)
throws HTTPRedirectException
- Specified by:
doVirtualPage in interface ExternalHTTPRequests
- Throws:
HTTPRedirectException
doVirtualPage
public java.lang.StringBuffer doVirtualPage(java.lang.StringBuffer s)
throws HTTPRedirectException
- Specified by:
doVirtualPage in interface ExternalHTTPRequests
- Throws:
HTTPRedirectException
makeRedirectPage
public java.lang.String makeRedirectPage(java.lang.String url)
run
public void run()
- Specified by:
run in interface java.lang.Runnable- Overrides:
run in class java.lang.Thread
getHTTPclientIP
public java.lang.String getHTTPclientIP()
- Specified by:
getHTTPclientIP in interface ExternalHTTPRequests
getServerAddress
public java.net.InetAddress getServerAddress()
- Specified by:
getServerAddress in interface ExternalHTTPRequests
getPageContent
public java.lang.String getPageContent(java.lang.String filename)
- Specified by:
getPageContent in interface ExternalHTTPRequests
getData
protected java.util.Vector getData(java.io.InputStream sin)
getContentType
public java.lang.String getContentType(java.util.Vector data)
getContentLength
public int getContentLength(java.util.Vector data)
getBoundary
public java.lang.String getBoundary(java.util.Vector data)
byteCompare
public boolean byteCompare(byte[] buf,
int start,
byte[] to)
getHTTPRequest
public java.lang.String getHTTPRequest(java.io.InputStream sin)
ServerVersionString
public java.lang.String ServerVersionString()
- Specified by:
ServerVersionString in interface ExternalHTTPRequests
getWebServerPort
public int getWebServerPort()
- Specified by:
getWebServerPort in interface ExternalHTTPRequests
getWebServerPortStr
public java.lang.String getWebServerPortStr()
- Specified by:
getWebServerPortStr in interface ExternalHTTPRequests
getWebServerPartialName
public java.lang.String getWebServerPartialName()
- Specified by:
getWebServerPartialName in interface ExternalHTTPRequests
getMUD
public MudHost getMUD()
- Specified by:
getMUD in interface ExternalHTTPRequests