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 a JspServiceManager. Prescribes methods which faciltate p13n run-time operation. Allows access to the JspServiceManager 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
static java.lang.String DESTINATION_TAG
          A property name denoting the destination to be used with form submission.
 
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_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_SESSION_TIMEOUT, SERVICEMANAGER_SUCCESSOR, SERVICEMANAGER_USER, TRAFFIC_URI, TRANSACTION_SERVICE, TRANSACTION_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 JspServiceManager 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 JspServiceManager 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 JspServiceManager 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 JspServiceManager 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 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 JspServiceManager.
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 JspServiceManager application.
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 JspServiceManager 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
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

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 JspServiceManager.
Parameters:
aRequest - the javax.servlet.http.HttpServletRequest from which the JspServiceManager is obtained.
Returns:
String the URI of the JspServiceManager. If you are not using a Service Manager, then this will return null;

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 JspServiceManager 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 JspServiceManager 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 JspServiceManager
Returns:
String the default destination of the p13n app instantiation

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 JspServiceManager 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)
Check to see if the file exists in the working directory of the JspServiceManager 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.
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 JspServiceManager 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 JspServiceManager home page

getCurrentPage

public static java.lang.String getCurrentPage(javax.servlet.http.HttpServletRequest aRequest)
Returns the currently active JspServiceManager application page.
Parameters:
aRequest - the http.servlet.http.HttpServletRequest from which JspServiceManager 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 JspServiceManager 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 JspServiceManager app.
Parameters:
the - JspServiceManager 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 JspServiceManager to avoid naming collisions when multiple JspServiceManager 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 JspServiceManager to avoid naming collisions when multiple JspServiceManager 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 JspServiceManager to avoid naming collisions when multiple JspServiceManager 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 JspServiceManager to avoid naming collisions when multiple JspServiceManager 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