Package org.eclnt.jsfserver.util
Class HttpSessionAccess
java.lang.Object
org.eclnt.jsfserver.util.HttpSessionAccess
- All Implemented Interfaces:
ICCServerConstants
Access to http request and context environment.
-
Field Summary
Fields inherited from interface org.eclnt.jsfserver.util.ICCServerConstants
CLIENTJAVATYPE_FX, CLIENTJAVATYPE_SWING, CLIENTTYPE_APPLET, CLIENTTYPE_APPLICATION, CLIENTTYPE_BROWSER, CLIENTTYPE_RISC, CLIENTTYPE_UI5, CLIENTTYPE_WEBSTART, EXPLICIT_NULL, FOCUSSEQUENCE_FIX_PREFIX, HEADER_ATTRIBUTE_CLIENT, HEADER_ATTRIBUTE_CLIENTJAVATYPE, HEADER_ATTRIBUTE_COOKIESENABLED, HEADER_ATTRIBUTE_COUNTRY, HEADER_ATTRIBUTE_DEVICESCREENHEIGHT, HEADER_ATTRIBUTE_DEVICESCREENWIDTH, HEADER_ATTRIBUTE_DEVICETYPE, HEADER_ATTRIBUTE_LANGUAGE, HEADER_ATTRIBUTE_MEDIADEVICES, HEADER_ATTRIBUTE_ORIGINALURL, HEADER_ATTRIBUTE_PERFORMANCEDATA, HEADER_ATTRIBUTE_REQUESTID, HEADER_ATTRIBUTE_TIMEZONEOFFSET, HEADER_ATTRIBUTE_USERAGENT, HEADER_ATTRIBUTE_XFRAMEOPTIONS, HEADER_RESPONSE_ATTRIBUTE_HTTPSESSIONID, HEADER_RESPONSE_ATTRIBUTE_HTTPSESSIONREFERENCEURL, HEADER_RESPONSE_ATTRIBUTE_HTTPSESSIONTRACKINGMODE, HEADER_RESPONSE_ATTRIBUTE_OVERRIDE, HEADER_RESPONSE_ATTRIBUTE_RELOAD, HEADER_RESPONSE_ATTRIBUTE_STYLE, INPUTMASK_VALUEMODE_WITHMASK, INPUTMASK_VALUEMODE_WITHOUTMASK, LAYOUTEXTENSION_JSP, LAYOUTEXTENSION_XML, QP_CCSTYLE, QP_KEEPDIALOGSESSION, QP_SUBPAGEID, SECURITY_ROLE_CCADMIN, SESSION_TRACKING_COOKIE, SESSION_TRACKING_URL, TEXTPANE_CONTENTTYPE_HTML, TEXTPANE_CONTENTTYPE_PLAIN
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
Adds a reactor interface into the current dialog session which notifies about closing the dialog session.static void
static void
Adds a listener for creation/closing of http session.static void
Adds a reactor interface into the current http session which notifies about closing the session.static boolean
Check if current client is an FX client.static boolean
Deprecated.static boolean
Check if current client is a Swing client.static boolean
static boolean
checkIfCurrentClientTypeIsRisc
(javax.servlet.http.HttpServletRequest request) static boolean
checkIfCurrentClientTypeIsRisc
(javax.servlet.http.HttpSession session) static boolean
checkIfCurrentClientTypeIsUI5
(javax.servlet.http.HttpServletRequest request) static boolean
During the invoke phase the application may destroy the current http session (by calling the http-session's invalidate() method.static boolean
checkIfCurrentHttpSessionWasDestroyedDuringInvokePhase
(javax.servlet.http.HttpSession session) static boolean
static boolean
Returns true if the client's original .risc-URL was started via https.static boolean
Passes back information if the current dialog session is opened in the preview mode of the editor.static boolean
Passes back information if the current dialog is opened in the preview mode of the editor.static boolean
static boolean
Checks if the current request processing is executed in an embedded usage (stand alone) environment.static boolean
static List<ClientDeviceInfo>
getClientDeviceInfos
(javax.servlet.http.HttpServletRequest postRequest) static String
Returns null if not transferred from client side.static String
Passes back an id that is associated with the client.static String
getCurrentClientId
(boolean createClientIdIfNotExists) static String
Information about the client's Java technology.static String
getCurrentClientJavaType
(javax.servlet.http.HttpServletRequest request) Returns back client java type that is transferred via the http header.static Locale
This is the localization of the client!static int
Returns -1 if the screen width is not transferred from client side.static int
Returns -1 if the screen width is not transferred from client side.static int
The browser client sends its time zone offset as part of the http communication.static String
Passes back the client type that is used by the current user.static String
getCurrentClientType
(javax.servlet.http.HttpServletRequest request) Passes back the client type that is used by the current user.static ComponentDump
getCurrentComponentDump
(javax.faces.context.FacesContext context) Internal use only.static ComponentDump
getCurrentComponentDump
(ISessionAbstraction httpSession, String subpageId) Internal use only.static ComponentDump
static ISessionAbstraction
The dialog session is the session that is associated with a dialog ("browser tab instance") on client side.static ISessionAbstraction
getCurrentDialogSession
(javax.servlet.http.HttpSession session) The dialog session is the session that is associated with a dialog ("browser tab instance") on client side.static ISessionAbstraction
getCurrentDialogSession
(javax.servlet.http.HttpSession session, String subpageId) static javax.el.ELContext
getCurrentELContext
(javax.faces.context.FacesContext context) Accessing the EL context which is for accessing expressions.static javax.faces.application.Application
getCurrentFacesApplication
(javax.faces.context.FacesContext context) Accessing the Application.static javax.faces.context.FacesContext
Accessing the FacesContext.static javax.servlet.http.HttpSession
This session must only be called within the context of a request processing!static javax.servlet.http.HttpSession
getCurrentHttpSession
(javax.faces.context.FacesContext context) Same asgetCurrentHttpSession()
- now with passing the FacesContext instance, which guides to the http session.static javax.servlet.http.HttpSession
static javax.servlet.http.HttpSession
getCurrentHttpSessionIfAvailable
(javax.faces.context.FacesContext context) Same asgetCurrentHttpSession()
- now with passing the FacesContext instance, which guides to the http session and now without creating the http session if it does not exist.static javax.servlet.http.HttpSession
static HttpSessionListenerDelegator
Internal use.static HttpSessionListenerDelegator
getCurrentHttpSessionListenerDelegator
(javax.servlet.http.HttpSession session) Internal use.static Locale
Retrieve the Locale that is used on server side within the current session.static String
Returns the original URL that started the CaptainCasa page.static javax.servlet.http.HttpServletRequest
Returns the servlet request that triggered the current request processing.static String
Each request is associated with a unique id when entering the server side processing.static javax.servlet.http.HttpServletResponse
Returns the servlet response of the current request processing.static String
Returns the current style for the session.static SubpageContext
Access to the subpage context, which is available if one Http-session is shared across multiple browser instances - due to using cookies for session tracking.static SubpageContext
getCurrentSubpageContext
(javax.servlet.http.HttpSession session) Access to the subpage context, which is available if one Http-session is shared across multiple browser instances - due to using cookies for session tracking.Request parameters that were passed with the initial request.static IMethodBindingListener
Internal use only.static javax.servlet.ServletContext
Return the servlet context that was passed by the Servlet-container.static String
A servlet context provides access to a temporary directory in which you can write or read data.static String
getServletTempDirectory
(javax.servlet.ServletContext servletContext) static IValueBindingListener
Internal use only.static String
Returns name of the deployed web application using its context path as base.static void
initialize
(javax.servlet.ServletContext servletContext) static void
Sends a signal to the client side that triggers a reload of the complete page - within the current session (i.e. no new session is created).static void
reloadClient
(javax.servlet.http.HttpServletResponse response) static void
static void
static void
Counter part ofaddGlobalHttpSessionListener(IHttpSessionListener)
.static void
static void
setCurrentClientId
(String clientId) Explicitly set the client id to some defined value.static void
Sets the locale that is passed as locale for the current session.static void
setCurrentStyle
(String style) Sets the current style for the session.static void
Internal use only.static void
Internal use only.static void
Switch profile mode off.static void
Switch profile mode on.
-
Constructor Details
-
HttpSessionAccess
public HttpSessionAccess()
-
-
Method Details
-
initialize
public static void initialize(javax.servlet.ServletContext servletContext) -
getCurrentFacesContext
public static javax.faces.context.FacesContext getCurrentFacesContext()Accessing the FacesContext. You should use this method instead of directly accessing FacesContext.getCurrentInstance() in case you pass the FacesContext into non-UI threads. -
getCurrentFacesApplication
public static javax.faces.application.Application getCurrentFacesApplication(javax.faces.context.FacesContext context) Accessing the Application. This method is already considering cases in which the application is accessed from a non-UI thread. -
getCurrentELContext
public static javax.el.ELContext getCurrentELContext(javax.faces.context.FacesContext context) Accessing the EL context which is for accessing expressions. This method is already considering cases in which the application is accessed from a non-UI thread. -
getCurrentHttpSession
public static javax.servlet.http.HttpSession getCurrentHttpSession()This session must only be called within the context of a request processing!
Please pay attention: call functiongetCurrentDialogSession()
if you want to access the session that is managed per browser tab instance! The http session may sapn several browser tabs - if using COOKIEs for session management! -
getCurrentHttpSessionIfAvailable
public static javax.servlet.http.HttpSession getCurrentHttpSessionIfAvailable(javax.faces.context.FacesContext context) Same asgetCurrentHttpSession()
- now with passing the FacesContext instance, which guides to the http session and now without creating the http session if it does not exist.
Please pay attention: call functiongetCurrentDialogSession()
if you want to access the session that is managed per browser tab instance! The http session may sapn several browser tabs - if using COOKIEs for session management! -
getCurrentHttpSessionIfAvailable
public static javax.servlet.http.HttpSession getCurrentHttpSessionIfAvailable(ISessionContextProvider context) -
getCurrentHttpSession
public static javax.servlet.http.HttpSession getCurrentHttpSession(javax.faces.context.FacesContext context) Same asgetCurrentHttpSession()
- now with passing the FacesContext instance, which guides to the http session.
Please pay attention: call functiongetCurrentDialogSession()
if you want to access the session that is managed per browser tab instance! The http session may sapn several browser tabs - if using COOKIEs for session management! -
getCurrentHttpSession
-
getCurrentComponentDump
Internal use only. -
getCurrentComponentDump
-
getCurrentComponentDump
public static ComponentDump getCurrentComponentDump(ISessionAbstraction httpSession, String subpageId) Internal use only. -
addGlobalHttpSessionListener
Adds a listener for creation/closing of http session. THis listener is globally registered (i.e. "one time" per servlet context) and NOT registered per session. -
removeGlobalHttpSessionListener
Counter part ofaddGlobalHttpSessionListener(IHttpSessionListener)
. -
addHttpSessionCloseReactorForCurrentSession
public static void addHttpSessionCloseReactorForCurrentSession(String id, IHttpSessionClosedReactor reactor) Adds a reactor interface into the current http session which notifies about closing the session. Pleas pay attention to the difference between http-session and dialog-session (URL- or COOKIE-based session management). If you want to get notified about the "per-browser-session" then useaddDialogSessionClosedReactorForCurrentSession(ISessionAbstractionListener)
. -
removeHttpSessionCloseReactorForCurrentSession
-
addGlobalDialogSessionListener
-
removeGlobalDialogSessionListener
-
addDialogSessionClosedReactorForCurrentSession
public static void addDialogSessionClosedReactorForCurrentSession(ISessionAbstractionListener listener) Adds a reactor interface into the current dialog session which notifies about closing the dialog session. -
removeDialogSessionClosedReactorForCurrentSession
public static void removeDialogSessionClosedReactorForCurrentSession(ISessionAbstractionListener listener) -
getCurrentHttpSessionListenerDelegator
Internal use. -
getCurrentHttpSessionListenerDelegator
public static HttpSessionListenerDelegator getCurrentHttpSessionListenerDelegator(javax.servlet.http.HttpSession session) Internal use. -
getServletContext
public static javax.servlet.ServletContext getServletContext()Return the servlet context that was passed by the Servlet-container. -
getWebApplicationName
Returns name of the deployed web application using its context path as base.
The context path is a string like "/demos" - and is the URL prefix that is uniquely used for the web application within the servlet container. The name of the application is taken from the context path - without leading slash. In case the context path is the root context path ("/") then "root" is returned.
During (JUnit) testing, the servlet context might not be available. UseUsageWithoutSessionContext
to indicate that you are running in test mode - in this case "undefined" is returned. -
getServletTempDirectory
A servlet context provides access to a temporary directory in which you can write or read data. Pay attention: in a clustered scenario the temp directory might be different from request to request - because the session might be migrated from one server to the next. -
getServletTempDirectory
-
getCurrentClientTimeZoneOffset
public static int getCurrentClientTimeZoneOffset()The browser client sends its time zone offset as part of the http communication. This method is the number of minutes that the browser's time zone is different to the GMT time. -
getCurrentClientLocale
This is the localization of the client! The client localization may be different to the server localization!
The localization of the server can be accessed by methodgetCurrentLocale()
. -
getCurrentRequest
public static javax.servlet.http.HttpServletRequest getCurrentRequest()Returns the servlet request that triggered the current request processing. This functions is expected to be called as part of the default request/response processing.
If called outside this processing, then null will be returned. -
getCurrentLocationHref
Returns the original URL that started the CaptainCasa page. This is the ".risc" page (or other extension if you customized accordingly).- Returns:
- URL as String, null in case the URL cannot be found (e.g. if method is not called within the context of a request processing)
-
getCurrentResponse
public static javax.servlet.http.HttpServletResponse getCurrentResponse()Returns the servlet response of the current request processing. This functions is expected to be called as part of the default request/response processing.
If called outside this processing, then null will be returned. -
setValueBindingListener
Internal use only. -
getValueBindingListener
Internal use only. -
setMethodBindingListener
Internal use only. -
getMethodBindingListener
Internal use only. -
checkIfInLayoutEditorPreview
public static boolean checkIfInLayoutEditorPreview()Passes back information if the current dialog is opened in the preview mode of the editor. This method returns true only for the first request that is sent from the preview to the server side processing. Subsequent requests are always treated as "normal" requests. Please check the methodcheckIfDialogSessionInLayoutEditorPreview()
.- Returns:
- "true" if opened in layout editor preview - for the first request
"false" otherwise
-
checkIfDialogSessionInLayoutEditorPreview
public static boolean checkIfDialogSessionInLayoutEditorPreview()Passes back information if the current dialog session is opened in the preview mode of the editor. Compared to methodcheckIfInLayoutEditorPreview()
this method not only returns "true" for the first request of the dialog, but returns back "true" for all subsequent requests as well.- Returns:
- "true" if opened in layout editor preview
"false" otherwise
-
getCurrentRequestId
Each request is associated with a unique id when entering the server side processing. -
checkIfCurrentHttpSessionWasDestroyedDuringInvokePhase
public static boolean checkIfCurrentHttpSessionWasDestroyedDuringInvokePhase()During the invoke phase the application may destroy the current http session (by calling the http-session's invalidate() method. In this case follow on processing may react correspondingly. -
checkIfCurrentHttpSessionWasDestroyedDuringInvokePhase
public static boolean checkIfCurrentHttpSessionWasDestroyedDuringInvokePhase(javax.servlet.http.HttpSession session) -
checkIfCurrentHttpSessionWasDestroyedDuringInvokePhase
public static boolean checkIfCurrentHttpSessionWasDestroyedDuringInvokePhase(ISessionAbstraction session) -
checkIfRunningInEmbeddedMode
public static boolean checkIfRunningInEmbeddedMode()Checks if the current request processing is executed in an embedded usage (stand alone) environment. -
checkIfRunningInMiniServerMode
public static boolean checkIfRunningInMiniServerMode() -
checkIfJustProcessingRequest
public static boolean checkIfJustProcessingRequest() -
checkIfCurrentSessionWasStartedByHttps
public static boolean checkIfCurrentSessionWasStartedByHttps()Returns true if the client's original .risc-URL was started via https. -
getCurrentClientType
Passes back the client type that is used by the current user. Values that are returned are "applet", "webstart", "application", "browser" -
getCurrentClientType
Passes back the client type that is used by the current user. Values that are returned are "applet", "webstart", "application", "browser". Use constans defined inICCServerConstants
for comparing the result values. -
checkIfCurrentClientTypeIsUI5
public static boolean checkIfCurrentClientTypeIsUI5(javax.servlet.http.HttpServletRequest request) -
checkIfCurrentClientTypeIsRisc
public static boolean checkIfCurrentClientTypeIsRisc() -
checkIfCurrentClientTypeIsRisc
public static boolean checkIfCurrentClientTypeIsRisc(javax.servlet.http.HttpServletRequest request) -
checkIfCurrentClientTypeIsRisc
public static boolean checkIfCurrentClientTypeIsRisc(javax.servlet.http.HttpSession session) -
getCurrentClientJavaType
Information about the client's Java technology.- Returns:
- either "swing" or "fx" or "risc"
-
getCurrentClientJavaType
Returns back client java type that is transferred via the http header. Only passes back a value if the client is a Java client. -
checkIfCurrentClientJavaTypeIsFX
public static boolean checkIfCurrentClientJavaTypeIsFX()Check if current client is an FX client. -
checkIfCurrentClientJavaTypeIsRisc
Deprecated.Check if current client is a RISC client. (This method is deprecated because of its name. A client that is of type Java cannot be a RISC client... - please usecheckIfCurrentClientTypeIsRisc()
instead.) -
checkIfCurrentClientJavaTypeIsSwing
public static boolean checkIfCurrentClientJavaTypeIsSwing()Check if current client is a Swing client. -
getCurrentClientScreenPixelWidth
public static int getCurrentClientScreenPixelWidth()Returns -1 if the screen width is not transferred from client side. -
getCurrentClientScreenPixelHeight
public static int getCurrentClientScreenPixelHeight()Returns -1 if the screen width is not transferred from client side. -
getCurrentClientDeviceType
Returns null if not transferred from client side.
Current values: "desktop" and "mobile" (mobile being a synonym for non-desktop, i.e. phone/tablet) -
getCurrentClientId
Passes back an id that is associated with the client. The client id is some explicit id that identifies the client on a long term (or at least: longer than the life cycle of a session).
In the RISC client the client id is stored as cookie. The client id is automaitcally generated if it does not exist yet. - You can epplicitly set the client id by usingServletUtil.writeEclntIdCookie(HttpServletResponse, String)
. Or you may set by using the html page: eclntjsfserver/utilpages/setclientid.html within your web application. -
getCurrentClientId
-
setCurrentClientId
Explicitly set the client id to some defined value. -
getCurrentLocale
Retrieve the Locale that is used on server side within the current session. In normal situations this is taken from the viewRoot of the FacesContext - but sometimes this function is also used outside a valid FacesContext (e.g. when downloading information). In this case the Locale is taken from the session context.
In case there is no session available then the Locale of the server environment is returned.
Pay attention: the localization of the client may be different! You get this localization by callinggetCurrentClientLocale()
. -
setCurrentLocale
Sets the locale that is passed as locale for the current session. -
setCurrentStyle
Sets the current style for the session. -
getCurrentStyle
Returns the current style for the session. -
reloadClient
public static void reloadClient()Sends a signal to the client side that triggers a reload of the complete page - within the current session (i.e. no new session is created). This method is e.g. used when updating the style of the client - in this case all the server side components need to be re-created, which is exactly done through the reload. -
reloadClient
public static void reloadClient(javax.servlet.http.HttpServletResponse response) -
getCurrentSubpageContext
Access to the subpage context, which is available if one Http-session is shared across multiple browser instances - due to using cookies for session tracking. -
getCurrentSubpageContext
Access to the subpage context, which is available if one Http-session is shared across multiple browser instances - due to using cookies for session tracking. -
getCurrentDialogSession
The dialog session is the session that is associated with a dialog ("browser tab instance") on client side. In case of using URL-encoding for session management this is a wrapper around the http-session. In Cas of using COOKIEs for session management this is a wrapper around the subpage context. -
getCurrentDialogSession
The dialog session is the session that is associated with a dialog ("browser tab instance") on client side. In case of using URL-encoding for session management this is a wrapper around the http-session. In Cas of using COOKIEs for session management this is a wrapper around the subpage context. -
getCurrentDialogSession
public static ISessionAbstraction getCurrentDialogSession(javax.servlet.http.HttpSession session, String subpageId) -
switchProfileModeOnForCurrentSession
public static void switchProfileModeOnForCurrentSession()Switch profile mode on. In the profile mode performance data is written to the file system. -
switchProfileModeOffForCurrentSession
public static void switchProfileModeOffForCurrentSession()Switch profile mode off. In the profile mode performance data is written to the file system. -
getInitialRequestParameters
Request parameters that were passed with the initial request. -
getClientDeviceInfos
public static List<ClientDeviceInfo> getClientDeviceInfos(javax.servlet.http.HttpServletRequest postRequest)
-