Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.enhydra.httpServerTest.server.application.presentation
Class BasicTest  view BasicTest download BasicTest.java

java.lang.Object
  extended byorg.enhydra.httpServerTest.server.application.presentation.BasicTest
All Implemented Interfaces:
com.lutris.appserver.server.httpPresentation.HttpPresentation

public class BasicTest
extends java.lang.Object
implements com.lutris.appserver.server.httpPresentation.HttpPresentation

This class is the generic server side test presentation object that client side test threads talk to. This class respondes to every request comming in by constructing an HttpResponseObject and returning it in the response as an XML stream. The response object returned contains information about all data received via the request. This presentation object properly handles GET and POST method request and multi-part mime encodings.


Field Summary
private  java.io.File fileCacheDir
          This holds the directory, unique to this request, that any uploaded files are stored.
 
Constructor Summary
BasicTest()
           
 
Method Summary
 void cleanupFiles()
          This function is called after all file MD5 hashkeys have been computed.
protected  void initFileCacheDir()
          This function will continually loop until a unique temporary sub- directory is found.
protected  void populateCgiArgsFromGet(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject, com.lutris.appserver.server.httpPresentation.HttpPresentationRequest request)
          This function will populate the response object with all CGI arguments submitted with the request.
protected  void populateCgiArgsFromPost(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject, com.lutris.appserver.server.httpPresentation.HttpPresentationRequest request)
          This function will populate the response object with all CGI arguments submitted with the request.
protected  void populateCgiParams(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject, com.lutris.appserver.server.httpPresentation.HttpPresentationRequest request)
          This function will populate the response object with all CGI parameters submitted with the request.
protected  void populateCookies(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject, com.lutris.appserver.server.httpPresentation.HttpPresentationRequest request)
          This function will populate the response object with all http cookies submitted with the request.
protected  void populateFileUploadFromPost(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject)
          This function will loop through all files found under the unique directory created by initFileCacheDir() and compute an MD5 hashkey for each individual file.
protected  void populateHeaders(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject, com.lutris.appserver.server.httpPresentation.HttpPresentationRequest request)
          This function will populate the response object with all http headers submitted with the request.
protected  void populateRequestInfo(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject, com.lutris.appserver.server.httpPresentation.HttpPresentationRequest request)
          This function runs through the HttpPresentationRequest API and populates the response object with retrieved information.
protected  void populateSessionInfo(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject, com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
          This function will populate the response object with all session information submitted with the request.
 void run(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
          The run method for this presentation object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

fileCacheDir

private java.io.File fileCacheDir
This holds the directory, unique to this request, that any uploaded files are stored.

Constructor Detail

BasicTest

public BasicTest()
Method Detail

run

public void run(com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
         throws com.lutris.appserver.server.httpPresentation.HttpPresentationException
The run method for this presentation object. This method runs through the remainder of the functions held in this class to initialize the response object based on information pulled from the request. Once the response object is populated, this method calls toString() on it and returns the generated XML structure to the client.

Specified by:
run in interface com.lutris.appserver.server.httpPresentation.HttpPresentation

populateRequestInfo

protected void populateRequestInfo(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject,
                                   com.lutris.appserver.server.httpPresentation.HttpPresentationRequest request)
This function runs through the HttpPresentationRequest API and populates the response object with retrieved information. The request API used here is a sub-set of the HttpPresentationRequest API that is common with a stardard servlet request object. Each of the requst method calls are individually wrapped in a try/catch block so that an error thrown from one will not cause the remaining calls to be skipped.


populateCgiParams

protected void populateCgiParams(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject,
                                 com.lutris.appserver.server.httpPresentation.HttpPresentationRequest request)
This function will populate the response object with all CGI parameters submitted with the request.


populateCgiArgsFromGet

protected void populateCgiArgsFromGet(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject,
                                      com.lutris.appserver.server.httpPresentation.HttpPresentationRequest request)
This function will populate the response object with all CGI arguments submitted with the request. This method assumes a stardard GET or url-encoded POST request (ie. no multi-part mime).


populateHeaders

protected void populateHeaders(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject,
                               com.lutris.appserver.server.httpPresentation.HttpPresentationRequest request)
This function will populate the response object with all http headers submitted with the request. This function will not include any 'default' headers applied by HTTPConnection.


populateCookies

protected void populateCookies(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject,
                               com.lutris.appserver.server.httpPresentation.HttpPresentationRequest request)
This function will populate the response object with all http cookies submitted with the request.


populateCgiArgsFromPost

protected void populateCgiArgsFromPost(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject,
                                       com.lutris.appserver.server.httpPresentation.HttpPresentationRequest request)
This function will populate the response object with all CGI arguments submitted with the request. This method assumes a multi-part mime encoding from a POST request.


initFileCacheDir

protected void initFileCacheDir()
This function will continually loop until a unique temporary sub- directory is found. This is accomplished by using the static data members and methods held in the BasicTestApp class. Once a unique path is found, the directories are created and the global fileCacheDir is initialized.


populateFileUploadFromPost

protected void populateFileUploadFromPost(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject)
This function will loop through all files found under the unique directory created by initFileCacheDir() and compute an MD5 hashkey for each individual file. The response object is then populated with each hashkey.


cleanupFiles

public void cleanupFiles()
This function is called after all file MD5 hashkeys have been computed. This function will recursively delete all uploaded files and temporary directories created while caching uploaded files.


populateSessionInfo

protected void populateSessionInfo(org.enhydra.httpServerTest.common.HttpResponseObject httpResponseObject,
                                   com.lutris.appserver.server.httpPresentation.HttpPresentationComms comms)
This function will populate the response object with all session information submitted with the request.