|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.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 |
configure()
Configures application settings to good defaults. |
|
RequestCycle |
createRequestCycle(Request request,
Response response)
|
|
static boolean |
exists()
Checks if the Application threadlocal is set in this thread |
|
Session |
fetchCreateAndSetSession(RequestCycle requestCycle)
|
|
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()
|
|
ComponentInitializationListenerCollection |
getComponentInitializationListeners()
|
|
ComponentInstantiationListenerCollection |
getComponentInstantiationListeners()
|
|
ComponentOnAfterRenderListenerCollection |
getComponentOnAfterRenderListeners()
|
|
ComponentOnBeforeRenderListenerCollection |
getComponentPostOnBeforeRenderListeners()
|
|
ComponentOnBeforeRenderListenerCollection |
getComponentPreOnBeforeRenderListeners()
|
|
abstract String |
getConfigurationType()
Gets the configuration mode to use for configuring the app, either DEVELOPMENT or
DEPLOYMENT . |
|
IConverterLocator |
getConverterLocator()
|
|
IDebugSettings |
getDebugSettings()
|
|
IMapperContext |
getEncoderContext()
|
|
IExceptionSettings |
getExceptionSettings()
|
|
IFrameworkSettings |
getFrameworkSettings()
|
|
abstract Class<? extends Page> |
getHomePage()
Application subclasses must specify a home page class by implementing this abstract method. |
|
IMarkupSettings |
getMarkupSettings()
|
|
|
getMetaData(MetaDataKey<T> key)
Gets metadata for this application using the given key. |
|
String |
getMimeType(String fileName)
Returns the mime type for given filename. |
|
String |
getName()
Gets the name of this application. |
|
IPageFactory |
getPageFactory()
Returns IPageFactory for this application. |
|
IPageManager |
getPageManager()
|
|
protected IPageManagerContext |
getPageManagerContext()
|
|
IPageManagerProvider |
getPageManagerProvider()
|
|
IPageRendererProvider |
getPageRendererProvider()
|
|
IPageSettings |
getPageSettings()
|
|
RequestCycleListenerCollection |
getRequestCycleListeners()
|
|
IRequestCycleProvider |
getRequestCycleProvider()
|
|
IRequestCycleSettings |
getRequestCycleSettings()
|
|
IRequestLogger |
getRequestLogger()
Gets the IRequestLogger . |
|
IRequestLoggerSettings |
getRequestLoggerSettings()
|
|
ResourceReferenceRegistry |
getResourceReferenceRegistry()
Returns ResourceReferenceRegistry for this application. |
|
IResourceSettings |
getResourceSettings()
|
|
IRequestMapper |
getRootRequestMapper()
|
|
ICompoundRequestMapper |
getRootRequestMapperAsCompound()
Converts the root mapper to a ICompoundRequestMapper if necessary and returns the
converted instance. |
|
ISecuritySettings |
getSecuritySettings()
|
|
ISessionSettings |
getSessionSettings()
|
|
ISessionStore |
getSessionStore()
Gets the facade object for working getting/ storing session instances. |
|
IProvider<ISessionStore> |
getSessionStoreProvider()
|
|
SharedResources |
getSharedResources()
|
|
protected void |
init()
Allows for initialization of the application by a subclass. |
|
void |
initApplication()
Initialize the application |
|
void |
initializeComponents()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
|
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(IRequestHandler target)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
|
void |
logResponseTarget(IRequestHandler requestTarget)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. |
|
protected IConverterLocator |
newConverterLocator()
Creates and returns a new instance of IConverterLocator . |
|
protected IExceptionMapper |
newExceptionMapper()
|
|
protected IPageFactory |
newPageFactory()
Override to create custom IPageFactory |
|
protected IRequestLogger |
newRequestLogger()
creates a new request logger when requests logging is enabled. |
|
protected ResourceReferenceRegistry |
newResourceReferenceRegistry()
Override to create custom ResourceReferenceRegistry . |
|
abstract Session |
newSession(Request request,
Response response)
Creates a new session. |
|
protected SharedResources |
newSharedResources(ResourceReferenceRegistry registry)
|
|
protected void |
onDestroy()
Called when wicket servlet is destroyed. |
|
void |
onEvent(IEvent<?> event)
Called when an event is sent to this sink |
|
void |
sessionUnbound(String sessionId)
Informs the listener that session with specific id has been unbound. |
|
|
setMetaData(MetaDataKey<T> key,
Object object)
Sets the metadata for this application using the given key. |
|
void |
setName(String name)
Sets application name. |
|
void |
setPageManagerProvider(IPageManagerProvider provider)
|
|
void |
setPageRendererProvider(IPageRendererProvider pageRendererProvider)
|
|
void |
setRequestCycleProvider(IRequestCycleProvider requestCycleProvider)
|
|
void |
setRootRequestMapper(IRequestMapper rootRequestMapper)
Sets the root request mapper |
|
void |
setSessionStoreProvider(IProvider<ISessionStore> sessionStoreProvider)
|
|
protected void |
validateInit()
Gives the Application object a chance to validate if it has been properly initialized |
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 final ComponentInstantiationListenerCollection getComponentInstantiationListeners()
public final ComponentInitializationListenerCollection getComponentInitializationListeners()
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()
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()
IRequestLogger
.
public IRequestLoggerSettings getRequestLoggerSettings()
IResourceSettings
public IResourceSettings getResourceSettings()
IResourceSettings
public ISecuritySettings getSecuritySettings()
ISecuritySettings
public ISessionSettings getSessionSettings()
ISessionSettings
public final ISessionStore getSessionStore()
public void sessionUnbound(String sessionId)
ISessionStore.UnboundListener
sessionUnbound
in interface ISessionStore.UnboundListener
public final void initializeComponents()
public void logEventTarget(IRequestHandler target)
target
- public void logResponseTarget(IRequestHandler requestTarget)
requestTarget
- public 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 <T> void setMetaData(MetaDataKey<T> key, Object object)
MetaDataKey
.
T
- key
- The singleton key for the metadataobject
- The metadata object
IllegalArgumentException
MetaDataKey
protected void onDestroy()
protected void init()
public void internalDestroy()
protected void internalInit()
public final IProvider<ISessionStore> getSessionStoreProvider()
public final void setSessionStoreProvider(IProvider<ISessionStore> sessionStoreProvider)
protected IConverterLocator newConverterLocator()
IConverterLocator
.
IConverterLocator
instanceprotected IRequestLogger newRequestLogger()
public final ComponentOnBeforeRenderListenerCollection getComponentPreOnBeforeRenderListeners()
public final ComponentOnBeforeRenderListenerCollection getComponentPostOnBeforeRenderListeners()
public final ComponentOnAfterRenderListenerCollection getComponentOnAfterRenderListeners()
public RequestCycleListenerCollection getRequestCycleListeners()
IRequestCycleListener
s in this applicationpublic final ICompoundRequestMapper getRootRequestMapperAsCompound()
ICompoundRequestMapper
if necessary and returns the
converted instance.
public final IRequestMapper getRootRequestMapper()
public final void setRootRequestMapper(IRequestMapper rootRequestMapper)
rootRequestMapper
- public final IPageManagerProvider getPageManagerProvider()
public final void setPageManagerProvider(IPageManagerProvider provider)
public final IPageManager getPageManager()
protected IPageManagerContext getPageManagerContext()
public final IPageRendererProvider getPageRendererProvider()
public final void setPageRendererProvider(IPageRendererProvider pageRendererProvider)
protected ResourceReferenceRegistry newResourceReferenceRegistry()
ResourceReferenceRegistry
.
ResourceReferenceRegistry
instance.public final ResourceReferenceRegistry getResourceReferenceRegistry()
ResourceReferenceRegistry
for this application.
protected SharedResources newSharedResources(ResourceReferenceRegistry registry)
public SharedResources getSharedResources()
protected IPageFactory newPageFactory()
IPageFactory
IPageFactory
instance.public final IPageFactory getPageFactory()
IPageFactory
for this application.
public final IMapperContext getEncoderContext()
public Session fetchCreateAndSetSession(RequestCycle requestCycle)
public IRequestCycleProvider getRequestCycleProvider()
public void setRequestCycleProvider(IRequestCycleProvider requestCycleProvider)
public final RequestCycle createRequestCycle(Request request, Response response)
protected IExceptionMapper newExceptionMapper()
public final void initApplication()
protected void validateInit()
public final void setName(String name)
name
- unique application namepublic String getMimeType(String fileName)
fileName
-
public void onEvent(IEvent<?> event)
onEvent
in interface IEventSink
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |