|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.GenericServlet | +--javax.servlet.http.HttpServlet | +--org.jlf.httpRequest.AbstractProcessor
This class is an abstract servlet used to automate the
processing of HTTP Get/Post requests by mapping input
data from forms into data mapped objects. It is subclassed
by another servlet, dynamically loaded in the classpath in
WebLogic, in a different package to solve class loader
problems.
The servlet
does its work by finding a workflow name and optional
workflow step in the HTTP request, looks up mapping properties
in a property file, and maps the HTTP input data to objects
via those properties. Most mapping properties are contained in
the WorkflowProperties
If you keep the workflow properties in the main property file,
the following does not apply. It is better to place them in other files
though, with a simple pointer to the property file in the main property file
(more than one workflow can be contained in the same exterior property file):
org.jlf.httpRequest.workflow.{workflowAlias}.propertyFile={propertyFileName}For example, take two workflows (processOrder and maintainCustomer) in the same exterior property file:
org.jlf.httpRequest.workflow.processOrder.propertyFile=productWorkflows org.jlf.httpRequest.workflow.maintainCustomer.propertyFile=productWorkflowsThen see the
WorkflowProperties
file for examples of what should be in
the productWorkflows.properties
file to map the two workflows.
Workflow
,
WorkflowProperties
,
Processor
,
Serialized FormField Summary | |
protected java.io.PrintWriter |
out
Holds the output stream of the servlet. |
protected javax.servlet.http.HttpServletRequest |
request
Holds the HTTP Request object. |
protected javax.servlet.http.HttpServletResponse |
response
Holds the HTTP Response object. |
protected static java.lang.String |
WORKFLOW_ALIAS_KEY
This is the HTTP request variable stating the workflow alias to be mapped/executed. |
protected static java.lang.String |
WORKFLOW_KEY_PROPERTY_FILE_PREFIX
Constant for the property file prefix to see where to get workflow information from. |
protected static java.lang.String |
WORKFLOW_KEY_PROPERTY_FILE_SUFFIX
Constant for the property file suffix to see where to get workflow information from. |
protected java.lang.String |
workflowAlias
Lazy initialized string for the workflow alias. |
protected WorkflowProperties |
workflowProperties
Lazy initialized set of workflow properties specific to this http request. |
protected static java.util.Hashtable |
workflowPropertyTable
Holds a cache of workflow property information. |
Constructor Summary | |
AbstractProcessor()
|
Method Summary | |
protected static WorkflowProperties |
basicGetWorkflowProperties(java.lang.String workflowName)
Retrieves a set of workflow properties for the given workflow alias from property files, does NOT access the cache. |
void |
cleanUpAfterRequestProcessed()
Hook method for cleaning up resources after the request is processed. |
protected void |
executeWorkflowStep()
Forwards the current request to a workflow/step method, if one found. |
protected void |
forwardOutputPage()
Helper method to find an output JSP, servlet, or any other HTML URL for final output processing, if any required for the request. |
protected void |
forwardToPage(java.lang.String pageURL)
Helper method to forward the request to a particular URL. |
java.io.PrintWriter |
getOutputStream()
Returns the output stream of the servlet, lazy-initialized so that we don't open the stream until we know we need it. |
javax.servlet.http.HttpServletRequest |
getRequest()
Returns the HTTP Request object. |
javax.servlet.http.HttpServletResponse |
getResponse()
Returns the HTTP Response object. |
javax.servlet.http.HttpSession |
getSession()
Returns the HTTP Session. |
protected java.lang.String |
getWorkflowAlias()
Helper method to retrieve the workflow alias from the HTTP request. |
protected WorkflowProperties |
getWorkflowProperties()
Retrieves the workflow properties of this request. |
static WorkflowProperties |
getWorkflowProperties(java.lang.String workflowAlias)
Retrieves a set of workflow properties for the given workflow alias, from the cache of workflow properties. |
protected void |
mapAndDispatchRequestToWorkflow()
Prepares a request for workflow/step processing. |
protected void |
mapObjects()
Helper method to map any HTTP request form text to data mapped objects and place them in either the request or session object stores before a workflow step or output page kicks in. |
void |
service(javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
Examines the HTTP servlet request and dispatches it to a workflow or workflow step. |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete, doGet, doHead, doOptions, doPost, doPut, doTrace, getLastModified, service |
Methods inherited from class javax.servlet.GenericServlet |
destroy, getInitParameter, getInitParameterNames, getServletConfig, getServletContext, getServletInfo, getServletName, init, init, log, log |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected javax.servlet.http.HttpServletRequest request
protected javax.servlet.http.HttpServletResponse response
protected java.io.PrintWriter out
protected static final java.lang.String WORKFLOW_KEY_PROPERTY_FILE_PREFIX
protected static final java.lang.String WORKFLOW_KEY_PROPERTY_FILE_SUFFIX
protected static java.util.Hashtable workflowPropertyTable
protected static final java.lang.String WORKFLOW_ALIAS_KEY
protected java.lang.String workflowAlias
protected WorkflowProperties workflowProperties
Constructor Detail |
public AbstractProcessor()
Method Detail |
public javax.servlet.http.HttpServletRequest getRequest()
public javax.servlet.http.HttpServletResponse getResponse()
public javax.servlet.http.HttpSession getSession()
public java.io.PrintWriter getOutputStream()
public void cleanUpAfterRequestProcessed()
protected static WorkflowProperties basicGetWorkflowProperties(java.lang.String workflowName)
HttpRequestProcessorError
public static WorkflowProperties getWorkflowProperties(java.lang.String workflowAlias)
If not in the cache, tries to populate the cache and return it. Note that a workflow step can be embedded in the workflow alias, it will be stripped off (example, "MaintainOrder:displayOneOrder" will strip off ":displayOneOrder").
protected java.lang.String getWorkflowAlias()
HttpRequestProcessorError
- if a workflow not
specified on the HTTP request.protected WorkflowProperties getWorkflowProperties()
protected void mapObjects()
protected void executeWorkflowStep()
protected void forwardToPage(java.lang.String pageURL)
protected void forwardOutputPage() throws java.io.IOException
java.io.IOException
protected void mapAndDispatchRequestToWorkflow() throws java.io.IOException
Workflow
subclass for processing.
java.io.IOException
public void service(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response) throws java.io.IOException
service
in class javax.servlet.http.HttpServlet
java.io.IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |