public class MockApplication extends WebApplication
WebApplication
used for testing.META_INF_RESOURCES
CONFIGURATION
Constructor and Description |
---|
MockApplication()
Construct.
|
Modifier and Type | Method and Description |
---|---|
RuntimeConfigurationType |
getConfigurationType()
Gets the configuration mode to use for configuring the app, either
RuntimeConfigurationType.DEVELOPMENT or RuntimeConfigurationType.DEPLOYMENT . |
Class<? extends Page> |
getHomePage()
Application subclasses must specify a home page class by implementing this abstract method.
|
String |
getInitParameter(String key)
Gets an init parameter of the filter, or null if the parameter does not exist.
|
Session |
getSession() |
protected void |
internalInit()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
|
addResourceReplacement, addResourceReplacement, get, getAjaxRequestTargetListeners, getAjaxRequestTargetProvider, getAndRemoveBufferedResponse, getApplicationKey, getFilterFactoryManager, getMimeType, getServletContext, getSessionAttributePrefix, getUpdateAutoLabelsOnAjaxRequests, getWicketFilter, hasBufferedResponse, hasFilterFactoryManager, init, internalDestroy, logEventTarget, logResponseTarget, mount, mountPackage, mountPage, mountResource, newAjaxRequestTarget, newSession, newWebRequest, newWebResponse, outputDevelopmentModeWarning, renderXmlDecl, sessionUnbound, setAjaxRequestTargetProvider, setConfigurationType, setServletContext, setWicketFilter, storeBufferedResponse, unmount
configure, createRequestCycle, decorateHeaderResponse, exists, fetchCreateAndSetSession, get, getApplicationKeys, getApplicationListeners, getApplicationSettings, getBehaviorInstantiationListeners, getComponentInitializationListeners, getComponentInstantiationListeners, getComponentOnAfterRenderListeners, getComponentOnConfigureListeners, getComponentPostOnBeforeRenderListeners, getComponentPreOnBeforeRenderListeners, getConverterLocator, getDebugSettings, getExceptionMapperProvider, getExceptionSettings, getFrameworkSettings, getHeaderContributorListeners, getInitializers, getJavaScriptLibrarySettings, getMapperContext, getMarkupSettings, getMetaData, getName, getOnComponentTagListeners, getPageFactory, getPageManagerContext, getPageManagerProvider, getPageRendererProvider, getPageSettings, getRequestCycleListeners, getRequestCycleProvider, getRequestCycleSettings, getRequestLogger, getRequestLoggerSettings, getResourceBundles, getResourceReferenceRegistry, getResourceSettings, getRootRequestMapper, getRootRequestMapperAsCompound, getSecuritySettings, getSessionListeners, getSessionStore, getSessionStoreProvider, getSharedResources, getStoreSettings, initApplication, newConverterLocator, newMapperContext, newPageFactory, newRequestLogger, newResourceBundles, newResourceReferenceRegistry, newSharedResources, onDestroy, onEvent, setApplicationSettings, setDebugSettings, setExceptionSettings, setFrameworkSettings, setHeaderResponseDecorator, setJavaScriptLibrarySettings, setMarkupSettings, setMetaData, setName, setPageManagerProvider, setPageRendererProvider, setPageSettings, setRequestCycleProvider, setRequestCycleSettings, setRequestLoggerSettings, setResourceSettings, setRootRequestMapper, setSecuritySettings, setSessionStoreProvider, setStoreSettings, usesDeploymentConfig, usesDevelopmentConfig, validateInit
public Class<? extends Page> getHomePage()
Application
getHomePage
in class Application
public RuntimeConfigurationType getConfigurationType()
WebApplication
RuntimeConfigurationType.DEVELOPMENT
or RuntimeConfigurationType.DEPLOYMENT
.
The configuration type. Must currently be either DEVELOPMENT or DEPLOYMENT. Currently, if the configuration type is DEVELOPMENT, resources are polled for changes, component usage is checked, wicket tags are not stripped from output and a detailed exception page is used. If the type is DEPLOYMENT, component usage is not checked, wicket tags are stripped from output and a non-detailed exception page is used to display errors.
Note that you should not run Wicket in DEVELOPMENT mode on production servers - the various debugging checks and resource polling is inefficient and may leak resources, particularly on webapp redeploy.
To change the deployment mode, add the following to your web.xml, inside your
You can alternatively set this as a <context-param> on the whole context.
Another option is to set the "wicket.configuration" system property to either "deployment" or
"development". The value is not case-sensitive.
The system property is checked first, allowing you to add a web.xml param for deployment, and
a command-line override when you want to run in development mode during development.
You may also override Application.getConfigurationType() to provide your own custom switch,
in which case none of the above logic is used.
<init-param>
<param-name>configuration</param-name>
<param-value>deployment</param-value>
</init-param>
IMPORTANT NOTE
THIS METHOD IS CALLED OFTEN FROM MANY DIFFERENT POINTS IN CODE, INCLUDING DURING THE RENDER PROCESS, THEREFORE THE IMPLEMENTATION SHOULD BE FAST - PREFERRABLY USING A FAST-TO-RETRIEVE CACHED VALUEgetConfigurationType
in class WebApplication
public Session getSession()
public final String getInitParameter(String key)
WebApplication
getInitParameter
in class WebApplication
key
- the key to search forprotected void internalInit()
WebApplication
<init-param><param-name>configuration</param-name>
). If not
found check the servlet context init parameter
<context-param><param-name6gt;configuration</param-name>
). If the
parameter is "development" (which is default), settings appropriate for development are set.
If it's "deployment" , deployment settings are used. If development is specified and a
"sourceFolder" init parameter is also set, then resources in that folder will be polled for
changes.internalInit
in class WebApplication
Copyright © 2006–2022 Apache Software Foundation. All rights reserved.