BEA Systems, Inc.

com.beasys.commerce.foundation.flow.jsp
Class DefaultDestinationDeterminer

java.lang.Object
  |
  +--com.beasys.commerce.foundation.flow.jsp.DefaultDestinationDeterminer
Direct Known Subclasses:
PortalDestinationDeterminer

public class DefaultDestinationDeterminer
extends java.lang.Object
implements DestinationDeterminer, JspConstants


Field Summary
protected  boolean allowAutoLogin
          Whether the portal allows auto-login upon portal invocation.
protected  int cookieTimeout
          The time (in milliseconds) which elapses before the portal cookie is timed outl The cookie defaults to timing out when the browser is closed.
protected  java.lang.String defaultDest
          The portal's default destination.
protected  java.lang.String documentRoot
          The server's document root.
protected  java.lang.String groupName
          The group name associated with the portal instance.
protected  java.lang.String homePage
          The portal's home page.
protected  boolean inited
           
protected  long lastCheckTime
          The last time the working directory was checked.
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 portal session is timed out.
protected  java.lang.String trafficURI
          The URI of the DefaultDestinationHandler.
protected  java.lang.String workingDir
          The working directory, relative the server's document root, of the portal 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
DefaultDestinationDeterminer()
           
 
Method Summary
 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.
 java.lang.String determineDestination(javax.servlet.http.HttpServletRequest req)
          Figure out what the real destination is.
 java.lang.Object determineDestination(javax.servlet.ServletConfig aConfig, javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.util.Map aPropertySet)
          Implements the service method of the servlet.
 boolean getAllowAutoLogin()
           
 int getCookieTimeout()
           
 java.lang.String getDefaultDest()
           
 java.lang.String getDocumentRoot()
           
 java.lang.String getGroupName()
           
 java.lang.String getHomePage()
           
 long getLastCheckTime()
           
 int getRefreshWorkingDir()
           
 java.lang.String getRepositoryDir()
           
 SessionComparator getSessionComparator()
           
 java.lang.String getSessionParamName()
           
 int getSessionTimeout()
           
 java.lang.String getTrafficURI()
           
 java.lang.String getWorkingDir()
           
 java.util.HashSet getWorkingDirFiles()
           
 void getWorkingDirFiles(java.io.File aDirectory)
          Get the working directory files.
 void getWorkingDirFiles(javax.servlet.ServletConfig aConfig)
          Get working dir files.
 void init(javax.servlet.ServletConfig aConfig, java.util.Map aPropertySet)
          Initializes the servlet.
 java.lang.String initSession(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res)
          Handles the session initialization.
 boolean isWar(javax.servlet.ServletContext ctx)
          Determines if the context is deployed as a WAR file
 boolean isWar(javax.servlet.ServletContext ctx, java.lang.String aDestination)
          Determines if the context and destination is deployed as a WAR file.
 boolean isWebApp(javax.servlet.http.HttpServletRequest req)
          Determines if the context for a request is for a web app.
 void redirect(javax.servlet.http.HttpServletRequest req, javax.servlet.http.HttpServletResponse res, java.lang.String aDestination)
          If the destination contains a '?' (for parms).
 void resetSession(javax.servlet.http.HttpServletRequest aRequest)
          Reset the session to a known state.
 java.lang.String setTransactionalAttributes(javax.servlet.http.HttpServletRequest req, java.lang.String aDestination)
          Set transactional attributes on the request.
 boolean stillAlive(javax.servlet.http.HttpServletRequest aRequest)
          Check to see if the session has timed out.
 boolean userStillExist(java.lang.String aUser, javax.servlet.http.HttpServletRequest aRequest)
          Does the user still exist - is this user still in the system?
 boolean validDestination(javax.servlet.ServletConfig aConfig, java.lang.String aDestination)
          Check if the destination is valid.
 boolean validDestination(javax.servlet.ServletConfig aConfig, java.lang.String aDestination, java.io.File ignore)
          Deprecated. see validDestination(String)
 
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 DefaultDestinationHandler.

groupName

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

defaultDest

protected java.lang.String defaultDest
The portal's default destination.

homePage

protected java.lang.String homePage
The portal's home page.

sessionTimeout

protected int sessionTimeout
The time (in milliseconds) which elapses before the portal 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 portal cookie is timed outl The cookie defaults to timing out when the browser is closed.

allowAutoLogin

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

workingDir

protected java.lang.String workingDir
The working directory, relative the server's document root, of the portal 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. In WAR files, this value will be null.

sessionParamName

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

lastCheckTime

protected long lastCheckTime
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

inited

protected boolean inited
Constructor Detail

DefaultDestinationDeterminer

public DefaultDestinationDeterminer()
Method Detail

getTrafficURI

public java.lang.String getTrafficURI()

getGroupName

public java.lang.String getGroupName()

getDefaultDest

public java.lang.String getDefaultDest()

getHomePage

public java.lang.String getHomePage()

getSessionTimeout

public int getSessionTimeout()

getCookieTimeout

public int getCookieTimeout()

getAllowAutoLogin

public boolean getAllowAutoLogin()

getWorkingDir

public java.lang.String getWorkingDir()

getWorkingDirFiles

public java.util.HashSet getWorkingDirFiles()

getRefreshWorkingDir

public int getRefreshWorkingDir()

getDocumentRoot

public java.lang.String getDocumentRoot()

isWebApp

public boolean isWebApp(javax.servlet.http.HttpServletRequest req)
Determines if the context for a request is for a web app.
Parameters:
req - The HttpServletRequest associated with this handler.

isWar

public boolean isWar(javax.servlet.ServletContext ctx)
Determines if the context is deployed as a WAR file
Parameters:
ctx - The ServletContext associated with this handler.
Returns:
true if a WAR, false if not.

isWar

public boolean isWar(javax.servlet.ServletContext ctx,
                     java.lang.String aDestination)
Determines if the context and destination is deployed as a WAR file.
Parameters:
ctx - The ServletContext associated with this handler.
aDestination - The request's intended destination
Returns:
true if a WAR, false if not.

getSessionParamName

public java.lang.String getSessionParamName()

getLastCheckTime

public long getLastCheckTime()

getRepositoryDir

public java.lang.String getRepositoryDir()

getSessionComparator

public SessionComparator getSessionComparator()

init

public void init(javax.servlet.ServletConfig aConfig,
                 java.util.Map aPropertySet)
          throws FlowException
Initializes the servlet. Looks for the property "initial" to set the pageCount variable.
Parameters:
aPropertySet - the start up parameters for the portal.
Throws:
FlowException -  

stillAlive

public 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

public 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

public 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

public 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

public 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

public boolean validDestination(javax.servlet.ServletConfig aConfig,
                                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

public boolean validDestination(javax.servlet.ServletConfig aConfig,
                                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 -  

setTransactionalAttributes

public 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

public 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

public void getWorkingDirFiles(javax.servlet.ServletConfig aConfig)
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

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

initSession

public 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 -  

determineDestination

public java.lang.Object determineDestination(javax.servlet.ServletConfig aConfig,
                                             javax.servlet.http.HttpServletRequest req,
                                             javax.servlet.http.HttpServletResponse res,
                                             java.util.Map aPropertySet)
                                      throws FlowException
Implements the service method of the servlet.
Specified by:
determineDestination in interface DestinationDeterminer
Parameters:
req - the HttpServletRequest
res - the HttpServletResponse
Throws:
IOException -  
FlowException -  

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved