wicket
Class Application

java.lang.Object
  extended bywicket.Application
Direct Known Subclasses:
WebApplication

public abstract class Application
extends java.lang.Object

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:

Author:
Jonathan Locke
See Also:
WebApplication

Constructor Summary
Application()
          Constructor
 
Method Summary
 void addResourceFactory(java.lang.String name, IResourceFactory resourceFactory)
          Adds a resource factory to the list of factories to consult when generating resources automatically
 ApplicationSettings createApplicationSettings()
          Subclasses could override this to give there own implementation of ApplicationSettings.
static Application get()
          Get application for current session.
 java.util.List getComponentResolvers()
          Get the (modifiable) list of IComponentResolvers.
 IConverterFactory getConverterFactory()
          Gets the converter factory.
 Localizer getLocalizer()
           
 MarkupCache getMarkupCache()
          THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
 java.lang.String getName()
          Gets the name of this application.
 ApplicationPages getPages()
           
 java.util.Iterator getPageSets(Page page)
          THIS FEATURE IS CURRENTLY EXPERIMENTAL.
 IResourceFactory getResourceFactory(java.lang.String name)
           
 ResourceStreamLocator getResourceStreamLocator()
           
 ModificationWatcher getResourceWatcher()
           
protected abstract  ISessionFactory getSessionFactory()
           
 ApplicationSettings getSettings()
           
 SharedResources getSharedResources()
           
protected  void init()
          Allows for initialization of the application by a subclass.
protected  void internalInit()
          THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
 ICrypt newCrypt()
          Factory method that creates an instance of de-/encryption class.
 MarkupParser newMarkupParser(MarkupContainer container)
          Factory method that creates a markup parser.
protected  Page onRuntimeException(Page page, java.lang.RuntimeException e)
          Template method that is called when a runtime exception is thrown, just before the actual handling of the runtime exception.
(package private)  void resourceFinderChanged()
          Called by ApplicationSettings when source path property is changed.
static void set(Application application)
          THIS METHOD IS NOT PART OF THE WICKET PUBLIC API.
 void setLocalizer(Localizer localizer)
          Users may provide there own implementation of a localizer, e.g.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Application

public Application()
Constructor

Method Detail

get

public static Application get()
Get application for current session.

Returns:
The current application

set

public static void set(Application application)
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT.

Parameters:
application - The current application or null for this thread

addResourceFactory

public final void addResourceFactory(java.lang.String name,
                                     IResourceFactory resourceFactory)
Adds a resource factory to the list of factories to consult when generating resources automatically

Parameters:
name - The name to give to the factory
resourceFactory - The resource factory to add

getComponentResolvers

public final java.util.List getComponentResolvers()
Get the (modifiable) list of IComponentResolvers.

Returns:
List of ComponentResolvers
See Also:
for an example

getConverterFactory

public IConverterFactory getConverterFactory()
Gets the converter factory.

Returns:
the converter factory

getLocalizer

public final Localizer getLocalizer()
Returns:
The application wide localizer instance

setLocalizer

public final void setLocalizer(Localizer localizer)
Users may provide there own implementation of a localizer, e.g. one which uses Spring's MessageSource.

Parameters:
localizer -

getMarkupCache

public final MarkupCache getMarkupCache()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT USE IT.

Returns:
Returns the markup cache associated with the application

getName

public final java.lang.String getName()
Gets the name of this application.

Returns:
The application name.

getPages

public final ApplicationPages getPages()
Returns:
Application's common pages

getPageSets

public final java.util.Iterator getPageSets(Page page)
THIS FEATURE IS CURRENTLY EXPERIMENTAL. DO NOT USE THIS METHOD.

Parameters:
page - The Page for which a list of PageSets should be retrieved
Returns:
Sequence of PageSets for a given Page

getResourceFactory

public final IResourceFactory getResourceFactory(java.lang.String name)
Parameters:
name - Name of the factory to get
Returns:
The IResourceFactory with the given name.

getResourceStreamLocator

public ResourceStreamLocator getResourceStreamLocator()
Returns:
Resource locator for this application

getResourceWatcher

public final ModificationWatcher getResourceWatcher()
Returns:
Resource watcher with polling frequency determined by setting, or null if no polling frequency has been set.

getSettings

public ApplicationSettings getSettings()
Returns:
Application settings

createApplicationSettings

public ApplicationSettings createApplicationSettings()
Subclasses could override this to give there own implementation of ApplicationSettings. DO NOT CALL THIS METHOD YOURSELF. Use getSettings instead.

Returns:
An instanceof an ApplicationSettings class.

getSharedResources

public final SharedResources getSharedResources()
Returns:
Returns the sharedResources.

newCrypt

public ICrypt newCrypt()
Factory method that creates an instance of de-/encryption class. NOTE: this implementation caches the crypt instance, so it has to be Threadsafe. If you want other behaviour, or want to provide a custom crypt class, you should override this method.

Returns:
Instance of de-/encryption class

newMarkupParser

public MarkupParser newMarkupParser(MarkupContainer container)
Factory method that creates a markup parser.

Parameters:
container - The wicket container requesting the markup
Returns:
A new MarkupParser

getSessionFactory

protected abstract ISessionFactory getSessionFactory()
Returns:
Factory for creating sessions

init

protected void init()
Allows for initialization of the application by a subclass.


onRuntimeException

protected Page onRuntimeException(Page page,
                                  java.lang.RuntimeException e)
Template method that is called when a runtime exception is thrown, just before the actual handling of the runtime exception.

Parameters:
page - Any page context where the exception was thrown
e - The exception
Returns:
Any error page to redirect to

internalInit

protected void internalInit()
THIS METHOD IS NOT PART OF THE WICKET PUBLIC API. DO NOT OVERRIDE OR CALL. Internal intialization.


resourceFinderChanged

final void resourceFinderChanged()
Called by ApplicationSettings when source path property is changed. This method sets the resourceStreamLocator to null so it will get recreated the next time it is accessed using the new source path.



Copyright © 2004-2006 Wicket developers. All Rights Reserved.