|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objecteu.webtoolkit.jwt.Configuration
public class Configuration
JWt application configuration class.
This class holds the configuration for JWt, controlling general features of the interaction between the browser and the web application.
WtServlet.getConfiguration()| Nested Class Summary | |
|---|---|
static class |
Configuration.ErrorReporting
An enumeration for the level of error reporting in case of client-side (JavaScript) errors. |
static class |
Configuration.SessionTracking
|
| Constructor Summary | |
|---|---|
Configuration()
Creates a default configuration. |
|
Configuration(java.io.File configurationFile)
Reads a configuration from an XML file. |
|
| Method Summary | |
|---|---|
boolean |
agentIsBot(java.lang.String userAgent)
Returns whether the user agent is a bot. |
boolean |
agentSupportsAjax(java.lang.String userAgent)
Returns whether the user agent should be considered as one with Ajax support. |
boolean |
debug()
Deprecated. use getErrorReporting() instead. |
java.util.ArrayList<java.lang.String> |
getAjaxAgentList()
Returns the list of user agents that are (not) considered for AJAX sessions. |
int |
getBootstrapTimeout()
|
java.util.ArrayList<java.lang.String> |
getBotList()
Returns the list of user agents that are treated as bots. |
int |
getDoubleClickTimeout()
Returns the double click timeout. |
Configuration.ErrorReporting |
getErrorReporting()
Returns the error reporting mode. |
java.lang.String |
getFavicon()
Returns the path for the favicon |
int |
getIndicatorTimeout()
Returns the loading indicator timeout. |
java.util.HashMap<java.lang.String,java.lang.String> |
getProperties()
Returns configured properties. |
java.lang.String |
getProperty(java.lang.String name)
Returns a property value. |
java.lang.String |
getRedirectMessage()
Returns the plain-HTML redirect message. |
int |
getSessionTimeout()
Returns the session timeout. |
java.lang.String |
getUaCompatible()
Returns UA compatibility selection |
boolean |
isAjaxAgentWhiteList()
Returns whether the getAjaxAgentList() is a white list or black list. |
boolean |
isInlineCss()
Returns whether inline CSS may be generated. |
boolean |
progressiveBootstrap()
Returns whether the progressive bootstrap method is used. |
boolean |
sendXHTMLMimeType()
Returns whether XHTML should be used (if supported by the client). |
void |
setAjaxAgentList(java.util.ArrayList<java.lang.String> ajaxAgentList,
boolean isWhiteList)
Configures agents that may be served an AJAX version of the application. |
void |
setBotList(java.util.ArrayList<java.lang.String> botList)
Sets the list of bots. |
void |
setDebug(boolean how)
Deprecated. use setErrorReporting(ErrorReporting) instead. |
void |
setErrorReporting(Configuration.ErrorReporting err)
Sets the error reporting mode. |
void |
setFavicon(java.lang.String favicon)
Configures a path to a favicon. |
void |
setIndicatorTimeout(int timeout)
Sets the loading indicator timeout. |
void |
setInlineCss(boolean inlineCss)
Sets whether inline CSS may be generated. |
void |
setProgressiveBootstrap(boolean enable)
Sets whether the progressive bootstrap method is used. |
void |
setProperties(java.util.HashMap<java.lang.String,java.lang.String> properties)
Sets properties. |
void |
setRedirectMessage(java.lang.String redirectMessage)
Sets the plain-HTML redirect message. |
void |
setSendXHTMLMimeType(boolean sendXHTMLMimeType)
Sets whether XHTML should be used (if supported by the client). |
void |
setUaCompatible(java.lang.String uaCompatible)
Configures different rendering engines for certain browsers. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public Configuration()
public Configuration(java.io.File configurationFile)
An example configuration file can be found in the JWt source distribution.
configurationFile - | Method Detail |
|---|
public void setProperties(java.util.HashMap<java.lang.String,java.lang.String> properties)
properties - getProperties(),
getProperty(String)public java.util.HashMap<java.lang.String,java.lang.String> getProperties()
Properties may be used to adapt applications to their deployment environment.
public java.lang.String getProperty(java.lang.String name)
Properties may be used to adapt applications to their deployment environment.
name -
null if the property has not been defined.public void setRedirectMessage(java.lang.String redirectMessage)
By default, JWt will use an automatic redirect to start the application when the browser does not support JavaScript. However, browsers are not required to follow the redirection, and in some situations (when using XHTML), such automatic redirection is not supported.
This configures the text that is shown in the anchor which the user may click to be redirected to a basic HTML version of your application.
public java.lang.String getRedirectMessage()
setRedirectMessage(String)public void setSendXHTMLMimeType(boolean sendXHTMLMimeType)
JWt renders XHTML1 (XML variant of HTML) that is backward-compatible with HTML. Using XHTML, JWt is capable of supporting XHTML-only features such as embedded SVG or MathML.
When enabled, JWt sets an XHTML mime-type (application/xhtml+xml) when the browser reports support for
it. Most notably, Internet Explorer does not support it. Because XHTML and HTML are slightly different with
respect to default CSS rules, you may want to disable sending the XHTML mime-type all-together, at least if you
are not using SVG (used by the WPaintedWidget).
public boolean sendXHTMLMimeType()
setSendXHTMLMimeType(boolean)public void setDebug(boolean how)
setErrorReporting(ErrorReporting) instead.
Currently, the only effect of debugging is that JavaScript exceptions are not caught but allowed to propagate so that you can inspect the stack trace.
Debugging is off by default.
public boolean debug()
getErrorReporting() instead.
setDebug(boolean)public void setInlineCss(boolean inlineCss)
This option configures whether CSS rules added to the inline stylesheet WApplication.getStyleSheet() are
rendered.
Some pedantic accessibility guidelines may forbid inline CSS.
Note: some widgets, such as WTreeView, dynamically manipulate rules in this stylesheet, and will no longer work
properly when inline CSS is disabled.
inlineCss - public boolean isInlineCss()
setInlineCss(boolean)
public void setAjaxAgentList(java.util.ArrayList<java.lang.String> ajaxAgentList,
boolean isWhiteList)
When isWhiteList is true, the given list exhaustively indicates all user agents that
will be served an AJAX version of the application. When isWhiteList is false, the given
list excludes some user agents that may be served an AJAX version of the application.
Each entry in ajaxAgentList is a regular expression against which the browser-reported user agent is compared.
By default, JWt will serve an AJAX version when JavaScript and AJAX support are detected.
ajaxAgentList - a list of regular expressions that identify user agentsisWhiteList - whether the list is a white list or black list.public java.util.ArrayList<java.lang.String> getAjaxAgentList()
Depending on the value of isAjaxAgentWhiteList(), the list is a white-list or a black-list.
setAjaxAgentList(ArrayList, boolean),
agentSupportsAjax(String)public boolean isAjaxAgentWhiteList()
getAjaxAgentList() is a white list or black list.
getAjaxAgentList() is a white list or black list.setAjaxAgentList(ArrayList, boolean),
agentSupportsAjax(String)public boolean agentSupportsAjax(java.lang.String userAgent)
setAjaxAgentList(ArrayList, boolean)public void setBotList(java.util.ArrayList<java.lang.String> botList)
JWt considers three types of sessions:
WApplication.setInternalPath(String)) and no persistent sessionsHere, you can specify user agents that should be should be treated as bots.
The default configuration sets the following list:
public java.util.ArrayList<java.lang.String> getBotList()
setBotList(ArrayList)public boolean agentIsBot(java.lang.String userAgent)
setBotList(ArrayList)public void setFavicon(java.lang.String favicon)
The default value is "".
public java.lang.String getFavicon()
setFavicon(String)public void setProgressiveBootstrap(boolean enable)
Since JWt 2.99.4, a new bootstrap method has been added (initially proposed by Anthony roger Buck). While the default bootstrap already honors the principle of graceful degradation, this bootstrap implements this using the principle of progressive enhancement (and quite literally so).
This bootstrap method will initially assume that the user agent is a
plain HTML user-agent and immediately create the application (with
WEnvironment.hasAjax() always returning false).
The initial response will contain the initial page suitable for a plain HTML
user-agent.
JavaScript embedded in this page will sense for AJAX support and
trigger a second request which progresses the application to an AJAX
application (without repainting the user interface). To that extent,
it will change WEnvironment.hasAjax() to return true, and
invoke WApplication.enableAjax() which in turn propagates
WWidget.enableAjax() through the widget hierarchy. This upgrade
happens in the back-ground, unnoticed to the user.
This mitigates disadvantages associated with the default bootstrap, which implements a browser detection first after it starts the application:
getRedirectMessage().
public boolean progressiveBootstrap()
setProgressiveBootstrap(boolean).public int getSessionTimeout()
public int getDoubleClickTimeout()
public int getIndicatorTimeout()
public void setIndicatorTimeout(int timeout)
timeout - the timeout in milliseconds.public int getBootstrapTimeout()
public Configuration.ErrorReporting getErrorReporting()
public void setErrorReporting(Configuration.ErrorReporting err)
public void setUaCompatible(java.lang.String uaCompatible)
public java.lang.String getUaCompatible()
setUaCompatible(String)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||