|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.Application
org.apache.wicket.protocol.http.WebApplication
public abstract class WebApplication
A web application is a subclass of Application which associates with an instance of WicketServlet to serve pages over the HTTP protocol. This class is intended to be subclassed by framework clients to define a web application.
Application settings are given defaults by the WebApplication() constructor and internalInit method, such as error page classes appropriate for HTML. WebApplication subclasses can override these values and/or modify other application settings by overriding the init() method and then by calling getXXXSettings() to retrieve an interface to a mutable Settings object. Do not do this in the constructor itself because the defaults will then override your settings.
If you want to use a filter specific configuration, e.g. using init parameters from the
FilterConfig
object, you should override the init() method. For example:
public void init() { String webXMLParameter = getInitParameter("myWebXMLParameter"); URL schedulersConfig = getServletContext().getResource("/WEB-INF/schedulers.xml"); ...
WicketFilter
,
IApplicationSettings
,
IDebugSettings
,
IExceptionSettings
,
IMarkupSettings
,
IPageSettings
,
IRequestCycleSettings
,
IResourceSettings
,
ISecuritySettings
,
ISessionSettings
,
Filter
,
FilterConfig
,
ServletContext
Field Summary |
---|
Fields inherited from class org.apache.wicket.Application |
---|
CONFIGURATION, CONTEXTPATH, DEPLOYMENT, DEVELOPMENT |
Constructor Summary | |
---|---|
WebApplication()
Constructor. |
Method Summary | |
---|---|
java.lang.String |
getApplicationKey()
Gets the unique key of this application within a given context (like a web application). |
java.lang.String |
getConfigurationType()
Gets the configuration mode to use for configuring the app, either Application.DEVELOPMENT or
Application.DEPLOYMENT . |
protected java.lang.Object |
getDefaultRequestCycleFactory()
Deprecated. Replaced by newRequestCycle(Request, Response) |
java.lang.String |
getInitParameter(java.lang.String key)
Gets an init parameter of the filter, or null if the parameter does not exist. |
IRequestCycleProcessor |
getRequestCycleProcessor()
Gets the default request cycle processor (with lazy initialization). |
protected IResourceFinder |
getResourceFinder()
|
javax.servlet.ServletContext |
getServletContext()
Gets the servlet context for this application. |
java.lang.String |
getSessionAttributePrefix(WebRequest request)
Gets the prefix for storing variables in the actual session (typically HttpSession
for this application instance. |
WicketFilter |
getWicketFilter()
|
protected void |
init()
Initialize; if you need the wicket servlet for initialization, e.g. |
protected void |
internalDestroy()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
protected void |
internalInit()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
void |
logEventTarget(IRequestTarget target)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
void |
logResponseTarget(IRequestTarget target)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
void |
mount(IRequestTargetUrlCodingStrategy encoder)
Mounts an encoder at the given path. |
void |
mount(java.lang.String path,
PackageName packageName)
Mounts all bookmarkable pages at the given path. |
void |
mountBookmarkablePage(java.lang.String path,
java.lang.Class bookmarkablePageClass)
Mounts a bookmarkable page class to the given path. |
void |
mountBookmarkablePage(java.lang.String path,
java.lang.String pageMapName,
java.lang.Class bookmarkablePageClass)
Mounts a bookmarkable page class to the given pagemap and path. |
void |
mountSharedResource(java.lang.String path,
java.lang.String resourceKey)
Mounts a shared resource class to the given path. |
AjaxRequestTarget |
newAjaxRequestTarget(Page page)
Creates a new ajax request target used to control ajax responses |
RequestCycle |
newRequestCycle(Request request,
Response response)
Creates a new RequestCycle object. |
protected IRequestCycleProcessor |
newRequestCycleProcessor()
Gets a new request cycle processor for web requests. |
Session |
newSession()
Deprecated. see newSession(Request, Response) . |
Session |
newSession(Request request)
Deprecated. newSession(Request, Response) . |
Session |
newSession(Request request,
Response response)
Creates a new session. |
protected ISessionStore |
newSessionStore()
Creates a new session facade. |
protected WebRequest |
newWebRequest(javax.servlet.http.HttpServletRequest servletRequest)
Create a new WebRequest. |
protected WebResponse |
newWebResponse(javax.servlet.http.HttpServletResponse servletResponse)
Create a WebResponse. |
protected void |
outputDevelopmentModeWarning()
This method prints a warning to stderr that we are starting in development mode. |
void |
sessionDestroyed(java.lang.String sessionId)
|
protected void |
setApplicationKey(java.lang.String applicationKey)
Set the application key value |
void |
setWicketFilter(WicketFilter wicketFilter)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
void |
unmount(java.lang.String path)
Unmounts whatever encoder is mounted at a given path. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public WebApplication()
init()
for any configuration of your application instead of
overriding the constructor.
Method Detail |
---|
public final java.lang.String getApplicationKey()
Application
getApplicationKey
in class Application
Application.getApplicationKey()
public final java.lang.String getInitParameter(java.lang.String key)
key
- the key to search for
public final IRequestCycleProcessor getRequestCycleProcessor()
IRequestCycleProcessor
that will be used by RequestCycle
s when custom
implementations of the request cycle do not provide their own customized versions.
public javax.servlet.ServletContext getServletContext()
public java.lang.String getSessionAttributePrefix(WebRequest request)
HttpSession
for this application instance.
request
- the request
public final WicketFilter getWicketFilter()
public void logEventTarget(IRequestTarget target)
Application
logEventTarget
in class Application
Application.logEventTarget(org.apache.wicket.IRequestTarget)
public void logResponseTarget(IRequestTarget target)
Application
logResponseTarget
in class Application
Application.logResponseTarget(org.apache.wicket.IRequestTarget)
public final void mount(IRequestTargetUrlCodingStrategy encoder)
encoder
- the encoder that will be used for this mountpublic final void mount(java.lang.String path, PackageName packageName)
path
- the path to mount the bookmarkable page class onpackageName
- the name of the package for which all bookmarkable pages or sharedresources should
be mountedpublic final void mountBookmarkablePage(java.lang.String path, java.lang.Class bookmarkablePageClass)
path
- the path to mount the bookmarkable page class onbookmarkablePageClass
- the bookmarkable page class to mountpublic final void mountBookmarkablePage(java.lang.String path, java.lang.String pageMapName, java.lang.Class bookmarkablePageClass)
path
- the path to mount the bookmarkable page class onpageMapName
- name of the pagemap this mount is forbookmarkablePageClass
- the bookmarkable page class to mountpublic final void mountSharedResource(java.lang.String path, java.lang.String resourceKey)
path
- the path to mount the resource class onresourceKey
- the shared key of the resource being mountedpublic RequestCycle newRequestCycle(Request request, Response response)
Application
newRequestCycle
in class Application
request
- The requestresponse
- The response
Application.newRequestCycle(org.apache.wicket.Request,
org.apache.wicket.Response)
public final Session newSession()
newSession(Request, Response)
.
public final Session newSession(Request request)
newSession(Request, Response)
.
request
-
public Session newSession(Request request, Response response)
Application
newSession
in class Application
request
- The request that will create this session.response
- The response to initialize, for example with cookies. This is important to use
cases involving unit testing because those use cases might want to be able to sign
a user in automatically when the session is created.
Application.newSession(org.apache.wicket.Request,
org.apache.wicket.Response)
public void sessionDestroyed(java.lang.String sessionId)
sessionId
- The session id that was destroyedpublic final void setWicketFilter(WicketFilter wicketFilter)
wicketFilter
- The wicket filter instance for this applicationpublic final void unmount(java.lang.String path)
path
- the path of the encoder to unmountprotected final java.lang.Object getDefaultRequestCycleFactory()
newRequestCycle(Request, Response)
protected void init()
init
in class Application
protected void internalDestroy()
internalDestroy
in class Application
protected void internalInit()
<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 Application
public java.lang.String getConfigurationType()
Application
Application.DEVELOPMENT
or
Application.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.
getConfigurationType
in class Application
Application.getConfigurationType()
protected IResourceFinder getResourceFinder()
protected IRequestCycleProcessor newRequestCycleProcessor()
protected ISessionStore newSessionStore()
Application
newSessionStore
in class Application
Application.newSessionStore()
protected WebRequest newWebRequest(javax.servlet.http.HttpServletRequest servletRequest)
servletRequest
-
protected WebResponse newWebResponse(javax.servlet.http.HttpServletResponse servletResponse)
servletResponse
-
public AjaxRequestTarget newAjaxRequestTarget(Page page)
page
- page on which ajax response is made
protected final void setApplicationKey(java.lang.String applicationKey)
applicationKey
- Unique application key (typically the filter name).protected void outputDevelopmentModeWarning()
If you really need to test Wicket in development mode on a staging server somewhere and are annoying the sysadmin for it with stderr messages, you can override this to make it do something else.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |