|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||
java.lang.Objectwicket.ApplicationSettings
Contains application settings as property values. All settings exposed are generic to any kind of protocol or markup.
Application settings properties:
componentUseCheck (defaults to true) - Causes the framework to do a check after rendering each page to ensure that each component was used in rendering the markup. If components are found that are not referenced in the markup, an appropriate error will be displayed
compressWhitespace (defaults to false) - Causes pages to render with redundant whitespace removed. Whitespace stripping is not HTML or JavaScript savvy and can conceivably break pages, but should provide significant performance improvements.
unexpectedExceptionDisplay (defaults to SHOW_EXCEPTION_PAGE) - Determines how exceptions are displayed to the developer or user
maxPages - The maximum number of pages in the user's session before old pages are expired.
resourcePollFrequency (defaults to no polling frequency) - Frequency at which resources should be polled for changes.
resourceFinder (classpath) - Set this to alter the search path for resources.
stripComments (defaults to false) - Set to true to strip HTML comments during markup loading
stripComponentIds (defaults to false) - Set to true to strip component id attributes during rendering
throwExceptionOnMissingResource (defaults to true) - Set to true to throw a runtime exception if a required string resource is not found. Set to false to return the requested resource key surrounded by pairs of question mark characters (e.g. "??missingKey??")
useDefaultOnMissingResource (defaults to true) - Set to true to return a default value if available when a required string resource is not found. If set to false then the throwExceptionOnMissingResource flag is used to determine how to behave. If no default is available then this is the same as if this flag were false
stringResourceLoaders - A chain of IStringResourceLoader
instances that are searched in order to obtain string resources used during
localization. By default the chain is set up to first search for resources
against a particular component (e.g. page etc.) and then against the
application.
defaultPageFactory - the factory class that is used for constructing page instances.
renderStrategy - Sets in what way the render part of a request is handled. Basically, there are two different options:
| Nested Class Summary | |
static class |
ApplicationSettings.RenderStrategy
Enumerated type for different ways of handling the render part of requests. |
static class |
ApplicationSettings.UnexpectedExceptionDisplay
Enumerated type for different ways of displaying unexpected exceptions. |
| Field Summary | |
static ApplicationSettings.RenderStrategy |
ONE_PASS_RENDER
All logical parts of a request (the action and render part) are handled within the same request. |
static ApplicationSettings.RenderStrategy |
REDIRECT_TO_BUFFER
All logical parts of a request (the action and render part) are handled within the same request, but instead of streaming the render result to the browser directly, the result is cached on the server. |
static ApplicationSettings.RenderStrategy |
REDIRECT_TO_RENDER
The render part of a request (opposed to the 'action part' which is either the construction of a bookmarkable page or the execution of a IRequestListener handler) is handled by a seperate request by issueing a redirect request to the browser. |
static ApplicationSettings.UnexpectedExceptionDisplay |
SHOW_EXCEPTION_PAGE
Indicates that an exception page appropriate to development should be shown when an unexpected exception is thrown. |
static ApplicationSettings.UnexpectedExceptionDisplay |
SHOW_INTERNAL_ERROR_PAGE
Indicates a generic internal error page should be shown when an unexpected exception is thrown. |
static ApplicationSettings.UnexpectedExceptionDisplay |
SHOW_NO_EXCEPTION_PAGE
Indicates that no exception page should be shown when an unexpected exception is thrown. |
| Constructor Summary | |
ApplicationSettings(Application application)
Create the application settings, carrying out any necessary initialisations. |
|
| Method Summary | |
ApplicationSettings |
addResourceFolder(java.lang.String resourceFolder)
Convenience method that sets the resource search path to a single folder. |
ApplicationSettings |
addStringResourceLoader(IStringResourceLoader loader)
Add a string resource loader to the chain of loaders. |
void |
configure(java.lang.String configurationType)
Configures application settings for a given configuration type. |
void |
configure(java.lang.String configurationType,
IResourceFinder resourceFinder)
Configures application settings for a given configuration type. |
void |
configure(java.lang.String configurationType,
java.lang.String resourceFolder)
Convenience method that configures application settings for a given configuration type. |
boolean |
getAutomaticLinking()
If true, automatic link resolution is enabled. |
boolean |
getBufferResponse()
|
boolean |
getComponentUseCheck()
Get whether component use should be checked or not. |
boolean |
getCompressWhitespace()
|
CookieValuePersisterSettings |
getCookieValuePersisterSettings()
Get the defaults to be used by persistence manager |
java.lang.Class |
getCryptClass()
|
java.lang.String |
getDefaultAfterDisabledLink()
|
java.lang.String |
getDefaultBeforeDisabledLink()
|
IClassResolver |
getDefaultClassResolver()
Gets the default resolver to use when finding classes |
java.util.Locale |
getDefaultLocale()
|
java.lang.String |
getDefaultMarkupEncoding()
|
IPageFactory |
getDefaultPageFactory()
Gets the default factory to be used when creating pages |
java.lang.String |
getEncryptionKey()
Get encryption key used to encode/decode passwords e.g. |
int |
getMaxPages()
Gets the maximum number of pages held in a session. |
int |
getMaxPageVersions()
|
ApplicationSettings.RenderStrategy |
getRenderStrategy()
Gets in what way the render part of a request is handled. |
IResourceFinder |
getResourceFinder()
Gets the resource finder to use when searching for resources. |
Duration |
getResourcePollFrequency()
|
java.lang.String |
getResponseRequestEncoding()
In order to do proper form parameter decoding it is important that the response and the following request have the same encoding. |
(package private) java.util.List |
getStringResourceLoaders()
Internal method to expose the string resource loaders configured within the settings to the localization helpers that need to work with them. |
boolean |
getStripComments()
|
boolean |
getStripWicketTags()
Gets whether to remove wicket tags from the output. |
boolean |
getStripXmlDeclarationFromOutput()
|
boolean |
getThrowExceptionOnMissingResource()
|
ApplicationSettings.UnexpectedExceptionDisplay |
getUnexpectedExceptionDisplay()
|
boolean |
getUseDefaultOnMissingResource()
|
java.lang.String |
getValidatorResourceKey(IValidator validator,
FormComponent formComponent)
This method builds a resource key for use by form component validators using IValidatorResourceKeyFactory. |
boolean |
getVersionPagesByDefault()
|
protected IResourceFinder |
newResourceFinder()
This method returns a default Path object. |
void |
setAutomaticLinking(boolean automaticLinking)
Application default for automatic link resolution. |
void |
setBufferResponse(boolean bufferResponse)
|
ApplicationSettings |
setComponentUseCheck(boolean componentUseCheck)
Enables or disables checking for unused components. |
ApplicationSettings |
setCompressWhitespace(boolean compressWhitespace)
Turns on whitespace compression. |
void |
setCookieValuePersisterSettings(CookieValuePersisterSettings cookieValuePersisterSettings)
|
ApplicationSettings |
setCryptClass(java.lang.Class crypt)
Set new Class to be used for de-/encryption |
ApplicationSettings |
setDefaultAfterDisabledLink(java.lang.String defaultAfterDisabledLink)
|
ApplicationSettings |
setDefaultBeforeDisabledLink(java.lang.String defaultBeforeDisabledLink)
|
ApplicationSettings |
setDefaultClassResolver(IClassResolver defaultClassResolver)
Sets the default class resolver to use when finding classes. |
void |
setDefaultLocale(java.util.Locale defaultLocale)
|
void |
setDefaultMarkupEncoding(java.lang.String encoding)
Set default encoding for markup files. |
ApplicationSettings |
setDefaultPageFactory(IPageFactory defaultPageFactory)
Sets the default factory to be used when creating pages. |
ApplicationSettings |
setEncryptionKey(java.lang.String encryptionKey)
Set encryption key used to encode/decode PasswordTextFields e.g. |
ApplicationSettings |
setMaxPages(int maxPages)
Sets the maximum number of pages held in a session. |
void |
setMaxPageVersions(int maxPageVersions)
|
void |
setRenderStrategy(ApplicationSettings.RenderStrategy renderStrategy)
Sets in what way the render part of a request is handled. |
ApplicationSettings |
setResourceFinder(IResourceFinder resourceFinder)
Sets the finder to use when searching for resources. |
ApplicationSettings |
setResourcePollFrequency(Duration resourcePollFrequency)
Sets the resource polling frequency. |
void |
setResponseRequestEncoding(java.lang.String responseRequestEncoding)
In order to do proper form parameter decoding it is important that the response and the following request have the same encoding. |
ApplicationSettings |
setStripComments(boolean stripComments)
Enables stripping of markup comments denoted in markup by HTML comment tagging. |
ApplicationSettings |
setStripWicketTags(boolean stripWicketTags)
Sets whether to remove wicket tags from the output. |
void |
setStripXmlDeclarationFromOutput(boolean strip)
|
ApplicationSettings |
setThrowExceptionOnMissingResource(boolean throwExceptionOnMissingResource)
|
ApplicationSettings |
setUnexpectedExceptionDisplay(ApplicationSettings.UnexpectedExceptionDisplay unexpectedExceptionDisplay)
The exception display type determines how the framework displays exceptions to you as a developer or user. |
ApplicationSettings |
setUseDefaultOnMissingResource(boolean useDefaultOnMissingResource)
|
void |
setValidatorResourceKeyFactory(IValidatorResourceKeyFactory factory)
This method is used to replace the default IValidatorResourceKeyFactory implementation with a user specific one |
void |
setVersionPagesByDefault(boolean pagesVersionedByDefault)
|
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
public static final ApplicationSettings.RenderStrategy ONE_PASS_RENDER
RequestCycleto
true (getRequestCycle.setRedirect(true)), after which the behaviour will
be like RenderStragegy 'REDIRECT_TO_RENDER'.
This strategy is more efficient than the 'REDIRECT_TO_RENDER' strategy, and doesn't have some of the potential problems of it, it also does not solve the double submit problem. It is however the best option to use when you want to do sophisticated (non-sticky session) clustering.
public static final ApplicationSettings.RenderStrategy REDIRECT_TO_BUFFER
public static final ApplicationSettings.RenderStrategy REDIRECT_TO_RENDER
RequestCycleto false (getRequestCycle.setRedirect(false)).
This pattern solves the 'refresh' problem. While it is a common feature of browsers to refresh/ reload a web page, this results in problems in many dynamic web applications. For example, when you have a link with an event handler that e.g. deletes a row from a list, you usually want to ignore refresh requests after that link is clicked on. By using this strategy, the refresh request only results in the re-rendering of the page without executing the event handler again.
Though it solves the refresh problem, it introduces potential problems, as the request that is logically one, are actually two seperate request. Not only is this less efficient, but this also can mean that within the same request attachement/ detachement of models is done twice (in case you use models in the bookmarkable page constructors and IRequestListener handlers). If you use this strategy, you should be aware of this possibily, and should also be aware that for one logical request, actually two instances of RequestCycle are created and processed.
public static final ApplicationSettings.UnexpectedExceptionDisplay SHOW_EXCEPTION_PAGE
public static final ApplicationSettings.UnexpectedExceptionDisplay SHOW_INTERNAL_ERROR_PAGE
public static final ApplicationSettings.UnexpectedExceptionDisplay SHOW_NO_EXCEPTION_PAGE
| Constructor Detail |
public ApplicationSettings(Application application)
application - The application that these settings are for| Method Detail |
public final ApplicationSettings addResourceFolder(java.lang.String resourceFolder)
resourceFolder - The resourceFolder to set
public final ApplicationSettings addStringResourceLoader(IStringResourceLoader loader)
loader - The loader to be added
public final void configure(java.lang.String configurationType)
configurationType - The configuration type. Must currently be either "development"
or "deployment". If the type is 'development', the classpath
is polled for changes
public final void configure(java.lang.String configurationType,
IResourceFinder resourceFinder)
configurationType - The configuration type. Must currently be either "development"
or "deployment". If the type is 'development', the given
resourceFinder is polled for changesresourceFinder - Finder for looking up resourcesFile.pathSeparator
public final void configure(java.lang.String configurationType,
java.lang.String resourceFolder)
configurationType - The configuration type. Must currently be either "development"
or "deployment". If the type is 'development', the given
resourceFolder is polled for changesresourceFolder - Folder for polling resourcesFile.pathSeparatorpublic final boolean getAutomaticLinking()
AutoLinkResolver,
WicketLinkTagHandlerpublic final boolean getBufferResponse()
public final boolean getComponentUseCheck()
setComponentUseCheck(boolean)public final boolean getCompressWhitespace()
setCompressWhitespace(boolean)public final CookieValuePersisterSettings getCookieValuePersisterSettings()
public final java.lang.Class getCryptClass()
public final java.lang.String getDefaultAfterDisabledLink()
public final java.lang.String getDefaultBeforeDisabledLink()
public final IClassResolver getDefaultClassResolver()
public final java.util.Locale getDefaultLocale()
public final IPageFactory getDefaultPageFactory()
public final java.lang.String getEncryptionKey()
public final java.lang.String getDefaultMarkupEncoding()
public final int getMaxPages()
setMaxPages(int)public final int getMaxPageVersions()
public final ApplicationSettings.RenderStrategy getRenderStrategy()
public final IResourceFinder getResourceFinder()
setResourceFinder(IResourceFinder)public final Duration getResourcePollFrequency()
setResourcePollFrequency(Duration)public final boolean getStripComments()
setStripComments(boolean)public final boolean getStripWicketTags()
public final boolean getStripXmlDeclarationFromOutput()
public final boolean getThrowExceptionOnMissingResource()
public final ApplicationSettings.UnexpectedExceptionDisplay getUnexpectedExceptionDisplay()
setUnexpectedExceptionDisplay(ApplicationSettings.UnexpectedExceptionDisplay)public final boolean getUseDefaultOnMissingResource()
public final boolean getVersionPagesByDefault()
public final void setAutomaticLinking(boolean automaticLinking)
automaticLinking - The automaticLinking to set.and,
for more details.public final void setBufferResponse(boolean bufferResponse)
bufferResponse - True if this application should buffer responses.public final ApplicationSettings setComponentUseCheck(boolean componentUseCheck)
componentUseCheck -
public final ApplicationSettings setCompressWhitespace(boolean compressWhitespace)
Compression is currently not HTML aware and so it may be possible for whitespace compression to break pages. For this reason, whitespace compression is off by default and you should test your application throroughly after turning whitespace compression on.
Spaces are removed from markup at markup load time and there should be no effect on page rendering speed. In fact, your pages should render faster with whitespace compression enabled.
compressWhitespace - The compressWhitespace to set.
public final void setCookieValuePersisterSettings(CookieValuePersisterSettings cookieValuePersisterSettings)
cookieValuePersisterSettings - The cookieValuePersisterSettings to set.public final ApplicationSettings setCryptClass(java.lang.Class crypt)
crypt -
public final ApplicationSettings setDefaultAfterDisabledLink(java.lang.String defaultAfterDisabledLink)
defaultAfterDisabledLink - The defaultAfterDisabledLink to set.
public final ApplicationSettings setDefaultBeforeDisabledLink(java.lang.String defaultBeforeDisabledLink)
defaultBeforeDisabledLink - The defaultBeforeDisabledLink to set.
public final ApplicationSettings setDefaultClassResolver(IClassResolver defaultClassResolver)
defaultClassResolver - The default class resolver
public final void setDefaultLocale(java.util.Locale defaultLocale)
defaultLocale - The defaultLocale to set.public final ApplicationSettings setDefaultPageFactory(IPageFactory defaultPageFactory)
defaultPageFactory - The default factory
public final ApplicationSettings setEncryptionKey(java.lang.String encryptionKey)
encryptionKey -
public final void setDefaultMarkupEncoding(java.lang.String encoding)
encoding - public final ApplicationSettings setMaxPages(int maxPages)
maxPages - The maxPages to set.
public final void setMaxPageVersions(int maxPageVersions)
maxPageVersions - The maxPageVersion to set.public final void setRenderStrategy(ApplicationSettings.RenderStrategy renderStrategy)
renderStrategy - the render strategy that should be used by default.public final ApplicationSettings setResourceFinder(IResourceFinder resourceFinder)
resourceFinder - The resourceFinder to set
public final ApplicationSettings setResourcePollFrequency(Duration resourcePollFrequency)
resourcePollFrequency - Frequency at which to poll resources
setResourceFinder(IResourceFinder)public final ApplicationSettings setStripComments(boolean stripComments)
stripComments - True to strip markup comments from rendered pages
public final ApplicationSettings setStripWicketTags(boolean stripWicketTags)
stripWicketTags - whether to remove wicket tags from the output
public final void setStripXmlDeclarationFromOutput(boolean strip)
strip - if true, xml declaration will be stripped from outputpublic final ApplicationSettings setThrowExceptionOnMissingResource(boolean throwExceptionOnMissingResource)
throwExceptionOnMissingResource - Whether to throw an exception when a missing resource is
requested
public final ApplicationSettings setUnexpectedExceptionDisplay(ApplicationSettings.UnexpectedExceptionDisplay unexpectedExceptionDisplay)
The default value for exception display type is SHOW_EXCEPTION_PAGE. When this value is set and an unhandled runtime exception is thrown by a page, a redirect to a helpful exception display page will occur.
This is a developer feature, however, and you may want to instead show an internal error page without developer details that allows a user to start over at the application's home page. This can be accomplished by setting the exception display type to SHOW_INTERNAL_ERROR_PAGE.
Finally, if you are having trouble with the exception display pages themselves, you can disable exception displaying entirely with the value SHOW_NO_EXCEPTION_PAGE. This will cause the framework to re-throw any unhandled runtime exceptions after wrapping them in a ServletException wrapper.
unexpectedExceptionDisplay - The unexpectedExceptionDisplay to set.
public final ApplicationSettings setUseDefaultOnMissingResource(boolean useDefaultOnMissingResource)
useDefaultOnMissingResource - Whether to use a default value (if available) when a missing
resource is requested
public final void setVersionPagesByDefault(boolean pagesVersionedByDefault)
pagesVersionedByDefault - The pagesVersionedByDefault to set.protected IResourceFinder newResourceFinder()
final java.util.List getStringResourceLoaders()
public final java.lang.String getResponseRequestEncoding()
public final void setResponseRequestEncoding(java.lang.String responseRequestEncoding)
responseRequestEncoding - The request and response encoding to be used.public void setValidatorResourceKeyFactory(IValidatorResourceKeyFactory factory)
factory - the user defined implementation of
IValidatorResourceKeyFactory
public java.lang.String getValidatorResourceKey(IValidator validator,
FormComponent formComponent)
validator - the validator that is processing the errorformComponent - the form component that is in error
IValidatorResourceKeyFactory,
DefaultValidatorResourceKeyFactory
|
|||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||||