org.apache.wicket.markup.html
Class WebPage

java.lang.Object
  extended by org.apache.wicket.Component
      extended by org.apache.wicket.MarkupContainer
          extended by org.apache.wicket.Page
              extended by org.apache.wicket.markup.html.WebPage
All Implemented Interfaces:
Serializable, IClusterable, IConverterLocator, IRedirectListener, IRequestListener, INewBrowserWindowListener, IPageMapEntry
Direct Known Subclasses:
AccessDeniedPage, BodyFrame, BookmarkablePage, BrowserInfoPage, DevUtilsPage, DummyHomePage, DummyPanelPage, EditPage, ExceptionErrorPage, HeaderPage, Home, Home, Home, Index, InternalErrorPage, LeftFrame, MenuPage, ModalContent1Page, ModalContent2Page, NonBookmarkablePage, Page1, Page2, PageExpiredErrorPage, PopupCloseLink.ClosePopupPage, RedirectPage, ResourceTestPage, SignInPage, SignOutPage, SourcesPage, StatefulPage, StatelessPage, StatelessPage1, StatelessPage2, StatelessPage3, WicketExamplePage, XmlPage

public class WebPage
extends Page
implements INewBrowserWindowListener

Base class for HTML pages. This subclass of Page simply returns HTML when asked for its markup type. It also has a method which subclasses can use to retrieve a bookmarkable link to the application's home page.

WebPages can be constructed with any constructor when they are being used in a Wicket session, but if you wish to link to a Page using a URL that is "bookmarkable" (which implies that the URL will not have any session information encoded in it, and that you can call this page directly without having a session first directly from your browser), you need to implement your Page with a no-arg constructor or with a constructor that accepts a PageParameters argument (which wraps any query string parameters for a request). In case the page has both constructors, the constructor with PageParameters will be used.

Author:
Jonathan Locke, Eelco Hillenius, Juergen Donnerstag, Gwyn Evans
See Also:
Serialized Form

Nested Class Summary
 
Nested classes/interfaces inherited from class org.apache.wicket.Page
Page.IPageSerializer
 
Nested classes/interfaces inherited from class org.apache.wicket.Component
Component.ComponentModelChange, Component.EnabledChange, Component.IVisitor<T extends Component>, Component.VisibilityChange
 
Field Summary
 
Fields inherited from class org.apache.wicket.Page
LATEST_VERSION, serializer
 
Fields inherited from class org.apache.wicket.Component
ENABLE, FLAG_CONFIGURED, FLAG_INITIALIZED, FLAG_REMOVING_FROM_HIERARCHY, FLAG_RESERVED1, FLAG_RESERVED2, FLAG_RESERVED3, FLAG_RESERVED4, FLAG_RESERVED5, FLAG_RESERVED6, FLAG_RESERVED7, FLAG_RESERVED8, PARENT_PATH, PATH_SEPARATOR, RENDER
 
Fields inherited from interface org.apache.wicket.markup.html.INewBrowserWindowListener
INTERFACE
 
Fields inherited from interface org.apache.wicket.IRedirectListener
INTERFACE
 
Constructor Summary
protected WebPage()
          Constructor.
protected WebPage(IModel<?> model)
           
protected WebPage(IPageMap pageMap)
           
protected WebPage(IPageMap pageMap, IModel<?> model)
           
protected WebPage(IPageMap pageMap, PageParameters parameters)
          Constructor which receives wrapped query string parameters for a request.
protected WebPage(PageParameters parameters)
          Constructor which receives wrapped query string parameters for a request.
 
Method Summary
protected  void configureResponse()
          Set-up response with appropriate content type, locale and encoding.
 String getMarkupType()
          Gets the markup type for a WebPage, which is "html" by default.
 UrlCompressor getUrlCompressor()
          This method is called when the compressing coding and response strategies are configured in your Application object like this:
protected  WebRequestCycle getWebRequestCycle()
           
protected  BookmarkablePageLink<?> homePageLink(String id)
          Creates and returns a bookmarkable link to this application's home page.
protected  void onAfterRender()
          Called just after a component is rendered.
 void onNewBrowserWindow()
          Called when a new browser window is detected.
protected  void setHeaders(WebResponse response)
          Subclasses can override this to set there headers when the Page is being served.
 
Methods inherited from class org.apache.wicket.Page
afterCallComponent, beforeCallComponent, componentChanged, componentRendered, detachModels, dirty, endComponentRender, expireOldestVersion, getAjaxVersionNumber, getAutoIndex, getAutoIndex2, getCurrentVersionNumber, getId, getNumericId, getPageClass, getPageId, getPageMap, getPageMapEntry, getPageMapName, getPageParameters, getPageReference, getSizeInBytes, getStatelessHint, getVersion, getVersions, hierarchyAsString, ignoreVersionMerge, internalOnModelChanged, isBookmarkable, isErrorPage, isPageStateless, moveToPageMap, newVersionManager, onBeforeRender, onDetach, onPageAttached, onRedirect, onRender, prepareForRender, removePersistedFormData, renderPage, rollbackPage, setNumericId, setStatelessHint, startComponentRender, toString, writeReplace
 
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, autoAdd, contains, findMarkupStream, get, get, getAssociatedMarkupStream, getMarkupStream, hasAssociatedMarkup, internalAdd, isTransparentResolver, iterator, iterator, newMarkupResourceStream, onAfterRenderChildren, onComponentTagBody, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderComponentTagBody, renderNext, replace, setDefaultModel, setMarkupStream, size, swap, toString, visitChildren, visitChildren
 
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, callOnBeforeRenderIfNotVisible, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, configure, continueToOriginalDestination, debug, detach, detachBehaviors, detachModel, determineVisibility, error, exceptionMessage, fatal, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviors, getBehaviors, getBehaviorsRawList, getClassRelativePath, getComponentBorder, getConverter, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessage, getFlag, getFlag, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdImpl, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getResponse, getSession, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalAttach, internalDetach, internalOnAttach, internalOnDetach, isActionAuthorized, isAncestorOf, isAttached, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, locateMarkupStream, markAttached, markRendering, modelChanged, modelChanging, onAttach, onBeginRequest, onComponentTag, onConfigure, onEndRequest, onInitialize, onModelChanged, onModelChanging, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, render, renderComponent, renderComponent, renderComponentTag, rendered, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, setAuto, setComponentBorder, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setFlag, setIgnoreAttributeModifier, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setRedirect, setRenderBodyOnly, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, urlFor, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, warn, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.apache.wicket.session.pagemap.IPageMapEntry
getPage
 

Constructor Detail

WebPage

protected WebPage()
Constructor. Having this constructor public means that your page is 'bookmarkable' and hence can be called/ created from anywhere.


WebPage

protected WebPage(IModel<?> model)
See Also:
Page.Page(IModel)

WebPage

protected WebPage(IPageMap pageMap)
See Also:
Page.Page(org.apache.wicket.IPageMap)

WebPage

protected WebPage(IPageMap pageMap,
                  IModel<?> model)
See Also:
Page.Page(org.apache.wicket.IPageMap, org.apache.wicket.model.IModel)

WebPage

protected WebPage(PageParameters parameters)
Constructor which receives wrapped query string parameters for a request. Having this constructor public means that your page is 'bookmarkable' and hence can be called/ created from anywhere. For bookmarkable pages (as opposed to when you construct page instances yourself, this constructor will be used in preference to a no-arg constructor, if both exist. Note that nothing is done with the page parameters argument. This constructor is provided so that tools such as IDEs will include it their list of suggested constructors for derived classes. Please call this constructor (or the one with the pagemap) if you want to remember the pageparameters Page.getPageParameters(). So that they are reused for stateless links.

Parameters:
parameters - Wrapped query string parameters.

WebPage

protected WebPage(IPageMap pageMap,
                  PageParameters parameters)
Constructor which receives wrapped query string parameters for a request. Having this constructor public means that your page is 'bookmarkable' and hence can be called/ created from anywhere. For bookmarkable pages (as opposed to when you construct page instances yourself, this constructor will be used in preference to a no-arg constructor, if both exist. Note that nothing is done with the page parameters argument. This constructor is provided so that tools such as IDEs will include it their list of suggested constructors for derived classes. Please call this constructor (or the one without the pagemap) if you want to remember the pageparameters Page.getPageParameters(). So that they are reused for stateless links.

Parameters:
pageMap - The pagemap where the webpage needs to be constructed in.
parameters - Wrapped query string parameters.
Method Detail

getMarkupType

public String getMarkupType()
Gets the markup type for a WebPage, which is "html" by default. Support for pages in another markup language, such as VXML, would require the creation of a different Page subclass in an appropriate package under org.apache.wicket.markup. To support VXML (voice markup), one might create the package org.apache.wicket.markup.vxml and a subclass of Page called VoicePage.

Overrides:
getMarkupType in class Page
Returns:
Markup type for HTML

getUrlCompressor

public final UrlCompressor getUrlCompressor()
This method is called when the compressing coding and response strategies are configured in your Application object like this:
 protected IRequestCycleProcessor newRequestCycleProcessor()
 {
        return new UrlCompressingWebRequestProcessor();
 }
 

Returns:
The URLCompressor for this webpage.
Since:
1.2
See Also:
UrlCompressingWebRequestProcessor, UrlCompressor

onNewBrowserWindow

public void onNewBrowserWindow()
Description copied from interface: INewBrowserWindowListener
Called when a new browser window is detected.

Specified by:
onNewBrowserWindow in interface INewBrowserWindowListener
See Also:
INewBrowserWindowListener.onNewBrowserWindow()

configureResponse

protected void configureResponse()
Description copied from class: Page
Set-up response with appropriate content type, locale and encoding. The locale is set equal to the session's locale. The content type header contains information about the markup type (@see #getMarkupType()) and the encoding. The response (and request) encoding is determined by an application setting (@see ApplicationSettings#getResponseRequestEncoding()). In addition, if the page's markup contains a xml declaration like <?xml ... ?> an xml declaration with proper encoding information is written to the output as well, provided it is not disabled by an application setting (@see ApplicationSettings#getStripXmlDeclarationFromOutput()).

Note: Prior to Wicket 1.1 the output encoding was determined by the page's markup encoding. Because this caused uncertainties about the /request/ encoding, it has been changed in favor of the new, much safer, approach. Please see the Wiki for more details.

Overrides:
configureResponse in class Page
See Also:
Page.configureResponse()

setHeaders

protected void setHeaders(WebResponse response)
Subclasses can override this to set there headers when the Page is being served. By default 2 headers will be set
 response.setHeader("Pragma", "no-cache");
 response.setHeader("Cache-Control", "no-cache, max-age=0, must-revalidate");
 
So if a Page wants to control this or doesn't want to set this info it should override this method and don't call super.

Parameters:
response - The WebResponse where set(Date)Header can be called on.

getWebRequestCycle

protected final WebRequestCycle getWebRequestCycle()
Returns:
The WebRequestCycle for this WebPage.

homePageLink

protected final BookmarkablePageLink<?> homePageLink(String id)
Creates and returns a bookmarkable link to this application's home page.

Parameters:
id - Name of link
Returns:
Link to home page for this application

onAfterRender

protected void onAfterRender()
Description copied from class: Component
Called just after a component is rendered.

Overrides:
onAfterRender in class Component
See Also:
Component.onAfterRender()


Copyright © 2004-2011 Apache Software Foundation. All Rights Reserved.