com.wewebu.ow.server.ui
Class OwAppContext

java.lang.Object
  extended by com.wewebu.ow.server.ui.OwEventTarget
      extended by com.wewebu.ow.server.ui.OwAppContext
Direct Known Subclasses:
OwMainAppContext

public abstract class OwAppContext
extends OwEventTarget

Main Application Context Class Base Implementation. Instance stays active during session.

Alfresco Workdesk
Copyright (c) Alfresco Software, Inc.
All rights reserved.

For licensing information read the license.txt file or
go to: http://wiki.alfresco.com


Nested Class Summary
static class OwAppContext.OwDialogManagerViewReference
           View reference for the dynamically changing dialog manager.
 
Field Summary
static String AJAX_REQUEST_TYPE
          the name of request attribute used to mark a request as an AJAX request
static String CONFIG_JNDI_SUFFIX
          suffix for JNDI names
static String CONFIG_STREAM_NAME_PREFIX
          prefix for config file / stream / JNDI names
static String EXTERNAL_REQUEST_TARGET_ID
          target ID query string key for external requests, used for remote control
static String FULLJS_MARKER
          support to execute completely the java script, without adding default return
static String INTERNAL_REQUEST_TARGET_ID
          target ID query string key for internal requests
static int KEYBOARD_CTRLKEY_ALT
          control key ID
static int KEYBOARD_CTRLKEY_CTRL
          control key ID
static int KEYBOARD_CTRLKEY_NONE
          control key ID
static int KEYBOARD_CTRLKEY_SHIFT
          control key ID
static int KEYBOARD_KEY_DEL
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_DN
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_END
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_ESC
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_F1
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_F10
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_F11
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_F12
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_F2
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_F3
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_F4
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_F5
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_F6
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_F7
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_F8
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_F9
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_INS
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_LEFT
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_PAGE_DN
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_PAGE_UP
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_POS1
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_RETURN
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_RIGHT
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_SPACE
          key board key ID for the registerKeyEvent function
static int KEYBOARD_KEY_UP
          key board key ID for the registerKeyEvent function
static String LOGIN_VIEW_TARGET_ID
          predefined target ID for the login view
 String m_DEBUG_ActivateViewID
          debug variable contains the ID of the last activated view via a OwNavigationView event.
 String m_DEBUG_NavigationEvent
          debug variable contains the event name last called via a OwNavigationView event.
 String m_DEBUG_NavigationTargetID
          debug variable contains the ID of the view last called via a OwNavigationView event.
protected  javax.servlet.ServletContext m_ServletContext
          servlet context reference for this session
static String MAIN_VIEW_TARGET_ID
          predefined target ID for the main view
static String PREPARED_REQUEST_URL
           
static String RESOURCE_CLASSPATH_PREFIX
          prefix to configure a subdir in the java class path (WEB-INF/classes or WEB-INF/lib)
static String RESOURCE_DEPLOYMENT_PREFIX
          prefix to configure a subdir in the deployment structure
static String RESOURCE_FILE_PATH_ENVIRONMENT_VAR_NAME_PARAM
          parameter name of the resource file path environment var name in web.xml
static String RESOURCE_FILE_PATH_PARAM
          parameter name of the resource file path in web.xml
static String SELECTED_ANCHOR
          name of the anchor which will be append on the URL
static String TIME_ZONE_DAYLIGHTSAVINGS_PARAMETER_NAME
           
static String TIME_ZONE_ID_PARAMETER_NAME
           
static String TIME_ZONE_NORTHERN_HEMISPHERE_PARAMETER_NAME
           
static String TIME_ZONE_OFFSET_PARAMETER_NAME
           
static String TIME_ZONE_TIME_PARAMETER_NAME
           
static String TIME_ZONE_TRANSITIONS_PARAMETER_NAME
           
 
Constructor Summary
OwAppContext()
          Creates a new instance of OwAppContext
 
Method Summary
 void activateView(String strTargetID_p)
          activate view designated by the TargetID, i.e.
 void beginRequest()
          signal that request has started to prevent concurrent requests.
 void broadcast(OwEventTarget caller_p, int iCode_p)
          causes all attached documents to receive an update event
 void clearFocusControlID()
          clear the focus control ID for the request
 void closeAllDialogs()
          closes all dialogs
protected  OwBaseInitializer createBaseInitializer(javax.servlet.ServletContext context_p)
          Creates a base initializer for a given context.
protected  String createBaseUrl(javax.servlet.http.HttpServletRequest req_p)
          (overridable) Create base URL which will be used to process the request.
protected  String createJspPageUrl(javax.servlet.http.HttpServletRequest req_p)
          (overridable) URL with jsp page, like server URL + context path.
protected  String createServerUrl(javax.servlet.http.HttpServletRequest req_p)
          (overridable) Called to create the server URL for current request.
protected static String createSubmitFunction(String formName_p, String eventUrl_p)
          creates JavaSript statements to fire a form submit event URL is enclosed in single apostrophe
protected static String createSubmitLink(String formName_p, String eventUrl_p)
          creates a href link to fire a form submit event URL is enclosed in single apostrophe
static String decodeURL(String strURL_p)
          decodes a URL or part of an URL, that was previously encoded using encodeURL.
 void dump(Writer w_p)
          write debug dump to Writer.
static String encodeURL(String strURL_p)
          encodes a URL or part of an URL so it conforms to HTTP standard (application/x-www-form-URL-encoded MIME format)
 void endRequest()
          signal that request has ended and to prevent OwPendingSessionException in beginRequest, to prevent concurrent requests.
 String getAjaxEventURL(OwEventTarget target_p, String strEventName_p, String strAdditionalParameters_p)
          get a URL for the requested AJAX event and redirect to submitted view
protected abstract  URL getAppContextResource(String resourcePath_p)
          (overridable) Retrieves a resource for this application context.
 Object getApplicationAttribute(String key_p)
          get a attribute from the application scope
protected  StringBuffer getBaseEventURL(OwEventTarget target_p, String strEventName_p)
          get a base URL with no additional parameters for the requested event and redirect to submitted view
 String getBasePath()
          get the base path to the application
 String getBaseURL()
          get the URL to the web application context root
 TimeZone getClientTimeZone()
           
 OwTimeZoneInfo getClientTimeZoneInfo()
          Get client's time zone offset information.
 URL getConfigURL(String strName_p)
          loads a URL for a configuration either from local file, external file or from a JNDI context
abstract  String getDesignDir()
          get the directory of the used design.
abstract  String getDesignURL()
          get the URL of the used design.
abstract  OwDialogManager getDialogManager()
          get a reference to the default dialog manager used to open dialogs from the context in openDialog(...) The dialog manager must be created somewhere in the layout and returned here.
 OwBaseView getDialogManagerViewReference()
          return a view reference for the dynamically changing dialog manager
 OwEventTarget getEventTarget(String strName_p)
          find the registered event target
 String getEventURL(OwEventTarget target_p, String strEventName_p, String strAdditionalParameters_p)
          get a URL for the requested event and redirect to submitted view
 String getFocusControlID()
          get the ID of a control that should receive the input focus for this request
 String getFormEventFunction(OwEventTarget target_p, String strEventName_p, String strAdditionalParameters_p, String strFormName_p)
          get a script function for the requested event sending the form data defined in the event target with getFormName()
 String getFormEventURL(OwEventTarget target_p, String strEventName_p, String strAdditionalParameters_p, String strFormName_p)
          get a URL for the requested event sending the form data defined in the event target with getFormName()
 javax.servlet.http.HttpServletRequest getHttpRequest()
          get the current HTTP request
 javax.servlet.http.HttpServletResponse getHttpResponse()
          get the current HTTP response
 javax.servlet.ServletContext getHttpServletContext()
          get the current HHTP servlet context
 javax.servlet.http.HttpSession getHttpSession()
          get the current HTTP session
 String getInfiniteEventURL(OwEventTarget target_p, String strEventName_p, String strAdditionalParameters_p)
          get a URL for the requested event and redirect to submitted view The URL is infinite, meaning that it can be used in all following requests where a normal event URL is only valid for the very next request.
abstract  OwInfoProviderRegistry getInfoProviderRegistry()
          Get a info provider registry which is used to request information provider for special context.
 String getInitParameter(String strParamName_p)
          get a parameter from the web.xml config file
 String getJSPPageURL()
          get the name of the JSP Page
 Collection<OwKeyEvent> getKeyEvents()
          get a Collection of Lists of registered OwKeyEvents.
abstract  Locale getLocale()
          get the current locale, which can be used as a prefix/postfix to distinguish localization resources
<T> T
getRegisteredInterface(Class<T> typeClass)
          Return the cached object, if any is contained.
 String getServerURL()
          get the URL to the web application server
abstract  String getSessionDisplayName()
          get a name for the current session, used for warning and error logs to identify the session later.
 int getTargetCount()
          retrieves the target count in the context.
 OwBaseUserInfo getUserInfo()
          get the logged in user
 InputStream getXMLConfigDoc(String strName_p)
          loads a XML Document either from local file, external file or from a JNDI context
 void handleAjaxRequest(javax.servlet.http.HttpServletRequest request_p, javax.servlet.http.HttpServletResponse response_p)
          handles the AJAX request and dispatches to the correct target
protected  boolean handleExternalTargetRequest(javax.servlet.http.HttpServletRequest request_p, javax.servlet.http.HttpServletResponse response_p)
          Method which executes external target request, and return a result if the external target request was processed successful or not.
 boolean handleRequest(javax.servlet.http.HttpServletRequest request_p, javax.servlet.http.HttpServletResponse response_p)
          handles the JSP request from the page and dispatches to the correct target
 void init(OwAppContext oldcontext_p)
          init the context BEFORE the user has logged on.
 boolean isAjaxRequest()
          Check if the current HttpServletRequest object is an AJAX request.
abstract  boolean isContainerBasedAuthenticated()
          check the current user is authenticated container based
 boolean isExternalTargetRequest(javax.servlet.http.HttpServletRequest request_p)
          Check if the request contains an external target id.
protected  boolean isFormRequest(javax.servlet.http.HttpServletRequest request_p)
          Returns whether this request carries FORM data and thus the onFormEvent() of the target has to be invoked or not.
abstract  boolean isLogin()
          check the valid credentials of the logged in user
 String localize(String strKey_p, String strText_p)
          localizes a string
 String localize1(String strKey_p, String strText_p, String strAttribute1_p)
          localizes a string with additional parameter that is replaced with %1
 String localize2(String strKey_p, String strText_p, String strAttribute1_p, String strAttribute2_p)
          localizes a string with additional parameter that is replaced with %1
 String localize3(String strKey_p, String strText_p, String strAttribute1_p, String strAttribute2_p, String strAttribute3_p)
          localizes a string with additional parameter that is replaced with %1
abstract  void loginInit()
          init the context AFTER the user has logged in.
 void logout()
          clear the credentials, i.e.
 void openDialog(OwDialog dialogView_p, OwDialog.OwDialogListener listener_p)
          display a new dialog using the dialog manager set in setDialogManager(...) After it is closed it gets removed from the DialogManager and the context to finalize the Dialog View
 boolean prepareRequest(javax.servlet.http.HttpServletRequest request_p, javax.servlet.http.HttpServletResponse response_p)
          Request precondition handler for all JSP based requests.
 void registerInterface(Class<?> typeClass, Object object)
          Register some specific object for a defined class/interface.
 void registerKeyAction(OwKeyAction action)
           
 void registerKeyAction(String actionId, String strEventURL, String description)
           
 void registerKeyAction(String actionId, String strEventURL, String strFormName, String description)
           
 void registerKeyEvent(int iKeyCode_p, int iCtrlKey_p, String strEventURL_p, String description_p)
          register a keyboard key to a event URL, the registered key is only valid for one page request, so it must be called in onRender
 void registerKeyEvent(OwKeyEvent keyEvent)
           
 void registerKeyFormEvent(int iKeyCode_p, int iCtrlKey_p, String strEventURL_p, String strFormName_p, String description_p)
          register a keyboard key to a event URL, the registered key is only valid for one page request, so it must be called in onRender
 void registerRequestTarget(OwEventTarget target_p)
          registers a target to receive onRequest(...) events for each request the target must already be registered with registerTarget or OwEventTarget.attach
 String registerTarget(OwEventTarget target_p, String strName_p)
          register the event target in the context and assign a unique ID
 void removeTarget(OwEventTarget target_p)
          remove the event target from the context
 void removeTarget(String strID_p)
          remove the event target from the context
 void renderJSInclude(String sJSPath_p, boolean useDebug_p, Writer w_p)
          Used to include ExtJs scripts, in production or debug mode
 void renderJSInclude(String sJSPath_p, Writer w_p)
          render a JavaScript include link.
 void renderKeyBoardScript(Writer w_p)
          Deprecated. 
 void serverSideInclude(String path_p, Writer w_p)
          Include the specified URL writing its output to the current Writer object.
 void setAjaxRequest(boolean isAjaxRequest_p)
          Set a marking attribute on the current HttpServletRequest object.
 Object setApplicationAttribute(String key_p, Object object_p)
          get a attribute from the application scope
 void setClientTimeZoneInfo(OwTimeZoneInfo timeZoneInfo_p)
          Set client's time zone information.
 void setFocusControlID(String strElementID_p)
          set the ID of a HTML element to receive focus upon page load
abstract  void setLocale(Locale locale_p)
           
static void setLocalThreadRequest(javax.servlet.http.HttpServletRequest request_p)
          Set the request associated with current thread.
static void setLocalThreadResponse(javax.servlet.http.HttpServletResponse response_p)
          Set the response associated with current thread.
 void setRequest(javax.servlet.ServletContext context_p, javax.servlet.http.HttpServletRequest request_p, javax.servlet.http.HttpServletResponse response_p)
          set the request parameters, called upon each request, MUST BE CALLED BEFORE INIT.
<T> T
unregisterInterface(Class<T> typeClass)
          Unregister the object for given class/interface.
 void unregisterRequestTarget(OwEventTarget target_p)
          unregisters a target to receive onRequest(...) events for each request the target must already be registered with registerTarget or OwEventTarget.attach
 
Methods inherited from class com.wewebu.ow.server.ui.OwEventTarget
attach, detach, disableRequestListener, enableRequestListener, getAjaxEventURL, getContext, getEventURL, getFormEventFunction, getFormEventURL, getFormName, getFormTarget, getID, init, onExternalRequest, onFormEvent, onRequest, setExternalFormTarget, updateExternalFormTarget
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

AJAX_REQUEST_TYPE

public static final String AJAX_REQUEST_TYPE
the name of request attribute used to mark a request as an AJAX request

Since:
3.1.0.0
See Also:
Constant Field Values

FULLJS_MARKER

public static final String FULLJS_MARKER
support to execute completely the java script, without adding default return

See Also:
Constant Field Values

KEYBOARD_KEY_RETURN

public static final int KEYBOARD_KEY_RETURN
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_ESC

public static final int KEYBOARD_KEY_ESC
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_F1

public static final int KEYBOARD_KEY_F1
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_F2

public static final int KEYBOARD_KEY_F2
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_F3

public static final int KEYBOARD_KEY_F3
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_F4

public static final int KEYBOARD_KEY_F4
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_F5

public static final int KEYBOARD_KEY_F5
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_F6

public static final int KEYBOARD_KEY_F6
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_F7

public static final int KEYBOARD_KEY_F7
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_F8

public static final int KEYBOARD_KEY_F8
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_F9

public static final int KEYBOARD_KEY_F9
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_F10

public static final int KEYBOARD_KEY_F10
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_F11

public static final int KEYBOARD_KEY_F11
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_F12

public static final int KEYBOARD_KEY_F12
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_INS

public static final int KEYBOARD_KEY_INS
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_DEL

public static final int KEYBOARD_KEY_DEL
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_POS1

public static final int KEYBOARD_KEY_POS1
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_END

public static final int KEYBOARD_KEY_END
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_UP

public static final int KEYBOARD_KEY_UP
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_DN

public static final int KEYBOARD_KEY_DN
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_LEFT

public static final int KEYBOARD_KEY_LEFT
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_RIGHT

public static final int KEYBOARD_KEY_RIGHT
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_PAGE_UP

public static final int KEYBOARD_KEY_PAGE_UP
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_PAGE_DN

public static final int KEYBOARD_KEY_PAGE_DN
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_KEY_SPACE

public static final int KEYBOARD_KEY_SPACE
key board key ID for the registerKeyEvent function

See Also:
Constant Field Values

KEYBOARD_CTRLKEY_NONE

public static final int KEYBOARD_CTRLKEY_NONE
control key ID

See Also:
Constant Field Values

KEYBOARD_CTRLKEY_SHIFT

public static final int KEYBOARD_CTRLKEY_SHIFT
control key ID

See Also:
Constant Field Values

KEYBOARD_CTRLKEY_CTRL

public static final int KEYBOARD_CTRLKEY_CTRL
control key ID

See Also:
Constant Field Values

KEYBOARD_CTRLKEY_ALT

public static final int KEYBOARD_CTRLKEY_ALT
control key ID

See Also:
Constant Field Values

SELECTED_ANCHOR

public static final String SELECTED_ANCHOR
name of the anchor which will be append on the URL

See Also:
Constant Field Values

MAIN_VIEW_TARGET_ID

public static final String MAIN_VIEW_TARGET_ID
predefined target ID for the main view

See Also:
Constant Field Values

LOGIN_VIEW_TARGET_ID

public static final String LOGIN_VIEW_TARGET_ID
predefined target ID for the login view

See Also:
Constant Field Values

TIME_ZONE_ID_PARAMETER_NAME

public static final String TIME_ZONE_ID_PARAMETER_NAME
See Also:
Constant Field Values

TIME_ZONE_TRANSITIONS_PARAMETER_NAME

public static final String TIME_ZONE_TRANSITIONS_PARAMETER_NAME
See Also:
Constant Field Values

TIME_ZONE_TIME_PARAMETER_NAME

public static final String TIME_ZONE_TIME_PARAMETER_NAME
See Also:
Constant Field Values

TIME_ZONE_OFFSET_PARAMETER_NAME

public static final String TIME_ZONE_OFFSET_PARAMETER_NAME
See Also:
Constant Field Values

TIME_ZONE_DAYLIGHTSAVINGS_PARAMETER_NAME

public static final String TIME_ZONE_DAYLIGHTSAVINGS_PARAMETER_NAME
See Also:
Constant Field Values

TIME_ZONE_NORTHERN_HEMISPHERE_PARAMETER_NAME

public static final String TIME_ZONE_NORTHERN_HEMISPHERE_PARAMETER_NAME
See Also:
Constant Field Values

PREPARED_REQUEST_URL

public static final String PREPARED_REQUEST_URL
See Also:
Constant Field Values

m_ServletContext

protected javax.servlet.ServletContext m_ServletContext
servlet context reference for this session


INTERNAL_REQUEST_TARGET_ID

public static final String INTERNAL_REQUEST_TARGET_ID
target ID query string key for internal requests

See Also:
Constant Field Values

EXTERNAL_REQUEST_TARGET_ID

public static final String EXTERNAL_REQUEST_TARGET_ID
target ID query string key for external requests, used for remote control

See Also:
Constant Field Values

RESOURCE_CLASSPATH_PREFIX

public static final String RESOURCE_CLASSPATH_PREFIX
prefix to configure a subdir in the java class path (WEB-INF/classes or WEB-INF/lib)

See Also:
Constant Field Values

RESOURCE_DEPLOYMENT_PREFIX

public static final String RESOURCE_DEPLOYMENT_PREFIX
prefix to configure a subdir in the deployment structure

See Also:
Constant Field Values

RESOURCE_FILE_PATH_PARAM

public static final String RESOURCE_FILE_PATH_PARAM
parameter name of the resource file path in web.xml

See Also:
Constant Field Values

RESOURCE_FILE_PATH_ENVIRONMENT_VAR_NAME_PARAM

public static final String RESOURCE_FILE_PATH_ENVIRONMENT_VAR_NAME_PARAM
parameter name of the resource file path environment var name in web.xml

See Also:
Constant Field Values

CONFIG_STREAM_NAME_PREFIX

public static final String CONFIG_STREAM_NAME_PREFIX
prefix for config file / stream / JNDI names

See Also:
Constant Field Values

CONFIG_JNDI_SUFFIX

public static final String CONFIG_JNDI_SUFFIX
suffix for JNDI names

See Also:
Constant Field Values

m_DEBUG_ActivateViewID

public String m_DEBUG_ActivateViewID
debug variable contains the ID of the last activated view via a OwNavigationView event.


m_DEBUG_NavigationTargetID

public String m_DEBUG_NavigationTargetID
debug variable contains the ID of the view last called via a OwNavigationView event.


m_DEBUG_NavigationEvent

public String m_DEBUG_NavigationEvent
debug variable contains the event name last called via a OwNavigationView event.

Constructor Detail

OwAppContext

public OwAppContext()
Creates a new instance of OwAppContext

Method Detail

getKeyEvents

public Collection<OwKeyEvent> getKeyEvents()
get a Collection of Lists of registered OwKeyEvents. NOTE: List is completely created only after onRender

Returns:
Collection, or null if no events have been defined

registerKeyEvent

public void registerKeyEvent(int iKeyCode_p,
                             int iCtrlKey_p,
                             String strEventURL_p,
                             String description_p)
                      throws Exception
register a keyboard key to a event URL, the registered key is only valid for one page request, so it must be called in onRender

Parameters:
iKeyCode_p - int code of the keyboard key as returned by the JavaScript method event.keyCode
iCtrlKey_p - int any combination of the KEYBOARD_CTRLKEY_... definitions, can be 0
strEventURL_p - String URL to be requested upon key press
description_p - String description of the event
Throws:
Exception

registerKeyFormEvent

public void registerKeyFormEvent(int iKeyCode_p,
                                 int iCtrlKey_p,
                                 String strEventURL_p,
                                 String strFormName_p,
                                 String description_p)
register a keyboard key to a event URL, the registered key is only valid for one page request, so it must be called in onRender

Parameters:
iKeyCode_p - int code of the keyboard key as returned by the JavaScript method event.keyCode
iCtrlKey_p - int any combination of the KEYBOARD_CTRLKEY_... definitions, can be 0
strEventURL_p - String URL to be requested upon key press
strFormName_p - String form name
description_p - String description of the event

registerKeyEvent

public void registerKeyEvent(OwKeyEvent keyEvent)
Parameters:
keyEvent -
Since:
4.1.1.0

registerKeyAction

public void registerKeyAction(OwKeyAction action)
                       throws OwException
Parameters:
action -
Throws:
OwException
Since:
4.1.1.0

registerKeyAction

public void registerKeyAction(String actionId,
                              String strEventURL,
                              String description)
                       throws OwException
Parameters:
actionId -
strEventURL -
description -
Throws:
OwException
Since:
4.1.0.0

registerKeyAction

public void registerKeyAction(String actionId,
                              String strEventURL,
                              String strFormName,
                              String description)
                       throws OwException
Parameters:
actionId -
strEventURL -
strFormName -
description -
Throws:
OwException
Since:
4.1.1.0

activateView

public void activateView(String strTargetID_p)
                  throws Exception
activate view designated by the TargetID, i.e. make it visible by navigating to it and all its parents

Parameters:
strTargetID_p - Target ID of view to activate
Throws:
Exception

getDialogManager

public abstract OwDialogManager getDialogManager()
get a reference to the default dialog manager used to open dialogs from the context in openDialog(...) The dialog manager must be created somewhere in the layout and returned here. If no dialogs are required, you do not need to create it and this function returns null

Returns:
OwDialogManager or null if no dialogs are required

closeAllDialogs

public void closeAllDialogs()
                     throws Exception
closes all dialogs

Throws:
Exception

openDialog

public void openDialog(OwDialog dialogView_p,
                       OwDialog.OwDialogListener listener_p)
                throws Exception
display a new dialog using the dialog manager set in setDialogManager(...) After it is closed it gets removed from the DialogManager and the context to finalize the Dialog View

Parameters:
dialogView_p - Dialog-View of the new dialog
listener_p - Listener that wants to be notified upon dialog events.
Throws:
Exception

init

public void init(OwAppContext oldcontext_p)
          throws Exception
init the context BEFORE the user has logged on. Called once for a session.
NOTE: The user is not logged in, when this function is called.
Optionally set a prefix to distinguish several different applications.

Parameters:
oldcontext_p - OwAppContext old context from previous session, used to copy flags, locals. Optional, can be null
Throws:
Exception

getTargetCount

public int getTargetCount()
retrieves the target count in the context. mostly used for debug reasons.

Returns:
number of attached event targets

getHttpRequest

public javax.servlet.http.HttpServletRequest getHttpRequest()
get the current HTTP request

Returns:
HttpServletRequest

getHttpResponse

public javax.servlet.http.HttpServletResponse getHttpResponse()
get the current HTTP response

Returns:
HttpServletResponse

getHttpServletContext

public javax.servlet.ServletContext getHttpServletContext()
get the current HHTP servlet context

Returns:
ServletContext

getHttpSession

public javax.servlet.http.HttpSession getHttpSession()
get the current HTTP session

Returns:
HttpSession

endRequest

public void endRequest()
signal that request has ended and to prevent OwPendingSessionException in beginRequest, to prevent concurrent requests.


beginRequest

public void beginRequest()
                  throws OwPendingSessionException
signal that request has started to prevent concurrent requests.

Throws:
OwPendingSessionException - if already a request was set

createBaseInitializer

protected OwBaseInitializer createBaseInitializer(javax.servlet.ServletContext context_p)
Creates a base initializer for a given context. Used for base initializer customization.

Parameters:
context_p - ServletContext
Since:
4.0.0.0

setRequest

public void setRequest(javax.servlet.ServletContext context_p,
                       javax.servlet.http.HttpServletRequest request_p,
                       javax.servlet.http.HttpServletResponse response_p)
set the request parameters, called upon each request, MUST BE CALLED BEFORE INIT.

Parameters:
context_p - ServletContext
request_p - HttpServletRequest
response_p - HttpServletResponse

setLocalThreadRequest

public static void setLocalThreadRequest(javax.servlet.http.HttpServletRequest request_p)
Set the request associated with current thread.

Parameters:
request_p - - the HttpServletRequest object
Since:
3.1.0.0

setLocalThreadResponse

public static void setLocalThreadResponse(javax.servlet.http.HttpServletResponse response_p)
Set the response associated with current thread.

Parameters:
response_p - - the HttpServletResponse object
Since:
3.1.0.0

serverSideInclude

public void serverSideInclude(String path_p,
                              Writer w_p)
                       throws Exception
Include the specified URL writing its output to the current Writer object.

Parameters:
path_p - - The path to the URL to include.
w_p - - The Writer which will be flushed prior to the include.
Throws:
Exception

getInitParameter

public String getInitParameter(String strParamName_p)
get a parameter from the web.xml config file

Parameters:
strParamName_p - Name of the requested parameter
Returns:
parameter value, of null if not set.

getEventTarget

public OwEventTarget getEventTarget(String strName_p)
find the registered event target

Parameters:
strName_p - Name (ID) of the event target
Returns:
reference to the event target, or null if target could not be found.

removeTarget

public void removeTarget(OwEventTarget target_p)
remove the event target from the context

Parameters:
target_p - OwEventTarget to remove from the context

removeTarget

public void removeTarget(String strID_p)
remove the event target from the context

Parameters:
strID_p - String Target ID to remove

registerRequestTarget

public void registerRequestTarget(OwEventTarget target_p)
                           throws OwException
registers a target to receive onRequest(...) events for each request the target must already be registered with registerTarget or OwEventTarget.attach

Parameters:
target_p - OwEventTarget
Throws:
OwException

unregisterRequestTarget

public void unregisterRequestTarget(OwEventTarget target_p)
                             throws OwException
unregisters a target to receive onRequest(...) events for each request the target must already be registered with registerTarget or OwEventTarget.attach

Parameters:
target_p - OwEventTarget
Throws:
OwException

registerTarget

public String registerTarget(OwEventTarget target_p,
                             String strName_p)
                      throws Exception
register the event target in the context and assign a unique ID

Parameters:
target_p - EventTarget to register
strName_p - optional ID to identify the target. If null, the context create a ID.
Returns:
target ID key
Throws:
Exception

getJSPPageURL

public String getJSPPageURL()
get the name of the JSP Page

Returns:
String

getXMLConfigDoc

public InputStream getXMLConfigDoc(String strName_p)
                            throws Exception
loads a XML Document either from local file, external file or from a JNDI context

Parameters:
strName_p - Name of the resource to look for
Returns:
OwXMLUtil wrapped DOM Node, or null if not found
Throws:
Exception

getConfigURL

public URL getConfigURL(String strName_p)
                 throws Exception
loads a URL for a configuration either from local file, external file or from a JNDI context

Parameters:
strName_p - Name of the configuration to look for, e.g. owbootstrap.xml
Returns:
URL current config
Throws:
Exception

getAppContextResource

protected abstract URL getAppContextResource(String resourcePath_p)
(overridable) Retrieves a resource for this application context.

Parameters:
resourcePath_p - the class path subpath to retrieve
Returns:
the URL of the requested resource
Since:
2.5.2.0

getBaseURL

public String getBaseURL()
get the URL to the web application context root

Returns:
String

getServerURL

public String getServerURL()
get the URL to the web application server

Returns:
String

getBasePath

public String getBasePath()
get the base path to the application

Returns:
String

getFormEventURL

public String getFormEventURL(OwEventTarget target_p,
                              String strEventName_p,
                              String strAdditionalParameters_p,
                              String strFormName_p)
get a URL for the requested event sending the form data defined in the event target with getFormName()

Parameters:
target_p - OwEventTarget to request the event URL for. Event is directed to that event target
strEventName_p - Function name to be called upon event fired
strAdditionalParameters_p - additional query string with parameters.
strFormName_p - String form name to send data with
Returns:
String URL

getFormEventFunction

public String getFormEventFunction(OwEventTarget target_p,
                                   String strEventName_p,
                                   String strAdditionalParameters_p,
                                   String strFormName_p)
get a script function for the requested event sending the form data defined in the event target with getFormName()

Parameters:
target_p - Owevent target to request the event URL for. Event is directed to that event target
strEventName_p - Function name to be called upon event fired
strAdditionalParameters_p - additional query string with parameters.
strFormName_p - String form name to send data with
Returns:
String URL

getAjaxEventURL

public String getAjaxEventURL(OwEventTarget target_p,
                              String strEventName_p,
                              String strAdditionalParameters_p)
get a URL for the requested AJAX event and redirect to submitted view

Parameters:
target_p - OwEventTarget to request the event URL for. Event is directed to that event target
strEventName_p - Function name to be called upon event fired
strAdditionalParameters_p - additional query string with parameters.
Returns:
String URL

getEventURL

public String getEventURL(OwEventTarget target_p,
                          String strEventName_p,
                          String strAdditionalParameters_p)
get a URL for the requested event and redirect to submitted view

Parameters:
target_p - OwEventTarget to request the event URL for. Event is directed to that event target
strEventName_p - Function name to be called upon event fired
strAdditionalParameters_p - additional query string with parameters.
Returns:
String URL

getBaseEventURL

protected StringBuffer getBaseEventURL(OwEventTarget target_p,
                                       String strEventName_p)
get a base URL with no additional parameters for the requested event and redirect to submitted view

Parameters:
target_p - OwEventTarget to request the event URL for. Event is directed to that event target
strEventName_p - Function name to be called upon event fired
Returns:
StringBuffer URL

getInfiniteEventURL

public String getInfiniteEventURL(OwEventTarget target_p,
                                  String strEventName_p,
                                  String strAdditionalParameters_p)
get a URL for the requested event and redirect to submitted view The URL is infinite, meaning that it can be used in all following requests where a normal event URL is only valid for the very next request.

Parameters:
target_p - OwEventTarget to request the event URL for. Event is directed to that event target
strEventName_p - Function name to be called upon event fired
strAdditionalParameters_p - additional query string with parameters.
Returns:
String URL

handleAjaxRequest

public void handleAjaxRequest(javax.servlet.http.HttpServletRequest request_p,
                              javax.servlet.http.HttpServletResponse response_p)
                       throws Exception
handles the AJAX request and dispatches to the correct target

Parameters:
request_p - HttpServletRequest
response_p - HttpServletResponse
Throws:
Exception

handleRequest

public boolean handleRequest(javax.servlet.http.HttpServletRequest request_p,
                             javax.servlet.http.HttpServletResponse response_p)
                      throws Exception
handles the JSP request from the page and dispatches to the correct target

Parameters:
request_p - HttpServletRequest
response_p - HttpServletResponse
Returns:
boolean true = continue with request and render, false = request is already finished, return to client
Throws:
Exception

handleExternalTargetRequest

protected boolean handleExternalTargetRequest(javax.servlet.http.HttpServletRequest request_p,
                                              javax.servlet.http.HttpServletResponse response_p)
                                       throws Exception
Method which executes external target request, and return a result if the external target request was processed successful or not.

Note: This method does not check the security token of the request, and must be processed before calling this method.

Parameters:
request_p - HttpServletRequest which contains information for external target processing
response_p - HttpServletResponse to use if the external target request is processed
Returns:
boolean true only if the request was processed successfully
Throws:
Exception - if session is in unstable state, or the external target cannot process current request
OwInvalidOperationException - if the external target cannot be found
Since:
3.2.0.0

isFormRequest

protected boolean isFormRequest(javax.servlet.http.HttpServletRequest request_p)
Returns whether this request carries FORM data and thus the onFormEvent() of the target has to be invoked or not.

Parameters:
request_p - the HttpServletRequest object that might carry FORM data
Returns:
true if and only if this request carries FORM data, false otherwise

broadcast

public void broadcast(OwEventTarget caller_p,
                      int iCode_p)
               throws Exception
causes all attached documents to receive an update event

Parameters:
caller_p - OwEventTarget target that called update
iCode_p - int optional reason code
Throws:
Exception

setFocusControlID

public void setFocusControlID(String strElementID_p)
set the ID of a HTML element to receive focus upon page load

Parameters:
strElementID_p - String ID of HTML element

getFocusControlID

public String getFocusControlID()
get the ID of a control that should receive the input focus for this request

Returns:
String with HTML control ID

clearFocusControlID

public void clearFocusControlID()
clear the focus control ID for the request


renderKeyBoardScript

@Deprecated
public void renderKeyBoardScript(Writer w_p)
                          throws Exception
Deprecated. 

Throws:
Exception

localize

public String localize(String strKey_p,
                       String strText_p)
localizes a string

Parameters:
strKey_p - Key value used to retrieve localized string from resource
strText_p - current language Text
Returns:
String localized strText_p

localize1

public String localize1(String strKey_p,
                        String strText_p,
                        String strAttribute1_p)
localizes a string with additional parameter that is replaced with %1

Parameters:
strKey_p - Key value used to retrieve localized string from resource
strText_p - current language Text
strAttribute1_p - String that replaces %1 tokens
Returns:
String localized strText_p

localize2

public String localize2(String strKey_p,
                        String strText_p,
                        String strAttribute1_p,
                        String strAttribute2_p)
localizes a string with additional parameter that is replaced with %1

Parameters:
strKey_p - Key value used to retrieve localized string from resource
strText_p - current language Text
strAttribute1_p - String that replaces %1 tokens
strAttribute2_p - String that replaces %2 tokens
Returns:
String localized strText_p

localize3

public String localize3(String strKey_p,
                        String strText_p,
                        String strAttribute1_p,
                        String strAttribute2_p,
                        String strAttribute3_p)
localizes a string with additional parameter that is replaced with %1

Parameters:
strKey_p - Key value used to retrieve localized string from resource
strText_p - current language Text
strAttribute1_p - String that replaces %1 tokens
strAttribute2_p - String that replaces %2 tokens
strAttribute3_p - String that replaces %3 tokens
Returns:
String localized strText_p

encodeURL

public static String encodeURL(String strURL_p)
                        throws UnsupportedEncodingException
encodes a URL or part of an URL so it conforms to HTTP standard (application/x-www-form-URL-encoded MIME format)

Attention: This method was changed due to problems with links calling Active-X object using JavaScript. The method now returns a String where all <space>-chars are replaced with the UTF-8 encoding sequence %20!

As example the String "http://server:port/myfolder/this is my.txt" is converted into "http://server:port/myfolder/this%20is%20my.txt" and not "http://server:port/myfolder/this+is+my.txt"

Parameters:
strURL_p - String unencoded URL
Returns:
String encoded URL
Throws:
UnsupportedEncodingException

decodeURL

public static String decodeURL(String strURL_p)
                        throws UnsupportedEncodingException
decodes a URL or part of an URL, that was previously encoded using encodeURL.

This decode the strURL_p and is equal to the String which was used for encodeURL!

String aURL.equals(decodeURL(encodeURL(aURL)) == true

Parameters:
strURL_p - String encoded URL
Returns:
String decoded URL
Throws:
UnsupportedEncodingException

createSubmitLink

protected static String createSubmitLink(String formName_p,
                                         String eventUrl_p)
creates a href link to fire a form submit event URL is enclosed in single apostrophe

Parameters:
formName_p -
eventUrl_p -
Returns:
String form submit URL

createSubmitFunction

protected static String createSubmitFunction(String formName_p,
                                             String eventUrl_p)
creates JavaSript statements to fire a form submit event URL is enclosed in single apostrophe

Parameters:
formName_p -
eventUrl_p -
Returns:
form submit URL

getSessionDisplayName

public abstract String getSessionDisplayName()
get a name for the current session, used for warning and error logs to identify the session later. Do not mix up with session identifier from HTTP session.

Returns:
String name of Session, usually the name of the logged on user

getUserInfo

public OwBaseUserInfo getUserInfo()
get the logged in user

Returns:
OwBaseUserInfo or null if no user is logged in

getLocale

public abstract Locale getLocale()
get the current locale, which can be used as a prefix/postfix to distinguish localization resources

Returns:
Locale

setLocale

public abstract void setLocale(Locale locale_p)

getDesignDir

public abstract String getDesignDir()
                             throws Exception
get the directory of the used design. Specifies the subfolder /designs/ where to retrieve the design files. i.e. CSS, images, layouts... This function can be used to make the look & feel dependent on the logged in user.

Returns:
String dir of design directory
Throws:
Exception

getDesignURL

public abstract String getDesignURL()
                             throws Exception
get the URL of the used design. Specifies the URL /designs/ where to retrieve the design files. i.e. css, images, layouts... This function can be used to make the look & feel dependent on the logged in user.

Returns:
String URL to the design dir
Throws:
Exception

isLogin

public abstract boolean isLogin()
                         throws Exception
check the valid credentials of the logged in user

Returns:
true if user is logged in and has valid credentials
Throws:
Exception

isContainerBasedAuthenticated

public abstract boolean isContainerBasedAuthenticated()
                                               throws Exception
check the current user is authenticated container based

Returns:
true if user is logged in and the login is done with container based authentication
Throws:
Exception

logout

public void logout()
            throws Exception
clear the credentials, i.e. log the user off

Throws:
Exception

loginInit

public abstract void loginInit()
                        throws Exception
init the context AFTER the user has logged in. Called once for a session. NOTE: This function is called only once after login to do special initialization, which can only be performed with valid credentials.

Throws:
Exception

getDialogManagerViewReference

public OwBaseView getDialogManagerViewReference()
return a view reference for the dynamically changing dialog manager

Returns:
OwBaseView reference that can be attached to another view with addViewReference

dump

public void dump(Writer w_p)
          throws Exception
write debug dump to Writer. MUST BE DISABLED IN PRODUCTIVE ENVIRONMENT

Parameters:
w_p - HTML Writer
Throws:
Exception

renderJSInclude

public void renderJSInclude(String sJSPath_p,
                            Writer w_p)
                     throws IOException
render a JavaScript include link. Makes sure that links are not rendered twice in a page

Parameters:
sJSPath_p - String
w_p -
Throws:
IOException

renderJSInclude

public void renderJSInclude(String sJSPath_p,
                            boolean useDebug_p,
                            Writer w_p)
                     throws IOException
Used to include ExtJs scripts, in production or debug mode

Parameters:
sJSPath_p - - the JavaScript file path
useDebug_p - - if true try to include the "debug" version of given file. If such a file is not available, the given file is included.
w_p - - the writer
Throws:
IOException
Since:
3.0.0.0

getApplicationAttribute

public Object getApplicationAttribute(String key_p)
get a attribute from the application scope

Parameters:
key_p -
Returns:
an Object

setApplicationAttribute

public Object setApplicationAttribute(String key_p,
                                      Object object_p)
get a attribute from the application scope

Parameters:
key_p -
object_p - null removes the attribute
Returns:
the previous object

setAjaxRequest

public void setAjaxRequest(boolean isAjaxRequest_p)
Set a marking attribute on the current HttpServletRequest object.

Parameters:
isAjaxRequest_p - - flag indicating that current HttpServletRequest object is an AJAX request.
Since:
3.1.0.0

isAjaxRequest

public boolean isAjaxRequest()
Check if the current HttpServletRequest object is an AJAX request.

Returns:
- true if the current request is an AJAX request.
Since:
3.1.0.0

getInfoProviderRegistry

public abstract OwInfoProviderRegistry getInfoProviderRegistry()
Get a info provider registry which is used to request information provider for special context.

Returns:
OwInfoProviderRegistry
Since:
3.1.0.0

isExternalTargetRequest

public boolean isExternalTargetRequest(javax.servlet.http.HttpServletRequest request_p)
Check if the request contains an external target id. This method is used to analyze if remote control links are used and need to be processed.

Parameters:
request_p - HttpServletRequest
Returns:
boolean true if request contains an external target parameter
Since:
3.2.0.0

setClientTimeZoneInfo

public void setClientTimeZoneInfo(OwTimeZoneInfo timeZoneInfo_p)
Set client's time zone information. The time zone information can be used to set or guess the client's actual time zone or a client-compatible time zone.

Parameters:
timeZoneInfo_p -
Since:
3.1.0.3

getClientTimeZoneInfo

public OwTimeZoneInfo getClientTimeZoneInfo()
Get client's time zone offset information. The time zone information can be used to set or guess the client's actual time zone or a client-compatible time zone.

Returns:
the current timezone information or null if no client time zone information is set
Since:
3.1.0.3

getClientTimeZone

public TimeZone getClientTimeZone()
Returns:
the current time zone as indicated by the current client time zone information. If the current client time zone information does not indicate a time zone the default time zone is returned using TimeZone.getDefault().
Since:
3.1.0.3

prepareRequest

public boolean prepareRequest(javax.servlet.http.HttpServletRequest request_p,
                              javax.servlet.http.HttpServletResponse response_p)
                       throws Exception
Request precondition handler for all JSP based requests.

Parameters:
request_p -
response_p -
Returns:
true if the request processing can resume , false otherwise
Throws:
Exception
Since:
3.1.0.3

registerInterface

public void registerInterface(Class<?> typeClass,
                              Object object)
Register some specific object for a defined class/interface.

Will not check if the provided object is from that type.

Parameters:
typeClass - Class
object - Object specific to that provided class
Since:
3.2.0.0
See Also:
getRegisteredInterface(Class)

getRegisteredInterface

public <T> T getRegisteredInterface(Class<T> typeClass)
Return the cached object, if any is contained.

Can throw a ClassCastException if the registered object is not an instance of the requested class.

Parameters:
typeClass - Class of the object to return
Returns:
the requested object or null if none is cached
Since:
3.2.0.0

unregisterInterface

public <T> T unregisterInterface(Class<T> typeClass)
Unregister the object for given class/interface.

Attention: If any clean or release must be executed first, it must be done before calling the unregister method.

Parameters:
typeClass -
Returns:
Type or null if nothing was register for the given class type
Since:
3.2.0.0

createServerUrl

protected String createServerUrl(javax.servlet.http.HttpServletRequest req_p)
(overridable) Called to create the server URL for current request.

Parameters:
req_p - HttpRequest
Returns:
String representing server URL
Since:
4.0.0.0

createJspPageUrl

protected String createJspPageUrl(javax.servlet.http.HttpServletRequest req_p)
(overridable) URL with jsp page, like server URL + context path.

Parameters:
req_p - HttpServletRequest
Returns:
String representing
Since:
4.0.0.0

createBaseUrl

protected String createBaseUrl(javax.servlet.http.HttpServletRequest req_p)
(overridable) Create base URL which will be used to process the request.

Parameters:
req_p - HttpServletRequest
Returns:
String
Since:
4.0.0.0


Copyright © 2013 Alfresco Business Solutions. All Rights Reserved.