com.bowstreet.webapp.engine
Class WebAppRunner

java.lang.Object
  extended by com.bowstreet.webapp.engine.WebAppRunner

public class WebAppRunner
extends java.lang.Object

Public class for invoking Bowstreet model, e.g. from a servlet, JSP page, or some other code that's handling a ServletRequest. There is one WebAppRunner object for a given ServletContext (created via getInstance).


Field Summary
static java.lang.String CURRENT_URI_ATTRIBUTE
           
static java.lang.String EVENT_TRIGGER_INPUT_NAME
           
static java.lang.String KEEP_CURRENT_URI_ATTRIBUTE
           
static java.lang.String REQUEST_TYPE
           
static java.lang.String SKIP_SET_HEADERS
           
static java.lang.String TRACK_CURRENT_ENCODING
           
 
Method Summary
 java.lang.Object doFireEvent(com.bowstreet.webapp.engine.WebAppRequestRunner webAppRequestRunner, java.lang.Object target, java.lang.String eventName, java.lang.Object[] args)
          Fires the specified event on the WebAppRequestRunner model instance.
 java.lang.Object doFireEvent(com.bowstreet.webapp.engine.WebAppRequestRunner webAppRequestRunner, java.lang.String eventName, java.lang.Object[] args)
          Fires the specified event on the WebAppRequestRunner model instance.
 java.lang.Object doLocalRequest(java.lang.String modelName, java.lang.String actionName, java.lang.String profileName)
          doLocalRequest - execute a local request for a specific model/action/profile creating dummy/mock servlet request/response with no inputs
 java.lang.Object doLocalRequest(java.lang.String modelName, java.lang.String actionName, java.lang.String profileName, RequestInputs reqInputs)
          doLocalRequest - execute a local request for a specific model/action/profile creating dummy/mock servlet request/response with specified inputs
 void doRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
          doRequest - Method to invoke model Gets everything including model name, action, profile... from request.
 void doRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String modelName, java.lang.String actionName, java.lang.String profileName)
          doRequest - Method to invoke model/action/profile Gets just inputs from request, model, action and optional profile are passed in as arguments.
 void doRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String modelName, java.lang.String actionName, java.lang.String profileName, RequestInputs reqInputs)
          doRequest - Method to invoke model/action Inputs have been built up by caller and are passed in.
 java.lang.Object doSOAPRequest(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String modelName, java.lang.String explicitProfile, java.lang.String actionName, java.lang.Object[] inputs)
          doSOAPRequest Method to invoke SOAP model/action for incoming request.
static void dumpDebugTracing(java.lang.String modelName, com.bowstreet.services.base.ActionStatus systemTrace, javax.servlet.http.HttpServletRequest request)
          dump debug tracing infomation.
static javax.servlet.http.HttpServletRequest getCurrentHttpServletRequest()
          This allows code which needs to know the current request to get it from our thread-local static variable.
 GenContainer getGenContainer(java.lang.String modelName, java.lang.String profileName, javax.servlet.http.HttpServletRequest request)
          getGenContainer - regenerate an return the GenContainer for the Domain Object for the specified model, optionally passing an explicit profile name and http request
static WebAppRunner getInstance(javax.servlet.ServletConfig config)
          getInstance Gets a singleton (for this ServletContext) instance.
 com.bowstreet.webapp.engine.RequestInputsImpl getRequestProcessUploadData(javax.servlet.http.HttpServletRequest req, boolean isViewRequest)
          Get a request reference and process file upload data if necessary Assume that caller already checked that this is multipart and upload enabled
 WebApp getWebApp(java.lang.String modelName, java.lang.String profileName, javax.servlet.http.HttpServletRequest request)
          getWebApp - regenerate an return the web app for the specified model, optionally using an explicit profile name and http request
 WebAppAccess getWebAppAccess(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String modelName, java.lang.String profileName, RequestInputs reqInputs)
          Gets a WebAppAccess instance for the specified model.
 com.bowstreet.webapp.engine.WebAppRequestRunner getWebAppRequestRunner(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, java.lang.String modelName, java.lang.String profileName, RequestInputs reqInputs)
          Gets a WebAppAccess instance for the specified model.
 boolean isMultipartRequest(javax.servlet.http.HttpServletRequest req)
           
 void reportUnhandledError(javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response, com.bowstreet.services.base.ActionStatus status, java.lang.Throwable ex)
           
static void setRequestCharacterEncoding(javax.servlet.http.HttpServletRequest req, boolean checkHeader)
           
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CURRENT_URI_ATTRIBUTE

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

EVENT_TRIGGER_INPUT_NAME

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

KEEP_CURRENT_URI_ATTRIBUTE

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

REQUEST_TYPE

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

SKIP_SET_HEADERS

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

TRACK_CURRENT_ENCODING

public static final java.lang.String TRACK_CURRENT_ENCODING
See Also:
Constant Field Values
Method Detail

doFireEvent

public java.lang.Object doFireEvent(com.bowstreet.webapp.engine.WebAppRequestRunner webAppRequestRunner,
                                    java.lang.Object target,
                                    java.lang.String eventName,
                                    java.lang.Object[] args)
Fires the specified event on the WebAppRequestRunner model instance.

Parameters:
webAppRequestRunner - The WebAppRequestRunner model instance.
target - where to deliver this event: EVENT_TARGET_ALL indicates broadcast to all models in session, EVENT_TARGET_SELF sends event only to the current model, EVENT_TARGET_PARENT means deliver to the parent of this model, and a value which is an instance of WebAppAccess causes delivery to that specific model
eventName - The name of the event to fire.
args - The arguments to pass to the event.

doFireEvent

public java.lang.Object doFireEvent(com.bowstreet.webapp.engine.WebAppRequestRunner webAppRequestRunner,
                                    java.lang.String eventName,
                                    java.lang.Object[] args)
Fires the specified event on the WebAppRequestRunner model instance.

Parameters:
webAppRequestRunner - The WebAppRequestRunner model instance.
eventName - The name of the event to fire.
args - The arguments to pass to the event.

doLocalRequest

public java.lang.Object doLocalRequest(java.lang.String modelName,
                                       java.lang.String actionName,
                                       java.lang.String profileName)
doLocalRequest - execute a local request for a specific model/action/profile creating dummy/mock servlet request/response with no inputs

Parameters:
modelName -
actionName -
profileName -

doLocalRequest

public java.lang.Object doLocalRequest(java.lang.String modelName,
                                       java.lang.String actionName,
                                       java.lang.String profileName,
                                       RequestInputs reqInputs)
doLocalRequest - execute a local request for a specific model/action/profile creating dummy/mock servlet request/response with specified inputs

Parameters:
modelName -
actionName -
profileName -
reqInputs -

doRequest

public void doRequest(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response)
doRequest - Method to invoke model Gets everything including model name, action, profile... from request.

Parameters:
request - request
response - response

doRequest

public void doRequest(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response,
                      java.lang.String modelName,
                      java.lang.String actionName,
                      java.lang.String profileName)
doRequest - Method to invoke model/action/profile Gets just inputs from request, model, action and optional profile are passed in as arguments.

Parameters:
request - request
response - response
modelName - the model name
actionName - the action name (or null for default action)
profileName - explicit profile name or null for default profile select.

doRequest

public void doRequest(javax.servlet.http.HttpServletRequest request,
                      javax.servlet.http.HttpServletResponse response,
                      java.lang.String modelName,
                      java.lang.String actionName,
                      java.lang.String profileName,
                      RequestInputs reqInputs)
doRequest - Method to invoke model/action Inputs have been built up by caller and are passed in. Writes any returned data to the response's output stream.

Parameters:
request - request
response - response
modelName - the model name
actionName - the action name (or null for default action)
profileName - explicit profile name or null for default profile select.
reqInputs - inputs object built up by the caller.

doSOAPRequest

public java.lang.Object doSOAPRequest(javax.servlet.http.HttpServletRequest request,
                                      javax.servlet.http.HttpServletResponse response,
                                      java.lang.String modelName,
                                      java.lang.String explicitProfile,
                                      java.lang.String actionName,
                                      java.lang.Object[] inputs)
doSOAPRequest Method to invoke SOAP model/action for incoming request.

Parameters:
request - request
response - response
modelName - the model name
explicitProfile - explicit profile name or null for default profile select.
actionName - the action name
inputs - inputs for the action

dumpDebugTracing

public static void dumpDebugTracing(java.lang.String modelName,
                                    com.bowstreet.services.base.ActionStatus systemTrace,
                                    javax.servlet.http.HttpServletRequest request)
dump debug tracing infomation.

Parameters:
modelName - the name of the model
systemTrace - the root node of the systemTrace object, which is acutually an ActionStatus instance
request - the http request

getCurrentHttpServletRequest

public static javax.servlet.http.HttpServletRequest getCurrentHttpServletRequest()
This allows code which needs to know the current request to get it from our thread-local static variable.

Returns:
HttpServletRequest current request, or null if none is available.

getGenContainer

public GenContainer getGenContainer(java.lang.String modelName,
                                    java.lang.String profileName,
                                    javax.servlet.http.HttpServletRequest request)
                             throws java.io.IOException,
                                    com.bowstreet.model.ModelRegenException
getGenContainer - regenerate an return the GenContainer for the Domain Object for the specified model, optionally passing an explicit profile name and http request

Parameters:
modelName - model name
profileName - optional explicit profile name or null
request - the incoming servlet request or null
Returns:
GenContainer - the regenerated GenContainer
Throws:
java.io.IOException
com.bowstreet.model.ModelRegenException

getInstance

public static WebAppRunner getInstance(javax.servlet.ServletConfig config)
getInstance Gets a singleton (for this ServletContext) instance. See if already attached to ServletContext and use that if so.

Parameters:
config - the ServletConfig
Returns:
WebAppRunner (this)

getRequestProcessUploadData

public com.bowstreet.webapp.engine.RequestInputsImpl getRequestProcessUploadData(javax.servlet.http.HttpServletRequest req,
                                                                                 boolean isViewRequest)
                                                                          throws java.io.IOException
Get a request reference and process file upload data if necessary Assume that caller already checked that this is multipart and upload enabled

Throws:
java.io.IOException

getWebApp

public WebApp getWebApp(java.lang.String modelName,
                        java.lang.String profileName,
                        javax.servlet.http.HttpServletRequest request)
                 throws java.io.IOException,
                        com.bowstreet.model.ModelRegenException
getWebApp - regenerate an return the web app for the specified model, optionally using an explicit profile name and http request

Parameters:
modelName - model name
profileName - optional explicit profile name
request - the incoming servlet request
Returns:
WebApp - the regenerated WebApp
Throws:
java.io.IOException
com.bowstreet.model.ModelRegenException

getWebAppAccess

public WebAppAccess getWebAppAccess(javax.servlet.http.HttpServletRequest request,
                                    javax.servlet.http.HttpServletResponse response,
                                    java.lang.String modelName,
                                    java.lang.String profileName,
                                    RequestInputs reqInputs)
Gets a WebAppAccess instance for the specified model.

Parameters:
request - request
response - response
modelName - the model name
profileName - explicit profile name or null for default profile select.
reqInputs - inputs object built up by the caller.
Returns:
A WebAppAccess instance for the specified model.

getWebAppRequestRunner

public com.bowstreet.webapp.engine.WebAppRequestRunner getWebAppRequestRunner(javax.servlet.http.HttpServletRequest request,
                                                                              javax.servlet.http.HttpServletResponse response,
                                                                              java.lang.String modelName,
                                                                              java.lang.String profileName,
                                                                              RequestInputs reqInputs)
Gets a WebAppAccess instance for the specified model.

Parameters:
request - request
response - response
modelName - the model name
profileName - explicit profile name or null for default profile select.
reqInputs - inputs object built up by the caller.
Returns:
A WebAppRequestRunner instance for the specified model.

isMultipartRequest

public boolean isMultipartRequest(javax.servlet.http.HttpServletRequest req)

reportUnhandledError

public void reportUnhandledError(javax.servlet.http.HttpServletRequest request,
                                 javax.servlet.http.HttpServletResponse response,
                                 com.bowstreet.services.base.ActionStatus status,
                                 java.lang.Throwable ex)

setRequestCharacterEncoding

public static void setRequestCharacterEncoding(javax.servlet.http.HttpServletRequest req,
                                               boolean checkHeader)


Copyright © 2009 IBM. All Rights Reserved.