|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--javax.servlet.GenericServlet | +--javax.servlet.http.HttpServlet | +--com.ibm.dse.cs.servlet.CSReqServlet
The CSReqServlet implements the ChannelDriver interface
This servlet defines the front door for all devices supporting the HTTP protocol This class implements HTTP specifical behaviour for saving the information associated to a session into a databse using the service suplies by the WebSphere through the HttpSession class. For this example, the parent context for ALL the workstation contexts is the "root" context. To use the data persistence you must set the value of the tag "channelHandlers.html.requestHandler" of the dse.ini file to: com.ibm.dse.cs.html.ext.PersistHtmlRequestHandler It's also possible to specify if exists session affinity or not with the tag "initialization.sessionAffinity" of the dse.ini file. By default session affinity is assumed. To specify that there isn't session affinity sets its value to "no" ( or "false", or "0", or "disable" ). To use this feature you must activate the persistence of the session of the WebSphere, see the WebSphere documentation.
Field Summary | |
protected boolean |
sessionAffinity
Indicates whether the server configuration features session affinity. |
protected boolean |
sessionPersistence
Indicates whether the server is configured to work under persistence conditions. |
Constructor Summary | |
CSReqServlet()
CSServlet constructor. |
Method Summary | |
ChannelContext |
createChannelContext(java.lang.Object req,
java.lang.Object res,
java.lang.Object driver)
Creates a ChannelContext object with the req, res, driver attributes. |
void |
createChannelHandler(ChannelContext channelContext)
Creates a ChannelHandler object with the channelContext attribute. |
protected void |
createSessionEntry(java.lang.Object sessionObject)
Restore the information. |
protected void |
getDeviceType(ChannelContext channelContext)
Determine the device type for the handler and add to the ChannelContext object. |
protected PresentationHandler |
getPresentationHandler(ChannelContext channelContext)
Determine the PresentationHandler to invoke for the specific channel driver |
protected RequestHandler |
getRequestHandler(ChannelContext channelContext)
Determine the RequestHandler to invoke for the specific channel driver |
boolean |
getSessionAffinity()
Returns the value of the attribute sessionAffinity. |
boolean |
getSessionPersistence()
Returns the value of the attribute sessionPersistence. |
protected void |
handleException(ChannelContext channelContext,
java.lang.Exception ex)
Invoke the presentation handler to pass the exception to the client |
protected void |
handleException(java.lang.Exception ex)
Log the exception with the framwework trace facility |
protected void |
handleServerResponse(ChannelContext channelContext,
java.lang.Exception e)
Convenience method to ensure that a response is returned to the client for the case where no presentation handler exists or because the server is not initialized. |
void |
parseRequestData(ChannelContext channelContext)
Parse the contents of the parameters contained in the HttpServletRequest |
void |
parseRequestHeader(ChannelContext channelContext)
Parse the contents of the header contained in the HttpServletRequest |
void |
preProcessRequest(ChannelContext channelContext)
Perform any session management/control required at the device level. |
protected void |
removeSessionEntry(java.lang.Object sessionObject)
Removes an entry of the session table. |
void |
retrieve(ChannelContext channelContext)
Restores the data associated to the session saved previously. |
protected void |
retrieveWithoutSessionAffinity(ChannelContext channelContext)
Restore the information when there isn't session affinity. |
protected void |
retrieveWithSessionAffinity(ChannelContext channelContext)
Restore the information when there is session affinity. |
protected boolean |
runInSession(ChannelContext channelContext)
Determine from the HandlerRegistry if the device type should run in session |
protected void |
service(javax.servlet.http.HttpServletRequest req,
javax.servlet.http.HttpServletResponse res)
Define the process flow to execute a request. |
protected void |
setSessionAffinity()
Gets from the initialization file (dse.ini) the value of the tag initialization.sessionAffinity, and sets the value of the attribute sessionAffinity. |
void |
setSessionAffinity(boolean sessAffinity)
Sets the value of the attribute sessionAffinity. |
protected void |
setSessionPersistence()
Gets from the initialization file (dse.ini) the value of the tag initialization.sessionPersistence, and sets the value of the attribute sessionPersistence. |
void |
setSessionPersistence(boolean newSessionPersistence)
Sets the value of the attribute sessionPersistence. |
void |
store(ChannelContext channelContext)
Saves the information associated to the session sessionId through the HttpSession. |
protected void |
updateChannelHandler(ChannelHandler ch,
java.lang.String key,
java.lang.String value)
Special processing required for the channel specific parameters in the server dse.ini file |
protected boolean |
usingCookies(ChannelContext channelContext)
Determine from the HandlerRegistry if the device type is using cookies to manage the session |
Methods inherited from class javax.servlet.http.HttpServlet |
doDelete,
doGet,
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 boolean sessionAffinity
protected boolean sessionPersistence
Constructor Detail |
public CSReqServlet()
Method Detail |
public ChannelContext createChannelContext(java.lang.Object req, java.lang.Object res, java.lang.Object driver)
The parameters are passed as objects to support all potential channel drivers
req
- java.lang.Objectres
- java.lang.Objectrep
- java.lang.Objectpublic void createChannelHandler(ChannelContext channelContext) throws java.lang.Exception
Cache the ChannelHandler into the HandlerRegistry singleton. Instiate RequestHandler, PresentationHandler and a Hashtable to contain all variable params located in the dse.ini file.
This should only be performed the first time that the channel is accessed
channelContext
- com.ibm.dse.clientserver.ChannelContextprotected void createSessionEntry(java.lang.Object sessionObject) throws DSEException
protected void getDeviceType(ChannelContext channelContext) throws DSENoRegisteredDeviceTypeException
This is the default implementation to obtain the requester device type. Currently support (Java clients, Web Browsers and XML Clients)
The default implementation uses the "User-Agent" tag in the Http request header
channelContext
- com.ibm.dse.clientserver.ChannelContextprotected PresentationHandler getPresentationHandler(ChannelContext channelContext) throws DSENoRegisteredPresentationHandlerException
Obtain the presenation handler from the HandlerRegistry
channelContext
- com.ibm.dse.clientserver.ChannelContextprotected RequestHandler getRequestHandler(ChannelContext channelContext) throws DSENoRegisteredRequestHandlerException
Obtain the request handler from the HandlerRegistry
channelContext
- com.ibm.dse.clientserver.ChannelContextpublic boolean getSessionAffinity()
public boolean getSessionPersistence()
protected void handleException(ChannelContext channelContext, java.lang.Exception ex)
Test to ensure that the server is started and the channel context has a device type. If the server is unable to process a response to the server trace the exception
channelContext
- com.ibm.dse.clientserver.ChannelContextex
- java.lang.Exceptionprotected void handleException(java.lang.Exception ex)
ex
- java.lang.Exceptionprotected void handleServerResponse(ChannelContext channelContext, java.lang.Exception e) throws java.lang.Exception
channelContext
- com.ibm.dse.clientserver.ChannelContextjava.lang.Exception
- public void parseRequestData(ChannelContext channelContext) throws java.lang.Exception
Parse to the request data into the KeyedCollection. Add the kColl to the ChannelContext request data
Override this method to modify the behaviour of the data parsing
channelContext
- com.ibm.dse.clientserver.ChannelContextpublic void parseRequestHeader(ChannelContext channelContext) throws java.lang.Exception
Parse to the request header into the KeyedCollection. Add the kColl to the ChannelContext request data
Override this method to modify the behaviour of the data parsing
channelContext
- com.ibm.dse.clientserver.ChannelContextpublic void preProcessRequest(ChannelContext channelContext) throws DSECSSessionNotEstablishedException
Insert the channel session into the ChannelContext
Must provide support for using cookies and hidden form field to manage the session.
Throw a DSECSSessionNotExtablishedException if the session has expired.
channelContext
- com.ibm.dse.clientserver.ChannelContextprotected void removeSessionEntry(java.lang.Object sessionObject) throws DSEException
public void retrieve(ChannelContext channelContext) throws DSEException
protected void retrieveWithoutSessionAffinity(ChannelContext channelContext) throws DSEException
protected void retrieveWithSessionAffinity(ChannelContext channelContext) throws DSEException
protected boolean runInSession(ChannelContext channelContext) throws DSECSSessionNotEstablishedException
This requires that the application have a valid session and the opertation has a parent context. Default is true - always run in session for backwards compatibility.
If the request is to run out of session add the "dse_ignore" to the application id
channelContext
- com.ibm.dse.clientserver.ChannelContextprotected void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res) throws javax.servlet.ServletException, java.io.IOException
req
- HttpServletRequestres
- HttpServletResponseprotected void setSessionAffinity()
public void setSessionAffinity(boolean sessAffinity)
newSessionPersistence
- booleanprotected void setSessionPersistence()
public void setSessionPersistence(boolean newSessionPersistence)
newSessionPersistence
- booleanpublic void store(ChannelContext channelContext) throws DSEException
protected void updateChannelHandler(ChannelHandler ch, java.lang.String key, java.lang.String value) throws java.lang.Exception
Instantiate the instances of the PresentationHandler and RequestHandler. All other parameters are added to a Hashtable.
ch
- com.ibm.dse.clientserver.ChannelHandlerkey
- java.lang.Stringvalue
- java.lang.Stringprotected boolean usingCookies(ChannelContext channelContext)
Default is to return false to support backwards compatibility.
channelContext
- com.ibm.dse.clientserver.ChannelContext
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |