This documentation is for an old version of fiftyfive-wicket (2.0.9).


fiftyfive.wicket
Class FoundationApplication

java.lang.Object
  extended by org.apache.wicket.Application
      extended by org.apache.wicket.protocol.http.WebApplication
          extended by fiftyfive.wicket.FoundationApplication
Direct Known Subclasses:
FoundationSpringApplication

public abstract class FoundationApplication
extends WebApplication

Useful base class for Wicket applications that implements best practices for Wicket configuration.

Author:
Matt Brictson
See Also:
init()

Field Summary
 
Fields inherited from class org.apache.wicket.Application
CONFIGURATION, CONTEXTPATH, DEPLOYMENT, DEVELOPMENT
 
Constructor Summary
FoundationApplication()
           
 
Method Summary
 Date getStartupDate()
          Returns the date and time when this application was initialized by the Wicket framework.
 Duration getUptime()
          Returns the amount of time elapsed since this application was initialized by the Wicket framework.
 Version getVersion()
          Returns the version information for this application, including the version number and the date and time when it was compiled.
protected  void init()
          Initializes the application using best practices for Wicket application development and deployment.
protected  void initCleanMarkup()
          Turns off Wicket's non-standard markup and sets the default markup encoding to UTF-8.
protected  void initDebugInformation()
          Enables the AjaxServerAndClientTimeFilter so that the response and rendering time are automatically displayed in the browser status bar for every request.
protected  void initHtmlHotDeploy()
          Enables automatic reloading of HTML templates from your source code directory.
protected  void initRequestLogger()
          Enables Wicket's request logging facility if an SLF4J logger is configured for INFO with the category org.apache.wicket.protocol.http.RequestLogger.
protected  void initResources()
          Enables gzip and the last modified timestamp on resource URLs.
protected  void initVersionInformation()
          Loads the version information from the manifest of this web application.
 boolean isDevelopmentMode()
          Helper method that returns true if WebApplication.getConfigurationType() is equal to Application.DEVELOPMENT.
 
Methods inherited from class org.apache.wicket.protocol.http.WebApplication
addIgnoreMountPath, get, getApplicationKey, getConfigurationType, getDefaultRequestCycleFactory, getInitParameter, getRequestCycleProcessor, getResourceFinder, getServletContext, getSessionAttributePrefix, getSessionAttributePrefix, getWicketFilter, internalDestroy, internalInit, logEventTarget, logResponseTarget, mount, mount, mountBookmarkablePage, mountBookmarkablePage, mountSharedResource, newAjaxRequestTarget, newRequestCycle, newRequestCycleProcessor, newSession, newSession, newSession, newSessionStore, newWebRequest, newWebResponse, outputDevelopmentModeWarning, sessionDestroyed, setApplicationKey, setWicketFilter, unmount
 
Methods inherited from class org.apache.wicket.Application
addComponentInitializationListener, addComponentInstantiationListener, addComponentOnAfterRenderListener, addPostComponentOnBeforeRenderListener, addPreComponentOnBeforeRenderListener, addRenderHeadListener, configure, decorateHeaderResponse, destroy, exists, fireComponentInitializationListeners, get, getApplicationKeys, getApplicationSettings, getConverterLocator, getDebugSettings, getExceptionSettings, getFrameworkSettings, getHomePage, getMarkupCache, getMarkupSettings, getMetaData, getName, getPageSettings, getRequestCycleFactory, getRequestCycleSettings, getRequestLogger, getRequestLoggerSettings, getResourceSettings, getSecuritySettings, getSessionFactory, getSessionSettings, getSessionStore, getSharedResources, initializeComponents, newConverterLocator, newRequestCycle, newRequestLogger, notifyRenderHeadListener, onDestroy, removeComponentInstantiationListener, removeComponentOnAfterRenderListener, removePostComponentOnBeforeRenderListener, removePreComponentOnBeforeRenderListener, removeRenderHeadListener, set, setHeaderResponseDecorator, setMetaData, unset
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FoundationApplication

public FoundationApplication()
Method Detail

getVersion

public Version getVersion()
Returns the version information for this application, including the version number and the date and time when it was compiled.


getStartupDate

public Date getStartupDate()
Returns the date and time when this application was initialized by the Wicket framework.


getUptime

public Duration getUptime()
Returns the amount of time elapsed since this application was initialized by the Wicket framework.

Since:
2.0

isDevelopmentMode

public boolean isDevelopmentMode()
Helper method that returns true if WebApplication.getConfigurationType() is equal to Application.DEVELOPMENT.


init

protected void init()
Initializes the application using best practices for Wicket application development and deployment.
  1. Sets the startupDate property to the current time.
  2. Calls super.init().
  3. Executes the following regardless of configuration mode:
  4. Executes the following only if the application is in DEVELOPMENT mode:

Overrides:
init in class WebApplication

initHtmlHotDeploy

protected void initHtmlHotDeploy()
Enables automatic reloading of HTML templates from your source code directory. This means that whenever you modify an HTML file the changes will appear immediately in your browser without needing to redeploy. However you will still need to redeploy if you recompile a Java class.

This method assumes that you are running the webapp "in place"; for example using mvn jetty:run. It will not work if you are running from a WAR or exploded WAR.

You must also be using the standard maven project structure for your Wicket project, like so:

 pom.xml
 src/
   main/
     java/
     resources/
     webapp/

See Also:
http://docs.codehaus.org/display/JETTY/Maven+Jetty+Plugin

initCleanMarkup

protected void initCleanMarkup()
Turns off Wicket's non-standard markup and sets the default markup encoding to UTF-8. By default, Wicket will add markup to disabled links; for example, it may wrap them in an <em> element. We prefer to control the markup and don't want Wicket adding elements, so we turn this off. We also instruct Wicket to strip the wicket:id attributes and wicket: elements from the markup. This ensures that the markup will be valid (X)HTML.


initDebugInformation

protected void initDebugInformation()
Enables the AjaxServerAndClientTimeFilter so that the response and rendering time are automatically displayed in the browser status bar for every request. Disables ajaxDebugMode (the popup panel in the browser that shows ajax request and response details). It is disabled because it is a memory hog that can bog down the browser. Finally, enables emitting HTML comments that show which Wicket class created each section of HTML.


initVersionInformation

protected void initVersionInformation()
Loads the version information from the manifest of this web application. To access the version information, use getVersion().

See Also:
Version

initResources

protected void initResources()
Enables gzip and the last modified timestamp on resource URLs. These are resources you've added to your page via things like JavascriptPackageResource and CssPackageResource. Also set the cache duration for resources to zero if in development mode (discouraging browser cache), or 1 year if in deployment mode.


initRequestLogger

protected void initRequestLogger()
Enables Wicket's request logging facility if an SLF4J logger is configured for INFO with the category org.apache.wicket.protocol.http.RequestLogger. For example, if using log4j properties configuration, this would cause the Wicket request logger to be enabled:
 log4j.logger.org.apache.wicket.protocol.http.RequestLogger = INFO

Since:
2.0


Copyright © 2011 55 Minutes. All Rights Reserved.