BEA Systems, Inc.

com.beasys.commerce.axiom.jsp
Class JspBase

java.lang.Object
  |
  +--weblogic.servlet.jsp.JspBase
        |
        +--com.beasys.commerce.axiom.jsp.JspBase
Direct Known Subclasses:
P13NJspBase, ToolsJspBase

public abstract class JspBase
extends weblogic.servlet.jsp.JspBase
implements JspConstants

Acts as a base class for all JSP pages that use the Flow Manager. Prescribes methods which facilitate p13n run-time operation. Allows access to the FlowManager URI, the application's working directory, the home page, and the current page. Also, facilitates management of the application's run-time session, by providing convenience methods for setting and getting session values, and setting and getting JSP destinations. Implements several constants interfaces to reduce the burden of constant referencing by JSP pages.


Field Summary
protected static boolean debug
          Whether debug mode is on.
static java.lang.String DESTINATION_TAG
          A property name denoting the destination to be used with form submission.
 
Fields inherited from class weblogic.servlet.jsp.JspBase
_servletConfig
 
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
JspBase()
           
 
Method Summary
static java.lang.String cnvrtSC(java.lang.String theInpStr)
          Given a string, substitute HTML entities for HTML special characters.
static java.lang.String createURL(javax.servlet.http.HttpServletRequest aRequest, java.lang.String destination, java.lang.String parameters)
          Creates a FlowManager application URL from the given request.
static java.lang.String escapeQuotes(java.lang.String input)
          Escape single-quotes from a string to make them javascript-friendly (this also runs the string through cnvrtSC)
static java.lang.String fixupRelativeURL(java.lang.String aURL, javax.servlet.http.HttpServletRequest aRequest)
          With the system using jsp:forward the relative directories may not be set employed correctly.
static java.lang.String getCurrentPage(javax.servlet.http.HttpServletRequest aRequest)
          Returns the currently active FlowManager application page.
static java.lang.String getDefaultDestination(javax.servlet.http.HttpServletRequest aRequest)
          Get the default destination specified in the registration.
static java.lang.String getDefaultSuccessor(javax.servlet.http.HttpServletRequest aRequest)
          Get the default succssor (group) that was specified in the servlet registration.
static java.lang.String getHomePage(javax.servlet.http.HttpServletRequest aRequest)
          Retrieves the FlowManger application home page specified by the start-up parameters for the p13n app.
static boolean getLoggedIn(javax.servlet.http.HttpServletRequest aRequest)
          Indicates whether a user is currently logged into the FlowManager app.
static java.lang.String getRepositoryDirectory(javax.servlet.http.HttpServletRequest aRequest)
          Get the Portal repository directory specified in the registration.
static java.lang.String getRequestURI(javax.servlet.http.HttpServletRequest aRequest)
          Retrieves the request URI.
static javax.servlet.ServletConfig getServletConfig(javax.servlet.http.HttpServletRequest aRequest)
          Get the servlet config from the request
static java.lang.Object getSessionValue(java.lang.String aName, javax.servlet.http.HttpServletRequest aRequest)
          Retrieves a session value.
static java.lang.String getTrafficURI(javax.servlet.http.HttpServletRequest aRequest)
          Retrieves the URI of the FlowManager.
static java.lang.String getTrafficURINoContext(javax.servlet.http.HttpServletRequest aRequest)
          Get traffic URI with no context.
static java.lang.String getWorkingDirectory(javax.servlet.http.HttpServletRequest aRequest)
          Get the working directory specified in the registration.
static java.lang.String pathFromRequest(javax.servlet.http.HttpServletRequest aRequest)
          Get the fully-qualified path of the request URI.
static void putSessionValue(java.lang.String aName, java.lang.Object aValue, javax.servlet.http.HttpServletRequest aRequest)
          Sets a session value.
static java.lang.String reconcileFile(javax.servlet.http.HttpServletRequest aRequest, java.lang.String aURL)
          Check to see if the file exists in the working directory of the FlowManager application.
static java.lang.String reconcileFile(javax.servlet.http.HttpServletRequest aRequest, java.lang.String aURL, boolean addWebappContext)
          Call the reconcileFile method specifying whether any webapp context should be included.
static void removeSessionValue(java.lang.String aName, javax.servlet.http.HttpServletRequest aRequest)
          Removes a session value.
static void setAlternateDestination(javax.servlet.http.HttpServletRequest req, java.lang.String dest)
          Deprecated. use setOverrideDestination
static void setLoggedIn(javax.servlet.http.HttpServletRequest aRequest, javax.servlet.http.HttpServletResponse aResponse, boolean aBool)
          Sets the logged-in state for this FlowManager application.
static void setOverrideDestination(javax.servlet.http.HttpServletRequest req, java.lang.String dest)
          Sets the alternate forward variable.
static void setSessionValue(java.lang.String aName, java.lang.Object aValue, javax.servlet.http.HttpServletRequest aRequest)
          Sets a session value.
static void setSuccessor(java.lang.String aSuccessor, javax.servlet.http.HttpServletRequest aRequest)
          Takes a group name and puts it into the session as the value of the SERVICEMANAGER_SUCCESSOR
static void setUser(java.lang.String aUser, javax.servlet.http.HttpServletRequest aRequest)
          Takes a user name and puts it into the session as the value of the SERVICEMANAGER_USER
static void setUserAndSuccessor(java.lang.String aUser, java.lang.String aSuccessor, javax.servlet.http.HttpServletRequest aRequest)
          Takes a user name and a group name and puts them into the session as the values of the SERVICEMANAGER_USER and SERVICEMANAGER_SUCCESSOR, respectively
 
Methods inherited from class weblogic.servlet.jsp.JspBase
_jspService, destroy, getServletConfig, getServletInfo, init, jspDestroy, jspInit, service
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

debug

protected static final boolean debug
Whether debug mode is on. Facilitates debug output for JSP pages.

DESTINATION_TAG

public static final java.lang.String DESTINATION_TAG
A property name denoting the destination to be used with form submission. A JSP page typically uses this constant in the following manner: In this example, the destination is set as the current URI, so that the form will post to the page itself.
Constructor Detail

JspBase

public JspBase()
Method Detail

getTrafficURI

public static java.lang.String getTrafficURI(javax.servlet.http.HttpServletRequest aRequest)
Retrieves the URI of the FlowManager.
Parameters:
aRequest - the javax.servlet.http.HttpServletRequest from which the FlowManager is obtained.
Returns:
String the URI of the FlowManager. If you are not using a Service Manager, then this will return null;

getTrafficURINoContext

public static java.lang.String getTrafficURINoContext(javax.servlet.http.HttpServletRequest aRequest)
Get traffic URI with no context. This is required for jsp:forward within a webapp.
Parameters:
aRequest -  
Returns:
String

getWorkingDirectory

public static java.lang.String getWorkingDirectory(javax.servlet.http.HttpServletRequest aRequest)
Get the working directory specified in the registration.
Parameters:
aRequest - javax.servlet.http.HttpServletRequest from which the FlowManager is obtained.
Returns:
String the value of the working directory of the current p13n app instantiation

getRepositoryDirectory

public static java.lang.String getRepositoryDirectory(javax.servlet.http.HttpServletRequest aRequest)
Get the Portal repository directory specified in the registration.
Parameters:
aRequeset - javax.servlet.http.HttpServletRequest from which the FlowManager is obtained.
Returns:
String the value of the working directory of the current portal instantiation

getDefaultDestination

public static java.lang.String getDefaultDestination(javax.servlet.http.HttpServletRequest aRequest)
Get the default destination specified in the registration.
Parameters:
the - javax.servlet.http.HttpServletRequest corresponding to the FlowManager
Returns:
String the default destination of the p13n app instantiation

getServletConfig

public static javax.servlet.ServletConfig getServletConfig(javax.servlet.http.HttpServletRequest aRequest)
Get the servlet config from the request
Parameters:
the - javax.servlet.http.HttpServletRequest corresponding to the FlowManager
Returns:
ServletConfig the current request's configuration

getRequestURI

public static java.lang.String getRequestURI(javax.servlet.http.HttpServletRequest aRequest)
Retrieves the request URI. The p13n app uses it to figure out the current page. According to the JSP 1.0 spec, the requestURI returned from request.getRequestURI may not give you the current page. So to get around it, use this method. It will first look for the "javax.servlet.include.request_uri" attribute. If it is null or empty, the request.getRequestURI() method wil be called.
Parameters:
the - javax.servlet.http.HttpServletRequest for which the URI is sought
Returns:
the real request URI

pathFromRequest

public static java.lang.String pathFromRequest(javax.servlet.http.HttpServletRequest aRequest)
Get the fully-qualified path of the request URI.
Parameters:
aRequest - the javax.servlet.http.HttpServletRequest for which the fully-qualified path is sought
Returns:
String the fully qualified path from the request

createURL

public static java.lang.String createURL(javax.servlet.http.HttpServletRequest aRequest,
                                         java.lang.String destination,
                                         java.lang.String parameters)
Creates a FlowManager application URL from the given request. JSP pages can use this method to ensure that the URLs used for p13n app navigation are properly applied in various environments ( e.g. cookies on vs. cookies off ).
Parameters:
aRequest - The javax.servlet.http.HttpServletRequest used to create the full URL.
destination - The desired destination. If the destination is not fully qualified (assumed relative), it will query the request to prepend the path. NOTE: do not include a query string in the destination.
parameters - The parameters. These will be appended to the URL.
Returns:
String the created URL

fixupRelativeURL

public static java.lang.String fixupRelativeURL(java.lang.String aURL,
                                                javax.servlet.http.HttpServletRequest aRequest)
With the system using jsp:forward the relative directories may not be set employed correctly. Use this method to fixup relative URLs so that they become fully qualified. For example if you are referring to an image in your JSP page as img src="images/dummy.gif", the system may not be able to find it. Change your code to img="<%=fixupRelativeURL("images/dummy.gif")%>. This will ensure that your URL is correct, and not stop you from moving your directory structures around as you wish.
Parameters:
aURL - the url to fixup.
aRequest - the associated request.
Returns:
String the fixed-up URL.

reconcileFile

public static java.lang.String reconcileFile(javax.servlet.http.HttpServletRequest aRequest,
                                             java.lang.String aURL,
                                             boolean addWebappContext)
Call the reconcileFile method specifying whether any webapp context should be included. If requested, any webapp context available will be prepended to the result. Otherwise, it will be suppressed. Server-side operations do not need the context. Client-side path information does. This method may be used for non-webapps and war/non-war webapps.
Parameters:
aURL - the file to check for. This can be a fully qualified url, in which case nothing happens.
aRequest - the request, because we need the repository directory as well as the hashmap associated to the current servlet.
addWebappContext - a flag indicating whether to add or suppress any available webapp context
Returns:
String the reconciled file name. Will return aURL if it is fully qualified or can be found in the working directory.

reconcileFile

public static java.lang.String reconcileFile(javax.servlet.http.HttpServletRequest aRequest,
                                             java.lang.String aURL)
Check to see if the file exists in the working directory of the FlowManager application. It will only check if it is not a fully qualified url (from the document root). If it is in the working directory it will return the file prepended with the working directory. Otherwise it will force it to point to the repository directory structure. Note: calls to reconcileFile for any browser client-side path information must have the context, but calls for server-side processing (i.e. jsp:include) cannot have the context. For this reason, an assumption is made that the only server-side, reconcileFile() calls will be for ".jsp" files. If this is not true, use the other variant of reconcileFile.
Parameters:
aURL - the file to check for. This can be a fully qualified url, in which case nothing happens.
aRequest - the request, because we need the repository directory as well as the hashmap associated to the current servlet.
Returns:
String the reconciled file name. Will return aURL if it is fully qualified or can be found in the working directory.

getHomePage

public static java.lang.String getHomePage(javax.servlet.http.HttpServletRequest aRequest)
Retrieves the FlowManger application home page specified by the start-up parameters for the p13n app.
Parameters:
aRequest - the http.servlet.http.HttpServletRequest from which p13n app information is obtained
Returns:
String the FlowManager home page

getCurrentPage

public static java.lang.String getCurrentPage(javax.servlet.http.HttpServletRequest aRequest)
Returns the currently active FlowManager application page.
Parameters:
aRequest - the http.servlet.http.HttpServletRequest from which FlowManager information is obtained
Returns:
String the current p13n app page

setAlternateDestination

public static void setAlternateDestination(javax.servlet.http.HttpServletRequest req,
                                           java.lang.String dest)
Deprecated. use setOverrideDestination

Sets the alternate forward variable. This value overrides the DESTINATION_TAG property upon form submission.
Parameters:
req - the javax.servlet.http.HttpServletRequest associated with the form submission
destination - the JSP page which ultimate processes the request

setOverrideDestination

public static void setOverrideDestination(javax.servlet.http.HttpServletRequest req,
                                          java.lang.String dest)
Sets the alternate forward variable. This value overrides the DESTINATION_TAG property upon form submission.
Parameters:
req - the javax.servlet.http.HttpServletRequest associated with the form submission
dest - the JSP page which ultimate processes the request

setLoggedIn

public static void setLoggedIn(javax.servlet.http.HttpServletRequest aRequest,
                               javax.servlet.http.HttpServletResponse aResponse,
                               boolean aBool)
Sets the logged-in state for this FlowManager application. This will also reset the necessary cookie values for a valid session, if the logged-in value is true.
Parameters:
aRequest - the javax.servlet.http.HttpServletRequest used to retrieve the session for update
the - corresponding javax.servlet.http.HttpServletResponse
aBool - designates the true or false logged-in value

getLoggedIn

public static boolean getLoggedIn(javax.servlet.http.HttpServletRequest aRequest)
Indicates whether a user is currently logged into the FlowManager app.
Parameters:
the - FlowManager app javax.servlet.http.HttpServletRequest
Returns:
boolean whether a user is logged in

getSessionValue

public static java.lang.Object getSessionValue(java.lang.String aName,
                                               javax.servlet.http.HttpServletRequest aRequest)
Retrieves a session value. The session value name is 'fixed' up for the current FlowManager to avoid naming collisions when multiple FlowManager objects share the same session.
Parameters:
aName - the name of the session property whose value is sought
aRequest - the javax.servlet.http.HttpServletRequest from which the session is obtained
Returns:
Object the new property value

setSessionValue

public static void setSessionValue(java.lang.String aName,
                                   java.lang.Object aValue,
                                   javax.servlet.http.HttpServletRequest aRequest)
Sets a session value. The session value name is 'fixed' up for the current FlowManager to avoid naming collisions when multiple FlowManager objects share the same session.
Parameters:
aName - the name of the session property whose value is to be set
aValue - the new property value
aRequest - the javax.servlet.http.HttpServletRequest from which the session is obtained

putSessionValue

public static void putSessionValue(java.lang.String aName,
                                   java.lang.Object aValue,
                                   javax.servlet.http.HttpServletRequest aRequest)
Sets a session value. The session value name is 'fixed' up for the current FlowManager to avoid naming collisions when multiple FlowManager objects share the same session.
Parameters:
aName - the name of the session property whose value is to be set
aValue - the new property value
aRequest - the javax.servlet.http.HttpServletRequest from which the session is obtained

removeSessionValue

public static void removeSessionValue(java.lang.String aName,
                                      javax.servlet.http.HttpServletRequest aRequest)
Removes a session value. The session value name is 'fixed' up for the current FlowManager to avoid naming collisions when multiple FlowManager objects share the same session.
Parameters:
aName - the name of the session property to be removed
aValue - the new property value
aRequest - the javax.servlet.http.HttpServletRequest from which the session is obtained

cnvrtSC

public static java.lang.String cnvrtSC(java.lang.String theInpStr)
Given a string, substitute HTML entities for HTML special characters.
Parameters:
theInpStr - the string to be converted
Returns:
String the string with special chars translated

setUser

public static void setUser(java.lang.String aUser,
                           javax.servlet.http.HttpServletRequest aRequest)
Takes a user name and puts it into the session as the value of the SERVICEMANAGER_USER
Parameters:
aUser - the user name
aRequest - the javax.servlet.http.HttpServletRequest from which the session is obtained

setSuccessor

public static void setSuccessor(java.lang.String aSuccessor,
                                javax.servlet.http.HttpServletRequest aRequest)
Takes a group name and puts it into the session as the value of the SERVICEMANAGER_SUCCESSOR
Parameters:
aSuccessor - the group name
aRequest - the javax.servlet.http.HttpServletRequest from which the session is obtained

setUserAndSuccessor

public static void setUserAndSuccessor(java.lang.String aUser,
                                       java.lang.String aSuccessor,
                                       javax.servlet.http.HttpServletRequest aRequest)
Takes a user name and a group name and puts them into the session as the values of the SERVICEMANAGER_USER and SERVICEMANAGER_SUCCESSOR, respectively
Parameters:
aUser - the user name
aSuccessor - the group name
aRequest - the javax.servlet.http.HttpServletRequest from which the session is obtained

getDefaultSuccessor

public static java.lang.String getDefaultSuccessor(javax.servlet.http.HttpServletRequest aRequest)
Get the default succssor (group) that was specified in the servlet registration.
Parameters:
aRequest. -  
Returns:
the default successor.

escapeQuotes

public static java.lang.String escapeQuotes(java.lang.String input)
Escape single-quotes from a string to make them javascript-friendly (this also runs the string through cnvrtSC)
Parameters:
intput - the String to escape
Returns:
the escaped String

BEA Systems, Inc.

Copyright © 2000 BEA Systems, Inc. All Rights Reserved