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
CLIENTDEVICETYPE_DESKTOP, CLIENTDEVICETYPE_MOBILE, CLIENTJAVATYPE_FX, CLIENTJAVATYPE_SWING, CLIENTTYPE_APPLET, CLIENTTYPE_APPLICATION, CLIENTTYPE_BROWSER, CLIENTTYPE_RISC, CLIENTTYPE_UI5, CLIENTTYPE_WEBSTART, EXPLICIT_EMPTY, 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, LITERAL_LINK_PREFIX, LITERAL_TEMP_PREFIX, QP_CCSTYLE, QP_KEEPDIALOGSESSION, QP_SUBPAGEID, SECURITY_ROLE_CCADMIN, SESSION_TRACKING_COOKIE, SESSION_TRACKING_URL, SIZE_UNDEFINED, TEXTPANE_CONTENTTYPE_HTML, TEXTPANE_CONTENTTYPE_PLAIN -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic voidAdds a reactor interface into the current dialog session which notifies about closing the dialog session.static voidstatic voidAdds a listener for creation/closing of http session.static voidAdds a reactor interface into the current http session which notifies about closing the session.static booleanCheck if current client is an FX client.static booleanDeprecated.static booleanCheck if current client is a Swing client.static booleanstatic booleancheckIfCurrentClientTypeIsRisc(jakarta.servlet.http.HttpServletRequest request) static booleancheckIfCurrentClientTypeIsRisc(jakarta.servlet.http.HttpSession session) static booleancheckIfCurrentClientTypeIsUI5(jakarta.servlet.http.HttpServletRequest request) static booleanDuring the invoke phase the application may destroy the current http session (by calling the http-session's invalidate() method.static booleancheckIfCurrentHttpSessionWasDestroyedDuringInvokePhase(jakarta.servlet.http.HttpSession session) static booleanstatic booleanReturns true if the client's original .risc-URL was started via https.static booleanPasses back information if the current dialog session is opened in the preview mode of the editor.static booleanPasses back information if the current dialog is opened in the preview mode of the editor.static booleanstatic booleanChecks if the current request processing is executed in an embedded usage (stand alone) environment.static booleanstatic booleanCheck if the current thread is one which processes a request from the browser user interface.static voidstatic List<ClientDeviceInfo>getClientDeviceInfos(jakarta.servlet.http.HttpServletRequest postRequest) static StringReturns null if not transferred from client side.static StringPasses back an id that is associated with the client.static StringgetCurrentClientId(boolean createClientIdIfNotExists) static StringInformation about the client's Java technology.static StringgetCurrentClientJavaType(jakarta.servlet.http.HttpServletRequest request) Returns back client java type that is transferred via the http header.static LocaleThis is the localization of the client!static intReturns -1 if the screen width is not transferred from client side.static intReturns -1 if the screen width is not transferred from client side.static intThe browser client sends its time zone offset as part of the http communication.static StringPasses back the client type that is used by the current user.static StringgetCurrentClientType(jakarta.servlet.http.HttpServletRequest request) Passes back the client type that is used by the current user.static ComponentDumpgetCurrentComponentDump(FacesContext context) Internal use only.static ComponentDumpgetCurrentComponentDump(ISessionAbstraction httpSession, String subpageId) Internal use only.static ComponentDumpstatic ISessionAbstractionThe dialog session is the session that is associated with a dialog ("browser tab instance") on client side.static ISessionAbstractiongetCurrentDialogSession(jakarta.servlet.http.HttpSession session) The dialog session is the session that is associated with a dialog ("browser tab instance") on client side.static ISessionAbstractiongetCurrentDialogSession(jakarta.servlet.http.HttpSession session, String subpageId) static jakarta.el.ELContextgetCurrentELContext(FacesContext context) Accessing the EL context which is for accessing expressions.static ApplicationgetCurrentFacesApplication(FacesContext context) Accessing the Application.static FacesContextAccessing the FacesContext.static jakarta.servlet.http.HttpSessionThis session must only be called within the context of a request processing!static jakarta.servlet.http.HttpSessiongetCurrentHttpSession(FacesContext context) Same asgetCurrentHttpSession()- now with passing the FacesContext instance, which guides to the http session.static jakarta.servlet.http.HttpSessionstatic jakarta.servlet.http.HttpSessionSame 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 jakarta.servlet.http.HttpSessionstatic HttpSessionListenerDelegatorInternal use.static HttpSessionListenerDelegatorgetCurrentHttpSessionListenerDelegator(jakarta.servlet.http.HttpSession session) Internal use.static LocaleRetrieve the Locale that is used on server side within the current session.static StringReturns the original URL that started the CaptainCasa page.static jakarta.servlet.http.HttpServletRequestReturns the servlet request that triggered the current request processing.static StringEach request is associated with a unique id when entering the server side processing.static jakarta.servlet.http.HttpServletResponseReturns the servlet response of the current request processing.static StringReturns the current style for the session.static SubpageContextAccess 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 SubpageContextgetCurrentSubpageContext(jakarta.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 IMethodBindingListenerInternal use only.static jakarta.servlet.ServletContextReturn the servlet context that was passed by the Servlet-container.static StringA servlet context provides access to a temporary directory in which you can write or read data.static StringgetServletTempDirectory(jakarta.servlet.ServletContext servletContext) static IValueBindingListenerInternal use only.static StringReturns name of the deployed web application using its context path as base.static voidinitialize(jakarta.servlet.ServletContext servletContext) static voidSends 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 voidreloadClient(jakarta.servlet.http.HttpServletResponse response) static voidstatic voidstatic voidCounter part ofaddGlobalHttpSessionListener(IHttpSessionListener).static voidstatic voidsetCurrentClientId(String clientId) Explicitly set the client id to some defined value.static voidSets the locale that is passed as locale for the current session.static voidsetCurrentStyle(String style) Sets the current style for the session.static voidInternal use only.static voidInternal use only.static voidSwitch profile mode off.static voidSwitch profile mode on.
-
Constructor Details
-
HttpSessionAccess
public HttpSessionAccess()
-
-
Method Details
-
initialize
public static void initialize(jakarta.servlet.ServletContext servletContext) -
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
Accessing the Application. This method is already considering cases in which the application is accessed from a non-UI thread. -
getCurrentELContext
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 jakarta.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 jakarta.servlet.http.HttpSession getCurrentHttpSessionIfAvailable(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 jakarta.servlet.http.HttpSession getCurrentHttpSessionIfAvailable(ISessionContextProvider context) -
getCurrentHttpSession
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
public static jakarta.servlet.http.HttpSession getCurrentHttpSession(ISessionContextProvider context) -
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(jakarta.servlet.http.HttpSession session) Internal use. -
getServletContext
public static jakarta.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. UseUsageWithoutSessionContextto 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 jakarta.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 jakarta.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(jakarta.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 inICCServerConstantsfor comparing the result values. -
checkIfCurrentClientTypeIsUI5
public static boolean checkIfCurrentClientTypeIsUI5(jakarta.servlet.http.HttpServletRequest request) -
checkIfCurrentClientTypeIsRisc
public static boolean checkIfCurrentClientTypeIsRisc() -
checkIfCurrentClientTypeIsRisc
public static boolean checkIfCurrentClientTypeIsRisc(jakarta.servlet.http.HttpServletRequest request) -
checkIfCurrentClientTypeIsRisc
public static boolean checkIfCurrentClientTypeIsRisc(jakarta.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). You may use valuesICCServerConstants.CLIENTDEVICETYPE_DESKTOPandICCServerConstants.CLIENTDEVICETYPE_MOBILEfor comparing. The device type is passed by the client as header parameter with every data round trip. -
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(jakarta.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(jakarta.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(jakarta.servlet.http.HttpServletRequest postRequest) -
checkIfRunningInUIThread
public static boolean checkIfRunningInUIThread()Check if the current thread is one which processes a request from the browser user interface. -
ensureToRunInUIThread
public static void ensureToRunInUIThread()
-