Class ClientConfig
- java.lang.Object
-
- org.apache.myfaces.lifecycle.clientwindow.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
Fields Modifier and Type Field Description static String
COOKIE_NAME_NOSCRIPT_ENABLED
We will set a cookie with this very name if a noscript link got clicked by the userprotected String
windowHandlerHtml
-
Constructor Summary
Constructors Constructor Description ClientConfig()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description 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 totrue
.void
setJavaScriptEnabled(boolean javaScriptEnabled)
Set it tofalse
if you don't like to use the JavaScript based client side windowhandler.
-
-
-
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
-
-
Method Detail
-
isJavaScriptEnabled
public boolean isJavaScriptEnabled()
Defaults totrue
.- Returns:
- if the user has JavaScript enabled
-
setJavaScriptEnabled
public void setJavaScriptEnabled(boolean javaScriptEnabled)
Set it tofalse
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 returningfalse
the requested page will get rendered intermediately.- See Also:
for determining the UserAgent
-
-