org.apache.myfaces.lifecycle
Class ClientConfig

java.lang.Object
  extended by org.apache.myfaces.lifecycle.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 Summary
static String COOKIE_NAME_NOSCRIPT_ENABLED
          We will set a cookie with this very name if a noscript link got clicked by the user
protected  String windowHandlerHtml
           
 
Constructor Summary
ClientConfig()
           
 
Method Summary
 String getUserAgent(FacesContext facesContext)
          This information will get stored as it cannot change during the session anyway.
 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.
 boolean isJavaScriptEnabled()
          Defaults to true.
 void setJavaScriptEnabled(boolean javaScriptEnabled)
          Set it to false if you don't like to use the JavaScript based client side windowhandler.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

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. This can e.g. contain blacklisting some userAgents. By default the following User-Agents will be served directly:

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


Copyright © 2014 The Apache Software Foundation. All rights reserved.