Class ClientConfig

  • All Implemented Interfaces:
    Serializable

    public class ClientConfig
    extends Object
    implements Serializable
    Contains information about whether the user has JavaScript enabled on his client, etc. It also contains the windowhandler html which gets sent to the browser to detect the current windowId. This allows the 'customisation' of this html file to e.g. adopt the background colour to avoid screen flickering. Please note that all subclasses of ClientConfig should also be @SessionScoped as well!
    See Also:
    Serialized Form
    • Field Detail

      • COOKIE_NAME_NOSCRIPT_ENABLED

        public static final String COOKIE_NAME_NOSCRIPT_ENABLED
        We will set a cookie with this very name if a noscript link got clicked by the user
        See Also:
        Constant Field Values
      • windowHandlerHtml

        protected String windowHandlerHtml
    • Constructor Detail

      • ClientConfig

        public ClientConfig()
    • Method Detail

      • isJavaScriptEnabled

        public boolean isJavaScriptEnabled()
        Defaults to true.
        Returns:
        if the user has JavaScript enabled
      • setJavaScriptEnabled

        public void setJavaScriptEnabled​(boolean javaScriptEnabled)
        Set it to false if you don't like to use the JavaScript based client side windowhandler. In this case the request will be returned directly.
        Parameters:
        javaScriptEnabled -
      • getUserAgent

        public String getUserAgent​(FacesContext facesContext)
        This information will get stored as it cannot change during the session anyway.
        Returns:
        the UserAgent of the request.
      • isClientSideWindowHandlerRequest

        public boolean isClientSideWindowHandlerRequest​(FacesContext facesContext)
        Users can overload this method to define in which scenarios a request should result in an 'intercepted' page with proper windowId detection. By default the following User-Agents will be served directly:
        • .*bot.*
        • .*Bot.*
        • .*Slurp.*
        • .*Crawler.*
        Returns:
        true if the Request should get 'intercepted' and the intermediate windowhandler.html page should get rendered first. By returning false the requested page will get rendered intermediately.
        See Also:
        for determining the UserAgent