BEA Systems, Inc.

com.beasys.commerce.axiom.jsp
Class JspServiceManager

java.lang.Object
  |
  +--javax.servlet.GenericServlet
        |
        +--javax.servlet.http.HttpServlet
              |
              +--com.beasys.commerce.axiom.jsp.JspServiceManager
Direct Known Subclasses:
PortalServiceManager

public class JspServiceManager
extends javax.servlet.http.HttpServlet
implements JspConstants

Acts as a traffic cop for a non-portal, p13n application. Provides redirection, forwarding, name-resolution, and security services. Note: The JspServiceManager is being deprecated in favor of the FlowManager, which provides additional functionality. Please see the documentation for the FlowManager.

See Also:
Serialized Form

Field Summary
protected  boolean allowAutoLogin
          Whether the p13n application allows auto-login upon invocation.
protected  int cookieTimeout
          The time (in milliseconds) which elapses before the p13n application cookie is timed outl The cookie defaults to timing out when the browser is closed.
protected  java.lang.String defaultDest
          The p13n application's default destination.
protected  DefaultDestinationDeterminer determiner
          Delegate for maintenance of one set of code.
protected  java.lang.String documentRoot
          The server's document root.
protected  java.lang.String groupName
          The group name associated with the p13n application instance.
protected  java.lang.String homePage
          The p13n application's home page.
protected  long lastCheckTime
          Deprecated. - this value is meaningless for this release of JspServiceManager. It will always be -1 from this implementation.
protected  java.util.HashMap map
          Read the servlet initialization parameters into a Map.
protected  int refreshWorkingDir
          Check for files every time.
protected  java.lang.String repositoryDir
          Default implementation.
protected  SessionComparator sessionComparator
          The session comparator used to validate a HttpServletRequest
protected  java.lang.String sessionParamName
          The name assigned to the session.
protected  int sessionTimeout
          The time (in milliseconds) which elapses before the p13n application session is timed out.
protected  java.lang.String trafficURI
          The URI of the JspServiceManager.
protected  java.lang.String workingDir
          The working directory, relative the server's document root, of the p13n application instance.
protected  java.util.HashSet workingDirFiles
          This is the list of files contained within the working directory.
 
Fields inherited from interface com.beasys.commerce.axiom.jsp.JspConstants
DATE_FORMAT, DEFAULT_DESTINATION, DEFAULT_SUCCESSOR, DESTINATION_URI, IMMUTABLE_SERVICEMANAGER_HOME_PAGE, JSP_CALENDAR_FEATURES, JSP_COMMERCE_CALENDAR_FEATURES, JSP_PORTALS_BASE_DIRECTORY, JSP_TOOLS_ADMIN_HOME, JSP_TOOLS_BASE_DIRECTORY, JSP_TOOLS_DOC_RTR, JSP_TOOLS_GUIDE_FEATURES, JSP_TOOLS_PROPERTYMGMT_ADMIN_HOME, JSP_TOOLS_USERMGMT_ADMIN_HOME, JSP_TOOLS_UTIL_DIRECTORY, P13N_CACHED_REQUEST, P13N_CACHED_SESSION, REPOSITORY_DIR, SERVICEMANAGER_COOKIE_TIMEOUT, SERVICEMANAGER_CURRENT_PAGE, SERVICEMANAGER_HOME_PAGE, SERVICEMANAGER_LOGGED_IN, SERVICEMANAGER_OVERRIDE_BOOK, SERVICEMANAGER_SESSION_TIMEOUT, SERVICEMANAGER_SUCCESSOR, SERVICEMANAGER_USER, SERVLET_CONFIG, TRAFFIC_URI, TRANSACTION_SERVICE, TRANSACTION_TIMEOUT, USER_TRANS_TIMEOUT, WORKING_DIR, WORKING_DIR_FILES
 
Constructor Summary
JspServiceManager()
          Default constructor.
 
Method Summary
protected  void appendParameters(java.lang.String key, java.lang.String[] values, java.lang.StringBuffer sb)
          Help creating the request query string, if we need to redirect the destination.
 void baseReset(javax.servlet.http.HttpServletRequest aRequest)
          Reset the values that can't be overridden.
protected  java.lang.String determineDestination(javax.servlet.http.HttpServletRequest req)
          Figure out what the real destination is.
protected  void finishTx(javax.transaction.UserTransaction tx, javax.servlet.http.HttpServletRequest req)
          Deprecated.  
protected  void getWorkingDirFiles()
          Get working dir files.
protected  void getWorkingDirFiles(java.io.File aDirectory)
          Get the working directory files.
 void init(javax.servlet.ServletConfig config)
          Initializes the servlet.
protected  void initDeterminer()
          Init determiner.
protected  java.lang.String initSession(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Handles the session initialization.
protected  void redirect(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.lang.String aDestination)
          If the destination contains a '?' (for parms).
protected  void resetSession(javax.servlet.http.HttpServletRequest aRequest)
          Reset the session to a known state.
 void service(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Implements the service method of the servlet.
protected  java.lang.String setTransactionalAttributes(javax.servlet.http.HttpServletRequest req, java.lang.String aDestination)
          Set transactional attributes on the request.
protected  javax.transaction.UserTransaction startTx()
          Deprecated.  
protected  boolean stillAlive(javax.servlet.http.HttpServletRequest aRequest)
          Check to see if the session has timed out.
protected  boolean userStillExist(java.lang.String aUser, javax.servlet.http.HttpServletRequest aRequest)
          Does the user still exist - is this user still in the system?
protected  boolean validDestination(java.lang.String aDestination)
          Check if the destination is valid.
protected  boolean validDestination(java.lang.String aDestination, java.io.File ignore)
          Deprecated. see validDestination(String)
 
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, log, log
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

trafficURI

protected java.lang.String trafficURI
The URI of the JspServiceManager.

groupName

protected java.lang.String groupName
The group name associated with the p13n application instance.

defaultDest

protected java.lang.String defaultDest
The p13n application's default destination.

homePage

protected java.lang.String homePage
The p13n application's home page.

sessionTimeout

protected int sessionTimeout
The time (in milliseconds) which elapses before the p13n application session is timed out. The session defaults to timing out when the browser is closed.

cookieTimeout

protected int cookieTimeout
The time (in milliseconds) which elapses before the p13n application cookie is timed outl The cookie defaults to timing out when the browser is closed.

allowAutoLogin

protected boolean allowAutoLogin
Whether the p13n application allows auto-login upon invocation. If auto-login is allowed, the user's cookie will be used to automatically log the user into the p13n application. Otherwise, a default p13n application is presented, and the user must login.

workingDir

protected java.lang.String workingDir
The working directory, relative the server's document root, of the p13n application instance.

workingDirFiles

protected java.util.HashSet workingDirFiles
This is the list of files contained within the working directory. This will be used for repository checking, and may or may not be reset based on flags set within the servlet start up parameters.

refreshWorkingDir

protected int refreshWorkingDir
Check for files every time. This means a recursive look at the directory structure if true.

documentRoot

protected java.lang.String documentRoot
The server's document root.

sessionParamName

protected java.lang.String sessionParamName
The name assigned to the session.

lastCheckTime

protected long lastCheckTime
Deprecated. - this value is meaningless for this release of JspServiceManager. It will always be -1 from this implementation.

The last time the working directory was checked.

repositoryDir

protected java.lang.String repositoryDir
Default implementation. Will look in this directory if it can't find the requested file beneath the working dir.

sessionComparator

protected SessionComparator sessionComparator
The session comparator used to validate a HttpServletRequest

map

protected java.util.HashMap map
Read the servlet initialization parameters into a Map.

determiner

protected DefaultDestinationDeterminer determiner
Delegate for maintenance of one set of code.
Constructor Detail

JspServiceManager

public JspServiceManager()
Default constructor.
Method Detail

initDeterminer

protected void initDeterminer()
Init determiner.

init

public void init(javax.servlet.ServletConfig config)
          throws javax.servlet.ServletException
Initializes the servlet. Looks for the property "initial" to set the pageCount variable.
Overrides:
init in class javax.servlet.GenericServlet
Parameters:
config - a ServletConfig configuration
Throws:
ServletException -  

stillAlive

protected boolean stillAlive(javax.servlet.http.HttpServletRequest aRequest)
Check to see if the session has timed out.
Parameters:
aRequest - the HttpServletRequest to get the session from
Returns:
true if the session is still within time limits

userStillExist

protected boolean userStillExist(java.lang.String aUser,
                                 javax.servlet.http.HttpServletRequest aRequest)
Does the user still exist - is this user still in the system?
Parameters:
aUser - the user name
aRequest - the HttpServletRequest
Returns:
boolean yes/no

determineDestination

protected java.lang.String determineDestination(javax.servlet.http.HttpServletRequest req)
Figure out what the real destination is. Check the override destination first to see if they wanted to send it somewhere that was not a request parameter. If they don't have either of those items (attribute or req parm) then if they are logged in, send them to homepage otherwise send them to the default destination.
Parameters:
req - the HttpServletRequest
Returns:
the destination string

appendParameters

protected void appendParameters(java.lang.String key,
                                java.lang.String[] values,
                                java.lang.StringBuffer sb)
Help creating the request query string, if we need to redirect the destination. We would redirect the destination if the destination contained a query string.
Parameters:
key - the string key
values - the String array of associated values to the key
sb - the stringbuffer to continue filling

redirect

protected void redirect(javax.servlet.http.HttpServletRequest req,
                        javax.servlet.http.HttpServletResponse res,
                        java.lang.String aDestination)
                 throws java.io.IOException
If the destination contains a '?' (for parms). If this is true we need to redirect the request (and all parameters) to the traffic cop without the destination containing a query.
Parameters:
req - the HttpServletRequest
res - the HttpServletResponce
adestination - the destination with a query string
Throws:
IOException -  

validDestination

protected boolean validDestination(java.lang.String aDestination,
                                   java.io.File ignore)
                            throws java.io.IOException
Deprecated. see validDestination(String)

Check if the destination is valid. This is primarily a security check. They may have tried to beat the directory structures by using relative paths. NOTE: this method does not check to see if the file exists.
Parameters:
a - destination the destination
f - ignored
Returns:
true if it is valid
Throws:
IOException -  

validDestination

protected boolean validDestination(java.lang.String aDestination)
                            throws java.io.IOException
Check if the destination is valid. This is primarily a security check. They may have tried to beat the directory structures by using relative paths. NOTE: this method does not check to see if the file exists.
Parameters:
a - destination the destination
Returns:
true if it is valid
Throws:
IOException -  

startTx

protected javax.transaction.UserTransaction startTx()
Deprecated.  

Start a transaction.
Returns:
UserTransaction

finishTx

protected void finishTx(javax.transaction.UserTransaction tx,
                        javax.servlet.http.HttpServletRequest req)
Deprecated.  

Finish a transaction.
Parameters:
tx - UserTransaction
req - the HttpServletRequest

setTransactionalAttributes

protected java.lang.String setTransactionalAttributes(javax.servlet.http.HttpServletRequest req,
                                                      java.lang.String aDestination)
                                               throws java.rmi.RemoteException
Set transactional attributes on the request. Possibly get session beans for use throughout the system.
Parameters:
req - the HttpServletRequest
aDestination - the destination URL
Returns:
String if it is suspended this will be the suspended url.
Throws:
RemoteException -  

getWorkingDirFiles

protected void getWorkingDirFiles(java.io.File aDirectory)
Get the working directory files. This is a recursive method for walking the directory structure beneath the workingDir.
Parameters:
aDirectory - a File object representing a directory.

getWorkingDirFiles

protected void getWorkingDirFiles()
Get working dir files. Calls the recursive method. Since the hashmap containing the working directory files it must be synchronized to be thread safe.

baseReset

public void baseReset(javax.servlet.http.HttpServletRequest aRequest)
Reset the values that can't be overridden.
Parameters:
aRequest - the HttpServletRequest

resetSession

protected void resetSession(javax.servlet.http.HttpServletRequest aRequest)
Reset the session to a known state.
Parameters:
aRequest - the HttpServletRequest to get the session from

initSession

protected java.lang.String initSession(javax.servlet.http.HttpServletRequest req,
                                       javax.servlet.http.HttpServletResponse res)
                                throws java.io.IOException
Handles the session initialization.
Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Throws:
IOException -  

service

public void service(javax.servlet.http.HttpServletRequest req,
                    javax.servlet.http.HttpServletResponse res)
             throws java.io.IOException,
                    javax.servlet.ServletException
Implements the service method of the servlet.
Overrides:
service in class javax.servlet.http.HttpServlet
Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Throws:
IOException -  
ServletException -  

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved