Open SiteSearch 4.1.1
Final

ORG.oclc.jassi
Class RequestManager

java.lang.Object
  |
  +--ORG.oclc.jassi.RequestManager

public class RequestManager
extends Object

The RequestManager class defines methods used for accessing the user's current HttpMessage object, setting up the HTTP response, and processing of URL commands, Next commands, Post Process commands and HTTP redirection.

RequestManager also provides methods to handle entity substitution into HTML pages, reading of HTML pages based upon the URL command and Next commands, and the URL encoding of HTML pages.

See Also:
HttpMessage, Action

Field Summary
 Action action
          Action object used within this RequestManager object.
 UserStateObject user
          UserStateObject object for the current user.
 
Constructor Summary
RequestManager()
          Constructs a RequestManager object.
RequestManager(UserStateObject user, HttpMessage httpObject)
          Constructs a RequestManager object using the input UserStateObject and HttpMessage object.
 
Method Summary
 void appendParmstoNext(String parms)
          Appends the input parameter String to the existing Next command.
 boolean deletingUser()
          Checks if the delete user flag has been set.
 String doEntitySubstitution(String output)
           
 String doEntitySubstitution(String output, int level)
          Locates entities in the HTML response passed in as a String and substitutes their correct value as they exist in the user's UserStateObject object.
 String doEntitySubstitution(String output, StringBuffer newPage, int level)
           
static String escape(String s)
          HTML encodes the input String for display in HTML.
static void escapeAndAppend(String s, StringBuffer sbuf)
           
 String getFailurePage()
          Returns the failure page as defined in the JaSSI Server ini file.
 String getFilteredReferer()
          Returns the Referer header URL without the HTTP and Peer-Host information.
static String getHostName()
          Returns the hostname where JaSSI is running.
 String getHtmlPage()
          Returns the HTML page currently stored in the RequestManager object.
 String getHTTPHeader(String body)
          Returns the HTTP header for the HTTP response using the input HTTP body String.
 DataPairs getHttpMsg()
          Returns a DataPairs object containing the current transaction's HTTP request.
 HttpMessage getHttpObject()
          Returns the current transaction's HttpMessage object.
 String getHttpResponse()
          Returns the HTTP response.
 String getHTTPResponseStatus()
          Returns the HTTP Response Status Code and Message.
 String getHTTPResponseStatusCode()
          Returns the HTTP Response Status Code.
 String getHTTPResponseStatusMsg()
          Returns the HTTP Response Status Message.
static int getJaSSIPort()
          Returns the JaSSI Server port.
 String getNext()
          Returns the Next command to process.
 String getPostProcess()
          Returns the Post Process command.
 boolean hasNext()
          Tests to see if a Next command has been setup.
 void makeNext(String nextUrl)
          Sets the Next command to process to the input parameter String.
 void makePostProcess(String cmd)
          Sets the Post Process command to run after an HTTP response has been returned on this thread.
 String parseOclcApp(String htmlString)
           
 void processCommand(JaSSIClassLoader loader, boolean doPostProcess)
          Manages the execution of the current URL command and all subsequent Next command transactions and Post Processing commands.
 void putHtmlPage(String s)
          Puts an HTML page into the RequestManager object.
 void putHttpResponse(String s)
          Puts an HTTP response into the RequestManager object using the input String response.
 void putHttpResponseBody(String s)
          Puts an HTTP response into the RequestManager object using the input String response.
 void putHttpResponseHeader(String name, String value)
          Puts an HTTP header into the RequestManager object using the input header name and value.
 void putHttpResponseStatus(String statusCode, String statusMsg)
          Puts an HTTP Response Status Code and Message into the RequestManager object.
 String readHtmlFile(String fileName)
          Reads in an HTML file using the input String file name,
 void setDeleteUser()
          Sets the delete user flag to true.
 void setMimeType(String mimeType)
          Sets the mime type for the current HTTP response.
 String toString()
          Generates the String representation of this object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

action

public Action action
Action object used within this RequestManager object.

user

public UserStateObject user
UserStateObject object for the current user.
Constructor Detail

RequestManager

public RequestManager()
Constructs a RequestManager object.

RequestManager

public RequestManager(UserStateObject user,
                      HttpMessage httpObject)
Constructs a RequestManager object using the input UserStateObject and HttpMessage object.
Parameters:
user - the UserStateObject object.
httpObject - the user's current transaction HttpMessage object.
Method Detail

appendParmstoNext

public final void appendParmstoNext(String parms)
Appends the input parameter String to the existing Next command.
Parameters:
parms - the widgets to append to the Next command.

deletingUser

public final boolean deletingUser()
Checks if the delete user flag has been set.
Returns:
true if the user is being removed and false otherwise.

doEntitySubstitution

public String doEntitySubstitution(String output)

doEntitySubstitution

public String doEntitySubstitution(String output,
                                   int level)
Locates entities in the HTML response passed in as a String and substitutes their correct value as they exist in the user's UserStateObject object.
Parameters:
output - the HTML response page before entity substitution.
Returns:
a String representation of the HTML page after entity substitution.

doEntitySubstitution

public String doEntitySubstitution(String output,
                                   StringBuffer newPage,
                                   int level)

escape

public static String escape(String s)
HTML encodes the input String for display in HTML.
Parameters:
s - the string to be URL encoded.
Returns:
a String containing the URL encoded HTML.

escapeAndAppend

public static void escapeAndAppend(String s,
                                   StringBuffer sbuf)

getFailurePage

public final String getFailurePage()
Returns the failure page as defined in the JaSSI Server ini file.
Returns:
the HTML failure page.

getFilteredReferer

public final String getFilteredReferer()
Returns the Referer header URL without the HTTP and Peer-Host information.
Returns:
a String containg the Referer header URL only.

getHostName

public static final String getHostName()
Returns the hostname where JaSSI is running.
Returns:
the hostname where JaSSI is running

getHtmlPage

public final String getHtmlPage()
Returns the HTML page currently stored in the RequestManager object.
Returns:
an HTML page or an empty string if not available.

getHTTPHeader

public final String getHTTPHeader(String body)
Returns the HTTP header for the HTTP response using the input HTTP body String.
Parameters:
body - the HTTP body response String.
Returns:
a String containing the HTTP header.

getHttpMsg

public final DataPairs getHttpMsg()
Returns a DataPairs object containing the current transaction's HTTP request.
Returns:
the DataPairs object containing the current transaction's HTTP request.

getHttpObject

public final HttpMessage getHttpObject()
Returns the current transaction's HttpMessage object.
Returns:
the current transaction's HttpMessage object.

getHttpResponse

public final String getHttpResponse()
Returns the HTTP response.
Returns:
the HTTP response.

getHTTPResponseStatus

public final String getHTTPResponseStatus()
Returns the HTTP Response Status Code and Message.
Returns:
the HTTP Response Status Code and Message.

getHTTPResponseStatusCode

public final String getHTTPResponseStatusCode()
Returns the HTTP Response Status Code.
Returns:
the HTTP Response Status Code.

getHTTPResponseStatusMsg

public final String getHTTPResponseStatusMsg()
Returns the HTTP Response Status Message.
Returns:
the HTTP Response Status Message.

getJaSSIPort

public static final int getJaSSIPort()
Returns the JaSSI Server port.
Returns:
the JaSSI Server port.

getNext

public final String getNext()
Returns the Next command to process.
Returns:
the Next command to process.

getPostProcess

public final String getPostProcess()
Returns the Post Process command.
Returns:
the Post Process command.

hasNext

public final boolean hasNext()
Tests to see if a Next command has been setup.
Returns:
true if there is a Next command to process and false otherwise.

makeNext

public final void makeNext(String nextUrl)
Sets the Next command to process to the input parameter String.
Parameters:
nextUrl - the Next command to process.

makePostProcess

public final void makePostProcess(String cmd)
Sets the Post Process command to run after an HTTP response has been returned on this thread.
Parameters:
cmd - the Post Processing command.

parseOclcApp

public String parseOclcApp(String htmlString)

processCommand

public final void processCommand(JaSSIClassLoader loader,
                                 boolean doPostProcess)
Manages the execution of the current URL command and all subsequent Next command transactions and Post Processing commands.

If a Post Process command has been set, it will be executed after an HTTP response has been sent back from JaSSI.

Parameters:
loader - the JaSSIClassLoader object.
doPostProcess - sets a flag to handle a Post Processing command.

putHtmlPage

public final void putHtmlPage(String s)
Puts an HTML page into the RequestManager object.
Parameters:
s - the HTML page.

putHttpResponse

public final void putHttpResponse(String s)
Puts an HTTP response into the RequestManager object using the input String response.
Parameters:
s - the HTTP response String.

putHttpResponseBody

public final void putHttpResponseBody(String s)
Puts an HTTP response into the RequestManager object using the input String response.
Parameters:
s - the HTTP response String.

putHttpResponseHeader

public final void putHttpResponseHeader(String name,
                                        String value)
Puts an HTTP header into the RequestManager object using the input header name and value.
Parameters:
name - the HTTP header name.
value - the HTTP header value.

putHttpResponseStatus

public final void putHttpResponseStatus(String statusCode,
                                        String statusMsg)
Puts an HTTP Response Status Code and Message into the RequestManager object.
Parameters:
statusCode - the HTTP Response Status Code.
statusMsg - the HTTP Response Status Message.

readHtmlFile

public String readHtmlFile(String fileName)
Reads in an HTML file using the input String file name,
Parameters:
fileName - the name of the HTML file to read.
Returns:
a String representation of the HTML file read.

setDeleteUser

public final void setDeleteUser()
Sets the delete user flag to true.

setMimeType

public final void setMimeType(String mimeType)
Sets the mime type for the current HTTP response.
Parameters:
mimeType - the mime type extension to set for the HTTP response.

toString

public final String toString()
Generates the String representation of this object.
Returns:
the String representation of this object
Overrides:
toString in class Object

Open SiteSearch 4.1.1
Final