com.ibm.dse.cs.html
Class HtmlRequestHandler

java.lang.Object
  |
  +--com.ibm.dse.clientserver.DSERequestHandler
        |
        +--com.ibm.dse.cs.html.HtmlRequestHandler

public class HtmlRequestHandler
extends DSERequestHandler

Handle requests that are made from html clients. The DSE.INI file for the server specifies this class name as the handler for html requests. One instance of it is created and held by the HandlerRegistry for use by all html clients.


Constructor Summary
HtmlRequestHandler()
          HtmlRequestHandler constructor comment.
 
Method Summary
protected  void addConseqInfoToSessionCtx(java.lang.String sessionId, KeyedCollection kcReqData)
          Adds to the session context the information needed to manage the processor's consequentiality.
 void addFieldTo(Context ctx, java.lang.String name, java.lang.Object value)
          This method adds framework related fields to a context.
protected  void addRequiredDataToOperationCtx(Context opCtx, KeyedCollection kcReqData)
          The session operation context requires some data to be added to it.
protected  void addRequiredDataToSessionCtx(java.lang.String sessionId, javax.servlet.http.HttpServletRequest req)
          The session context requires some data to be added to it.
protected  boolean areTransitionCtxErrors(Context trCtx)
          Returns true if any of the DataElements associated to this context has validation errors.
 void endRequest(ChannelContext channelContext)
          Perform any post processing of the request if required.
 void endSessionRequest(ServerOperation anOperation)
          Perform any post processing of the request if required.
 ServerOperation executeRequest(ChannelContext channelContext)
          When a server is set up with the cookies flag in DSE.INI set to false, then a DSEChannelSession object is used rather than an HttpSession.
 ServerOperation executeSessionRequest(ChannelContext channelContext)
          When a session is established, we need to call an operation which sets the context to hold data that is saved in the session.
protected  java.lang.String getSessionId(ChannelContext aChannelContext)
          Obtain the session id from the channel context.
 void preProcessRequest(ChannelContext channelContext)
          Perform back and double click processing to assure that this is considered a valid request before proceeding.
 void processRequest(ChannelContext channelContext)
          Process the request originated from a request that already has a session
 void processSessionRequest(ChannelContext channelContext)
          This method is similar to processRequest, only back and double click validation are not performed as a new session is being established.
 
Methods inherited from class com.ibm.dse.clientserver.DSERequestHandler
endRequest, executeSession, getPresentationHandler, handleException, handleException, usingCookies
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HtmlRequestHandler

public HtmlRequestHandler()
HtmlRequestHandler constructor comment.
Method Detail

addConseqInfoToSessionCtx

protected void addConseqInfoToSessionCtx(java.lang.String sessionId,
                                         KeyedCollection kcReqData)
Adds to the session context the information needed to manage the processor's consequentiality.
Parameters:
sessionId - String
kcReqData - com.ibm.dse.base.KeyedCollection

addFieldTo

public void addFieldTo(Context ctx,
                       java.lang.String name,
                       java.lang.Object value)
                throws java.lang.Exception
This method adds framework related fields to a context.

addRequiredDataToOperationCtx

protected void addRequiredDataToOperationCtx(Context opCtx,
                                             KeyedCollection kcReqData)
The session operation context requires some data to be added to it.
Parameters:
opCtx - com.ibm.dse.base.Context
kcReqData - com.ibm.dse.base.KeyedCollection

addRequiredDataToSessionCtx

protected void addRequiredDataToSessionCtx(java.lang.String sessionId,
                                           javax.servlet.http.HttpServletRequest req)
The session context requires some data to be added to it.
Parameters:
sessionId - java.lang.String
req - HttpServletRequest

areTransitionCtxErrors

protected boolean areTransitionCtxErrors(Context trCtx)
Returns true if any of the DataElements associated to this context has validation errors.
Parameters:
trCtx - com.ibm.dse.base.Context
Returns:
boolean

endRequest

public void endRequest(ChannelContext channelContext)
Perform any post processing of the request if required. Perform any validation or state management that may be required
Parameters:
channelContext - com.ibm.dse.clientserver.ChannelContext

endSessionRequest

public void endSessionRequest(ServerOperation anOperation)
Perform any post processing of the request if required. In the case of the session request just needs to close the operation.
Parameters:
anOperation - com.ibm.dse.base.ServerOperation

executeRequest

public ServerOperation executeRequest(ChannelContext channelContext)
                               throws java.lang.Exception
When a server is set up with the cookies flag in DSE.INI set to false, then a DSEChannelSession object is used rather than an HttpSession. The required actions to create, execute, and return an operation using a DSEChannelSession are performed here.
Overrides:
executeRequest in class DSERequestHandler
Parameters:
channelContext - com.ibm.dse.clientserver.ChannelContext

executeSessionRequest

public ServerOperation executeSessionRequest(ChannelContext channelContext)
                                      throws java.lang.Exception
When a session is established, we need to call an operation which sets the context to hold data that is saved in the session.
Parameters:
channelContext - com.ibm.dse.clientserver.ChannelContext

getSessionId

protected java.lang.String getSessionId(ChannelContext aChannelContext)
Obtain the session id from the channel context.
Parameters:
aChannelContext - com.ibm.dse.clientserver.ChannelContext
Returns:
java.lang.String

preProcessRequest

public void preProcessRequest(ChannelContext channelContext)
                       throws DSEException
Perform back and double click processing to assure that this is considered a valid request before proceeding. If this incoming request is a normal request, add it to the pending table. Double posting is when the user submits a request twice, where the second posting is made before the first completes. Each request has a session and a page id that are taken from hidden form fields. When an operation is posted the first time, an entry is added to a Hashtable with a composite key [sessionid.pageid]. When the operation completes, the entry is removed. To prevent double posting, each request from a page is checked against this table. If there is an entry [sessionid.pageid.opName] already in the table, then an unfinished operation for the session and page number is detected. This means the request is a double post and is invalid. This is coded as a Pending exception. Optionally, requests must be completed for a period of time before they can be reissued for a given page in a given session. This is coded as an Aging exception. There is a third checking specific for processors. If a processor receives a request to perform a given transition, it is processing it or it has not reached yet its timeout (same than aging), and another request for this processor, coming from the same sessionId.pageId but asking for a different transition is received, it is not considered a double click, but it would leave the processor in an unconsistent status, so an UnconsistentProcessor exception is thrown. This method is synchronized to avoid the possibility of two requests coming into at the same time, because until the first request does not reach the last line, the second request will not be considered as a pending request.
Overrides:
preProcessRequest in class DSERequestHandler
Parameters:
channelContext - com.ibm.dse.clientserver.ChannelContext

processRequest

public void processRequest(ChannelContext channelContext)
Process the request originated from a request that already has a session
Overrides:
processRequest in class DSERequestHandler
Parameters:
channelContext - com.ibm.dse.clientserver.ChannelContext

processSessionRequest

public void processSessionRequest(ChannelContext channelContext)
This method is similar to processRequest, only back and double click validation are not performed as a new session is being established.
Overrides:
processSessionRequest in class DSERequestHandler
Parameters:
channelContext - com.ibm.dse.clientserver.ChannelContext