org.eclnt.jsfserver.util

## Class HttpSessionAccess

- java.lang.Object
- - org.eclnt.jsfserver.util.HttpSessionAccess

- All Implemented Interfaces:
    ICCServerConstants

      public class HttpSessionAccess
      extends java.lang.Object
      implements 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, FOCUSSEQUENCE_FIX_PREFIX, QP_SUBPAGEID`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpSessionAccess()`

  - ### Method Summary

    All Methods Static Methods Concrete Methods Deprecated Methods
    Modifier and Type | Method and Description
    --- | ---
    `static boolean` | `checkIfCurrentClientJavaTypeIsFX()` Check if current client is an FX client.
    `static boolean` | `checkIfCurrentClientJavaTypeIsRisc()` Deprecated.
    `static boolean` | `checkIfCurrentClientJavaTypeIsSwing()` Check if current client is a Swing client.
    `static boolean` | `checkIfCurrentClientTypeIsRisc()`
    `static boolean` | `checkIfCurrentClientTypeIsRisc(HttpServletRequest request)`
    `static boolean` | `checkIfCurrentClientTypeIsUI5(HttpServletRequest request)`
    `static boolean` | `checkIfCurrentHttpSessionWasDestroyedDuringInvokePhase()` During the invoke phase the application may destroy the current http session (by calling the http-session's invalidate() method.
    `static boolean` | `checkIfCurrentHttpSessionWasDestroyedDuringInvokePhase(HttpSession session)`
    `static boolean` | `checkIfDialogSessionInLayoutEditorPreview()` Passes back information if the current dialog session is opened in the preview mode of the editor.
    `static boolean` | `checkIfInLayoutEditorPreview()` Passes back information if the current dialog is opened in the preview mode of the editor.
    `static boolean` | `checkIfJustProcessingRequest()`
    `static boolean` | `checkIfRunningInEmbeddedMode()` Checks if the current request processing is executed in an embedded usage (stand alone) environment.
    `static boolean` | `checkIfRunningInMiniServerMode()`
    `static java.lang.String` | `getCurrentClientId()` Passes back an id that is associated with the client.
    `static java.lang.String` | `getCurrentClientJavaType()` Information about the client's Java technology.
    `static java.lang.String` | `getCurrentClientJavaType(HttpServletRequest request)` Returns back client java type that is transferred via the http header.
    `static int` | `getCurrentClientTimeZoneOffset()` The browser client sends its time zone offset as part of the http communication.
    `static java.lang.String` | `getCurrentClientType()` Passes back the client type that is used by the current user.
    `static java.lang.String` | `getCurrentClientType(HttpServletRequest request)` Passes back the client type that is used by the current user.
    `static ComponentDump` | `getCurrentComponentDump(FacesContext context)` Internal use only.
    `static ComponentDump` | `getCurrentComponentDump(ISessionAbstraction httpSession, java.lang.String subpageId)` Internal use only.
    `static ISessionAbstraction` | `getCurrentDialogSession()` The dialog session is the session that is associated with a dialog ("browser tab instance") on client side.
    `static ISessionAbstraction` | `getCurrentDialogSession(HttpSession session)` The dialog session is the session that is associated with a dialog ("browser tab instance") on client side.
    `static ISessionAbstraction` | `getCurrentDialogSession(HttpSession session, java.lang.String subpageId)`
    `static HttpSession` | `getCurrentHttpSession()` This session must only be called within the context of a request processing!
    `static HttpSession` | `getCurrentHttpSession(FacesContext context)` Same as `getCurrentHttpSession()` - now with passing the FacesContext instance, which guides to the http session.
    `static HttpSession` | `getCurrentHttpSession(ISessionContextProvider context)`
    `static HttpSession` | `getCurrentHttpSessionIfAvailable(FacesContext context)` Same as `getCurrentHttpSession()` - 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 HttpSession` | `getCurrentHttpSessionIfAvailable(ISessionContextProvider context)`
    `static HttpSessionListenerDelegator` | `getCurrentHttpSessionListenerDelegator()` Internal use only.
    `static HttpSessionListenerDelegator` | `getCurrentHttpSessionListenerDelegator(HttpSession session)` Internal use only.
    `static java.util.Locale` | `getCurrentLocale()` Retrieve the Locale that is used on server side within the current session.
    `static HttpServletRequest` | `getCurrentRequest()` Returns the servlet request that triggered the current request processing.
    `static java.lang.String` | `getCurrentRequestId()` Each request is associated with a unique id when entering the server side processing.
    `static HttpServletResponse` | `getCurrentResponse()` Returns the servlet response of the current request processing.
    `static java.lang.String` | `getCurrentStyle()` Returns the current style for the session.
    `static SubpageContext` | `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.
    `static SubpageContext` | `getCurrentSubpageContext(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.
    `static IMethodBindingListener` | `getMethodBindingListener()` Internal use only.
    `static ServletContext` | `getServletContext()` Return the servlet context that was passed by the Servlet-container.
    `static java.lang.String` | `getServletTempDirectory()` A servlet context provides access to a temporary directory in which you can write or read data.
    `static java.lang.String` | `getServletTempDirectory(ServletContext servletContext)`
    `static IValueBindingListener` | `getValueBindingListener()` Internal use only.
    `static java.lang.String` | `getWebApplicationName()` Returns name of the deployed web application using its context path as base.
    `static void` | `initialize(ServletContext servletContext)`
    `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).
    `static void` | `reloadClient(HttpServletResponse response)`
    `static void` | `setCurrentLocale(java.util.Locale l)` Sets the locale that is passed as locale for the current session.
    `static void` | `setCurrentStyle(java.lang.String style)` Sets the current style for the session.
    `static void` | `setMethodBindingListener(IMethodBindingListener mbl)` Internal use only.
    `static void` | `setValueBindingListener(IValueBindingListener vbl)` Internal use only.
    `static void` | `switchProfileModeOffForCurrentSession()` Switch profile mode off.
    `static void` | `switchProfileModeOnForCurrentSession()` Switch profile mode on.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HttpSessionAccess

          public HttpSessionAccess()

  - ### Method Detail

    - #### initialize

          public static void initialize(ServletContext servletContext)

    - #### getCurrentHttpSession

          public static HttpSession getCurrentHttpSession()

      This session must only be called within the context of a request processing!
      Please pay attention: call function `getCurrentDialogSession()` 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 HttpSession getCurrentHttpSessionIfAvailable(FacesContext context)

      Same as `getCurrentHttpSession()` - 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 function `getCurrentDialogSession()` 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 HttpSession getCurrentHttpSessionIfAvailable(ISessionContextProvider context)

    - #### getCurrentHttpSession

          public static HttpSession getCurrentHttpSession(FacesContext context)

      Same as `getCurrentHttpSession()` - now with passing the FacesContext instance, which guides to the http session.
      Please pay attention: call function `getCurrentDialogSession()` 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 HttpSession getCurrentHttpSession(ISessionContextProvider context)

    - #### getCurrentComponentDump

          public static ComponentDump getCurrentComponentDump(FacesContext context)

      Internal use only.

    - #### getCurrentComponentDump

          public static ComponentDump getCurrentComponentDump(ISessionAbstraction httpSession,
                                                              java.lang.String subpageId)

      Internal use only.

    - #### getCurrentHttpSessionListenerDelegator

          public static HttpSessionListenerDelegator getCurrentHttpSessionListenerDelegator()

      Internal use only.

    - #### getCurrentHttpSessionListenerDelegator

          public static HttpSessionListenerDelegator getCurrentHttpSessionListenerDelegator(HttpSession session)

      Internal use only.

    - #### getServletContext

          public static ServletContext getServletContext()

      Return the servlet context that was passed by the Servlet-container.

    - #### getWebApplicationName

          public static java.lang.String 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. Use `UsageWithoutSessionContext` to indicate that you are running in test mode - in this case "undefined" is returned.

    - #### getServletTempDirectory

          public static java.lang.String 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

          public static java.lang.String getServletTempDirectory(ServletContext servletContext)

    - #### 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.

    - #### getCurrentRequest

          public static 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.

    - #### getCurrentResponse

          public static 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

          public static void setValueBindingListener(IValueBindingListener vbl)

      Internal use only.

    - #### getValueBindingListener

          public static IValueBindingListener getValueBindingListener()

      Internal use only.

    - #### setMethodBindingListener

          public static void setMethodBindingListener(IMethodBindingListener mbl)

      Internal use only.

    - #### getMethodBindingListener

          public static IMethodBindingListener 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 method `checkIfDialogSessionInLayoutEditorPreview()`.
      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 method `checkIfInLayoutEditorPreview()` 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

          public static java.lang.String 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(HttpSession 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()

    - #### getCurrentClientType

          public static java.lang.String getCurrentClientType()

      Passes back the client type that is used by the current user. Values that are returned are "applet", "webstart", "application", "browser"

    - #### getCurrentClientType

          public static java.lang.String getCurrentClientType(HttpServletRequest request)

      Passes back the client type that is used by the current user. Values that are returned are "applet", "webstart", "application", "browser". Use constans defined in `ICCServerConstants` for comparing the result values.

    - #### checkIfCurrentClientTypeIsUI5

          public static boolean checkIfCurrentClientTypeIsUI5(HttpServletRequest request)

    - #### checkIfCurrentClientTypeIsRisc

          public static boolean checkIfCurrentClientTypeIsRisc()

    - #### checkIfCurrentClientTypeIsRisc

          public static boolean checkIfCurrentClientTypeIsRisc(HttpServletRequest request)

    - #### getCurrentClientJavaType

          public static java.lang.String getCurrentClientJavaType()

      Information about the client's Java technology.
      Returns:
        either "swing" or "fx" or "risc"

    - #### getCurrentClientJavaType

          public static java.lang.String getCurrentClientJavaType(HttpServletRequest request)

      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
          public static boolean 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 use `checkIfCurrentClientTypeIsRisc()` instead.)

    - #### checkIfCurrentClientJavaTypeIsSwing

          public static boolean checkIfCurrentClientJavaTypeIsSwing()

      Check if current client is a Swing client.

    - #### getCurrentClientId

          public static java.lang.String getCurrentClientId()

      Passes back an id that is associated with the client.

    - #### getCurrentLocale

          public static java.util.Locale 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.

    - #### setCurrentLocale

          public static void setCurrentLocale(java.util.Locale l)

      Sets the locale that is passed as locale for the current session.

    - #### setCurrentStyle

          public static void setCurrentStyle(java.lang.String style)

      Sets the current style for the session.

    - #### getCurrentStyle

          public static java.lang.String 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(HttpServletResponse response)

    - #### getCurrentSubpageContext

          public static SubpageContext 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

          public static SubpageContext getCurrentSubpageContext(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.

    - #### getCurrentDialogSession

          public static ISessionAbstraction 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(HttpSession session)

      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(HttpSession session,
                                                                    java.lang.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.

Copyright © CaptainCasa Gmbh. All Rights Reserved.