com.plumtree.uiinfrastructure.interpreter
Class Interpreter

java.lang.Object
  extended by com.plumtree.uiinfrastructure.interpreter.Interpreter
All Implemented Interfaces:
IXPPage
Direct Known Subclasses:
Interpreter

public class Interpreter
extends java.lang.Object
implements IXPPage

The Interpreter class takes HTTP requests, checks the authentication on the request sessions, processes the requests for any activity-space related operations, including IControl executions and PEI invocations, and finally writes the response to the client browser.

Author:
Don Hayler, robertz (StoreBrowserSettings), Daniilk (Gateway), Mike Jahr (SSO), Julie Fournier (Security Modes), WilliamA (Writing this new class)

Field Summary
static java.lang.String BROWSERTYPE
          stored as a BrowserType object
static java.lang.String CHECKPOINT_CONTROL_END
           
static java.lang.String CHECKPOINT_CONTROL_START
          internal timer checkpoint constants
static java.lang.String CHECKPOINT_DISPLAY_END
           
static java.lang.String CHECKPOINT_DISPLAY_START
           
static java.lang.String CHECKPOINT_PAGE_END
           
static java.lang.String CHECKPOINT_PAGE_START
           
static java.lang.String DEFAULTERRORSPACE
          mj: default error space.
static java.lang.String HOSTNAME
          stored as a string
static java.lang.String HOSTPORT
          stored as an Integer
static java.lang.String JSON_DATA_TYPE
          Mime type for JSON data.
protected static IAuthenticator m_Authenticator
           
protected static MVCController m_MVCController
           
static java.lang.String USERLOCALE
          stored as a string
static java.lang.String USERSESSIONVALID
          false implies guest -- this should only be read in the Interpreter (and elsewhere).
 
Constructor Summary
Interpreter()
           
 
Method Summary
static void AddNonFormDataRequestPattern(java.lang.String _strPattern)
          Adds non-form data url patterns (I.E.
static Redirect CheckSessionAuth(RequestData tempData)
          This helper method performs basic session authentication.
static void ClearSandbox(ISessionManager smSandbox)
          This is the only way to safely clear the sandbox so that it gets correctly re-initialized.
 void DoService(IXPRequest request, IXPResponse response, ISessionManager session, IApplication application)
          Pass the HTTP request to the static control code.
protected static boolean EqualRedirects(Redirect r1, Redirect r2)
           
static HTMLElementCollection GenerateDiagnosticErrorPage(IXPRequest request, EventLog[] eventVector, XPArrayList reportLog)
          Method: GenerateDiagnosticErrorPage Purpose: Helper method to output an error as a diagnostic style startup error page.
static java.lang.String GenerateFailureHTML()
          Uses the startup diagnostics strings to form an HTML message.
static java.lang.String GenerateFailureHTMLInsecure()
          Insecure, outward-facing, simplified HTML for startup failure message
static void HandleError(java.lang.Exception e, RequestData tempData)
          This method handles displaying an error page, or displaying an error if that is not possible.
static void HandleRequest(IXPRequest request, IXPResponse response, ISessionManager session, IApplication application)
          Handle the HTTP request by getting the appropriate control, filling out its data, and returning the Display page from the control.
static void InitializePersonalSettingsSession(ISessionManager session)
          Initializes the personal settings session manager off the sandbox session.
static boolean IsErrorPageRequired(RequestData tempData)
          This method checks whether or not an error page is required and changes the space information if necessary, but does not get the actual space.
protected static boolean IsNotFormRequest(java.lang.String uri)
          Checks if the provided url is not a form POST URL (i.e.
static void OutputStartupFailure(IXPRequest request, IXPResponse response)
          Method: OutputStartupFailure Purpose: Helper method to output startup failure message.
static void SendHTTPRedirect(Redirect myRedirect, RequestData tempData)
          This helper method sends a 302 redirect.
static void SetContentLanguageOnPageData(RequestData _tempData)
          JF- Helper method to retrieve the current locale from the Session and set it on the PageData.
static void StoreBrowserSettings(ISessionManager subSession, IXPRequest request)
          Stores the browser settings from the current request on the subsession.
static void StoreHostPortSettings(ISessionManager subSession, IXPRequest request)
          Stores the host name and port number from the current request on the subsession.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULTERRORSPACE

public static final java.lang.String DEFAULTERRORSPACE
mj: default error space.

See Also:
Constant Field Values

HOSTNAME

public static final java.lang.String HOSTNAME
stored as a string

See Also:
Constant Field Values

HOSTPORT

public static final java.lang.String HOSTPORT
stored as an Integer

See Also:
Constant Field Values

USERSESSIONVALID

public static final java.lang.String USERSESSIONVALID
false implies guest -- this should only be read in the Interpreter (and elsewhere). It is set in the LoginHelper.SetSessionValidity() method.

See Also:
Constant Field Values

USERLOCALE

public static final java.lang.String USERLOCALE
stored as a string

See Also:
Constant Field Values

BROWSERTYPE

public static final java.lang.String BROWSERTYPE
stored as a BrowserType object

See Also:
Constant Field Values

CHECKPOINT_CONTROL_START

public static final java.lang.String CHECKPOINT_CONTROL_START
internal timer checkpoint constants

See Also:
Constant Field Values

CHECKPOINT_CONTROL_END

public static final java.lang.String CHECKPOINT_CONTROL_END
See Also:
Constant Field Values

CHECKPOINT_PAGE_START

public static final java.lang.String CHECKPOINT_PAGE_START
See Also:
Constant Field Values

CHECKPOINT_PAGE_END

public static final java.lang.String CHECKPOINT_PAGE_END
See Also:
Constant Field Values

CHECKPOINT_DISPLAY_START

public static final java.lang.String CHECKPOINT_DISPLAY_START
See Also:
Constant Field Values

CHECKPOINT_DISPLAY_END

public static final java.lang.String CHECKPOINT_DISPLAY_END
See Also:
Constant Field Values

JSON_DATA_TYPE

public static final java.lang.String JSON_DATA_TYPE
Mime type for JSON data. JSON requests will not have the POST data parsed automatically.

See Also:
Constant Field Values

m_Authenticator

protected static final IAuthenticator m_Authenticator

m_MVCController

protected static final MVCController m_MVCController
Constructor Detail

Interpreter

public Interpreter()
Method Detail

AddNonFormDataRequestPattern

public static void AddNonFormDataRequestPattern(java.lang.String _strPattern)
Adds non-form data url patterns (I.E. gateway requests). These signal the Interpreter not to parse the request body as form-encoded. This allows subsequent code to get the input stream. NOTe: This method is not threadsafe and should only be called by static initializers. Called on the first request after startup by GatewayHelpers.

Parameters:
pattern - A pattern is just a part of a non-form data url, for example: '/gateway/PTARGS_' or '/gw/' The latter example is the default keyword for gateway friendly urls, it isn't completely unique since you could name a community or page 'gw' but it is up to the customer to choose a unique enough friendly url keyword.

ClearSandbox

public static void ClearSandbox(ISessionManager smSandbox)
This is the only way to safely clear the sandbox so that it gets correctly re-initialized. This does not reset the SESSIONVALID variable.

Parameters:
smSandbox -

InitializePersonalSettingsSession

public static void InitializePersonalSettingsSession(ISessionManager session)
Initializes the personal settings session manager off the sandbox session. This is done automatically when a new RequestData object is created. If the sandbox has been cleared, this re-initializes the personal settings session manager.


DoService

public void DoService(IXPRequest request,
                      IXPResponse response,
                      ISessionManager session,
                      IApplication application)
Pass the HTTP request to the static control code.

Specified by:
DoService in interface IXPPage
Parameters:
request -
response -
session -
application -

HandleRequest

public static void HandleRequest(IXPRequest request,
                                 IXPResponse response,
                                 ISessionManager session,
                                 IApplication application)
Handle the HTTP request by getting the appropriate control, filling out its data, and returning the Display page from the control.

Parameters:
request -
response -
session -
application -

IsNotFormRequest

protected static boolean IsNotFormRequest(java.lang.String uri)
Checks if the provided url is not a form POST URL (i.e. gateway, or REST API). NOTE: This is based off of a static list of patterns for non-form POST URLs. This list is initialized by the GatewayHelpers static initializer, so the list will not be complete until that class is used (i.e. the second request).

Parameters:
uri - url of the request to check
Returns:
true means that this request is not a form post request. false means we don't know.

OutputStartupFailure

public static void OutputStartupFailure(IXPRequest request,
                                        IXPResponse response)
Method: OutputStartupFailure Purpose: Helper method to output startup failure message. Uses diagnostic notification arrays to form recommendation.


GenerateDiagnosticErrorPage

public static HTMLElementCollection GenerateDiagnosticErrorPage(IXPRequest request,
                                                                EventLog[] eventVector,
                                                                XPArrayList reportLog)
Method: GenerateDiagnosticErrorPage Purpose: Helper method to output an error as a diagnostic style startup error page. Uses diagnostic notification arrays to form recommendation. Useful if you have a fundamental error that is similar to a startup check, such as licensing. Notes: Be sure to supply at least one element on the eventlog vector; the reportlog can be null or a series of strings. Note also that the eventlog should ideally have valid values that tie back to a real startup task in order to load an appropriate recommendation. Here, for example, are some licensing settings: EventLog[] eventVector = new EventLog[1]; eventVector[0].taskID = PTStartupTasks.VALIDATELICENSE.getOrdinal(); eventVector[0].taskStep = 1; eventVector[0].taskName = "ValidateLicense"; eventVector[0].platformName = Platform.getCurPlatform().getName(); eventVector[0].errorMessage = "Session License Failure"; eventVector[0].errorDescription = "You have exceeded your allowed session count on the evaluation of your license."; eventVector[0].exceptionRecommendation = "Contact BEA sales and purchase a production license."; eventVector[0].retVal = PT_STARTUP_RESULTCODES.FATAL; GenerateDiagnosticErrorPage(request, eventVector, null);


GenerateFailureHTML

public static java.lang.String GenerateFailureHTML()
Uses the startup diagnostics strings to form an HTML message.

Returns:

GenerateFailureHTMLInsecure

public static java.lang.String GenerateFailureHTMLInsecure()
Insecure, outward-facing, simplified HTML for startup failure message

Returns:

HandleError

public static void HandleError(java.lang.Exception e,
                               RequestData tempData)
This method handles displaying an error page, or displaying an error if that is not possible.

Parameters:
Exception - the exception that caused us to go here.

IsErrorPageRequired

public static boolean IsErrorPageRequired(RequestData tempData)
This method checks whether or not an error page is required and changes the space information if necessary, but does not get the actual space.

Parameters:
RequestData - the temporary request data object.
Returns:
true means error page is required, and therefore we shouldn't get it from the cache.

StoreHostPortSettings

public static void StoreHostPortSettings(ISessionManager subSession,
                                         IXPRequest request)
Stores the host name and port number from the current request on the subsession.

Parameters:
subSession -
request -

StoreBrowserSettings

public static void StoreBrowserSettings(ISessionManager subSession,
                                        IXPRequest request)
Stores the browser settings from the current request on the subsession.

Parameters:
subSession -
request -

SetContentLanguageOnPageData

public static void SetContentLanguageOnPageData(RequestData _tempData)
JF- Helper method to retrieve the current locale from the Session and set it on the PageData. (It will later be set in the HTTP header by WebData.)

Parameters:
_tempData -

CheckSessionAuth

public static Redirect CheckSessionAuth(RequestData tempData)
This helper method performs basic session authentication. It does not issue login challenges.

Parameters:
tempData - The current request data.
Returns:
Redirect Any redirect generated by the login process.

SendHTTPRedirect

public static void SendHTTPRedirect(Redirect myRedirect,
                                    RequestData tempData)
This helper method sends a 302 redirect.

Parameters:
myRedirect - The 302 redirect to send.
tempData - The current request data.

EqualRedirects

protected static boolean EqualRedirects(Redirect r1,
                                        Redirect r2)



Copyright © 2002,2003,2004,2005 Plumtree Software, Inc., All Rights Reserved.