|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.Application
public abstract class Application
Base class for all Wicket applications. To create a Wicket application, you generally should not directly subclass this class. Instead, you will want to subclass some subclass of Application, like WebApplication, which is appropriate for the protocol and markup type you are working with.
Application has the following interesting features / attributes:
ResourceReference
for more details.
Session
subclass you
must override ApplicationnewSession(Request, Response)
. For subclasses of
WebApplication
you will want to subclass WebSession
.
WebApplication
Field Summary | |
---|---|
static String |
CONFIGURATION
Configuration constant for the 2 types |
static String |
CONTEXTPATH
Configuration type constant for getting the context path out of the web.xml |
static String |
DEPLOYMENT
Configuration type constant for deployment |
static String |
DEVELOPMENT
Configuration type constant for development |
Constructor Summary | |
---|---|
Application()
Constructor. |
Method Summary | ||
---|---|---|
void |
addComponentInitializationListener(IComponentInitializationListener listener)
Adds a component initialization listener. |
|
void |
addComponentInstantiationListener(IComponentInstantiationListener listener)
Adds a component instantiation listener. |
|
void |
addComponentOnAfterRenderListener(IComponentOnAfterRenderListener listener)
Adds an IComponentOnAfterRenderListener . |
|
void |
addPostComponentOnBeforeRenderListener(IComponentOnBeforeRenderListener listener)
Adds an IComponentOnBeforeRenderListener . |
|
void |
addPreComponentOnBeforeRenderListener(IComponentOnBeforeRenderListener listener)
Adds an IComponentOnBeforeRenderListener . |
|
void |
addRenderHeadListener(IHeaderContributor listener)
Adds a listener that will be invoked for every header response |
|
void |
configure()
Configures application settings to good defaults. |
|
IHeaderResponse |
decorateHeaderResponse(IHeaderResponse response)
INTERNAL METHOD - You shouldn't need to call this. |
|
protected void |
destroy()
Deprecated. use onDestroy() instead |
|
static boolean |
exists()
Checks if the Application threadlocal is set in this thread |
|
void |
fireComponentInitializationListeners(Component component)
Fires registered IComponentInitializationListener s on the component |
|
static Application |
get()
Get Application for current thread. |
|
static Application |
get(String applicationKey)
Gets the Application based on the application key of that application. |
|
abstract String |
getApplicationKey()
Gets the unique key of this application within a given context (like a web application). |
|
static Set<String> |
getApplicationKeys()
Gets the keys of the currently registered Wicket applications for this web application. |
|
IApplicationSettings |
getApplicationSettings()
|
|
abstract String |
getConfigurationType()
Gets the configuration mode to use for configuring the app, either DEVELOPMENT or
DEPLOYMENT . |
|
IConverterLocator |
getConverterLocator()
|
|
IDebugSettings |
getDebugSettings()
|
|
IExceptionSettings |
getExceptionSettings()
|
|
IFrameworkSettings |
getFrameworkSettings()
|
|
abstract Class<? extends Page> |
getHomePage()
Application subclasses must specify a home page class by implementing this abstract method. |
|
IMarkupCache |
getMarkupCache()
Deprecated. please use IMarkupSettings.getMarkupCache() instead |
|
IMarkupSettings |
getMarkupSettings()
|
|
|
getMetaData(MetaDataKey<T> key)
Gets metadata for this application using the given key. |
|
String |
getName()
Gets the name of this application. |
|
IPageSettings |
getPageSettings()
|
|
protected Object |
getRequestCycleFactory()
Deprecated. replaced by newRequestCycle(Request, Response) |
|
IRequestCycleSettings |
getRequestCycleSettings()
|
|
IRequestLogger |
getRequestLogger()
Gets the RequestLogger . |
|
IRequestLoggerSettings |
getRequestLoggerSettings()
|
|
IResourceSettings |
getResourceSettings()
|
|
ISecuritySettings |
getSecuritySettings()
|
|
protected Object |
getSessionFactory()
Deprecated. replaced by newSession(Request, Response) |
|
ISessionSettings |
getSessionSettings()
|
|
ISessionStore |
getSessionStore()
Gets the facade object for working getting/ storing session instances. |
|
SharedResources |
getSharedResources()
Gets the shared resources. |
|
protected void |
init()
Allows for initialization of the application by a subclass. |
|
void |
initializeComponents()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
|
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 requestTarget)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
|
protected IConverterLocator |
newConverterLocator()
Creates and returns a new instance of IConverterLocator . |
|
RequestCycle |
newRequestCycle(Application application,
Request request,
Response response)
Deprecated. Applications wishing to provide custom request cycles should override method newRequestCycle(Request, Response) |
|
abstract RequestCycle |
newRequestCycle(Request request,
Response response)
Creates a new RequestCycle object. |
|
protected IRequestLogger |
newRequestLogger()
creates a new request logger when requests logging is enabled. |
|
abstract Session |
newSession(Request request,
Response response)
Creates a new session. |
|
protected abstract ISessionStore |
newSessionStore()
Creates a new session facade. |
|
void |
notifyRenderHeadListener(IHeaderResponse response)
INTERNAL |
|
protected void |
onDestroy()
Called when wicket servlet is destroyed. |
|
void |
removeComponentInstantiationListener(IComponentInstantiationListener listener)
Removes a component instantiation listener. |
|
void |
removeComponentOnAfterRenderListener(IComponentOnAfterRenderListener listener)
Removes an IComponentOnAfterRenderListener . |
|
void |
removePostComponentOnBeforeRenderListener(IComponentOnBeforeRenderListener listener)
Removes an IComponentOnBeforeRenderListener . |
|
void |
removePreComponentOnBeforeRenderListener(IComponentOnBeforeRenderListener listener)
Removes an IComponentOnBeforeRenderListener . |
|
void |
removeRenderHeadListener(IHeaderContributor listener)
|
|
static void |
set(Application application)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
|
void |
setHeaderResponseDecorator(IHeaderResponseDecorator headerResponseDecorator)
Sets an IHeaderResponseDecorator that you want your application to use to decorate
header responses. |
|
|
setMetaData(MetaDataKey<T> key,
Object object)
Sets the metadata for this application using the given key. |
|
static void |
unset()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String CONFIGURATION
public static final String CONTEXTPATH
public static final String DEPLOYMENT
public static final String DEVELOPMENT
Constructor Detail |
---|
public Application()
init()
for any configuration of your application instead of
overriding the constructor.
Method Detail |
---|
public static boolean exists()
Application
threadlocal is set in this thread
get()
can return the instance of application, false
otherwisepublic static Application get()
public static Application get(String applicationKey)
applicationKey
- The unique key of the application within a certain context (e.g. a web
application)
null
if application has not been foundpublic static Set<String> getApplicationKeys()
getApplicationKey()
. Never
null, but possibly emptypublic static void set(Application application)
application
- The current application or null for this threadpublic static void unset()
public final void addComponentInstantiationListener(IComponentInstantiationListener listener)
Note: wicket does not guarantee the execution order of added listeners
listener
- the listener to addpublic final void addComponentInitializationListener(IComponentInitializationListener listener)
Each added listener will be notified after Component's Component.onInitialize()
method has been executed.
Note: wicket does not guarantee the execution order of added listeners
listener
- the listener to addpublic final void fireComponentInitializationListeners(Component component)
IComponentInitializationListener
s on the component
component
- addComponentInitializationListener(IComponentInitializationListener)
public final void configure()
public abstract String getApplicationKey()
public IApplicationSettings getApplicationSettings()
IApplicationSettings
public abstract String getConfigurationType()
DEVELOPMENT
or
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 VALUE
public final IConverterLocator getConverterLocator()
public IDebugSettings getDebugSettings()
IDebugSettings
public IExceptionSettings getExceptionSettings()
IExceptionSettings
public IFrameworkSettings getFrameworkSettings()
IFrameworkSettings
public abstract Class<? extends Page> getHomePage()
@Deprecated public final IMarkupCache getMarkupCache()
IMarkupSettings.getMarkupCache()
instead
public IMarkupSettings getMarkupSettings()
IMarkupSettings
public final <T> T getMetaData(MetaDataKey<T> key)
T
- key
- The key for the data
MetaDataKey
public final String getName()
public IPageSettings getPageSettings()
IPageSettings
public IRequestCycleSettings getRequestCycleSettings()
IDebugSettings
public final IRequestLogger getRequestLogger()
RequestLogger
.
public IRequestLoggerSettings getRequestLoggerSettings()
IResourceSettings
public IResourceSettings getResourceSettings()
IResourceSettings
public ISecuritySettings getSecuritySettings()
ISecuritySettings
public ISessionSettings getSessionSettings()
ISessionSettings
public final ISessionStore getSessionStore()
public final SharedResources getSharedResources()
public final void initializeComponents()
public void logEventTarget(IRequestTarget target)
target
- public void logResponseTarget(IRequestTarget requestTarget)
requestTarget
- public abstract RequestCycle newRequestCycle(Request request, Response response)
request
- The requestresponse
- The response
@Deprecated public final RequestCycle newRequestCycle(Application application, Request request, Response response)
newRequestCycle(Request, Response)
application
- request
- response
-
UnsupportedOperationException
- alwayspublic abstract Session newSession(Request request, Response response)
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.
public final void removeComponentInstantiationListener(IComponentInstantiationListener listener)
listener
- the listener to removepublic final <T> void setMetaData(MetaDataKey<T> key, Object object)
MetaDataKey
.
T
- key
- The singleton key for the metadataobject
- The metadata object
IllegalArgumentException
MetaDataKey
@Deprecated protected final void destroy()
onDestroy()
instead
protected void onDestroy()
@Deprecated protected final Object getRequestCycleFactory()
newRequestCycle(Request, Response)
@Deprecated protected final Object getSessionFactory()
newSession(Request, Response)
protected void init()
protected void internalDestroy()
protected void internalInit()
protected IConverterLocator newConverterLocator()
IConverterLocator
.
IConverterLocator
instanceprotected IRequestLogger newRequestLogger()
protected abstract ISessionStore newSessionStore()
public final void addPreComponentOnBeforeRenderListener(IComponentOnBeforeRenderListener listener)
IComponentOnBeforeRenderListener
. This method should typically only be called
during application startup; it is not thread safe.
listener
- public final void removePreComponentOnBeforeRenderListener(IComponentOnBeforeRenderListener listener)
IComponentOnBeforeRenderListener
.
listener
- public final void addPostComponentOnBeforeRenderListener(IComponentOnBeforeRenderListener listener)
IComponentOnBeforeRenderListener
. This method should typically only be called
during application startup; it is not thread safe.
listener
- public final void removePostComponentOnBeforeRenderListener(IComponentOnBeforeRenderListener listener)
IComponentOnBeforeRenderListener
.
listener
- public final void addComponentOnAfterRenderListener(IComponentOnAfterRenderListener listener)
IComponentOnAfterRenderListener
. This method should typically only be called
during application startup; it is not thread safe.
listener
- public final void removeComponentOnAfterRenderListener(IComponentOnAfterRenderListener listener)
IComponentOnAfterRenderListener
.
listener
- public final void addRenderHeadListener(IHeaderContributor listener)
listener
- public void removeRenderHeadListener(IHeaderContributor listener)
listener
- public void notifyRenderHeadListener(IHeaderResponse response)
response
- public void setHeaderResponseDecorator(IHeaderResponseDecorator headerResponseDecorator)
IHeaderResponseDecorator
that you want your application to use to decorate
header responses.
headerResponseDecorator
- your custom decoratorpublic final IHeaderResponse decorateHeaderResponse(IHeaderResponse response)
IHeaderResponseDecorator
on the application.
response
- the response Wicket created
IHeaderResponseDecorator
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |