Class WebPage

  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, Iterable<Component>, IEventSink, IEventSource, IConverterLocator, IRedirectListener, IRequestListener, IHeaderContributor, IManageablePage, IRequestableComponent, IRequestablePage, IHierarchical<Component>, IClusterable
Direct Known Subclasses:
AbstractErrorPage, BaseWicketTester.StartComponentInPage, BodyFrame, BookmarkablePage, BrowserInfoPage, DevUtilsPage, DiskStoreBrowserPage, DummyHomePage, DummyPanelPage, GenericWebPage, Home, HomePage, LeftFrame, MockHomePage, ModalContent1Page, ModalContent2Page, NonBookmarkablePage, Page1, Page2, PopupCloseLink.ClosePopupPage, RedirectPage, SignInPage, SignOutPage, SourcesPage, TemplateBasedOnPage, WicketExamplePage, XmlPage

public class WebPage
extends Page

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.

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

Field Summary
Fields inherited from class org.apache.wicket.Component
Fields inherited from interface org.apache.wicket.IRedirectListener
Constructor Summary
protected WebPage()
protected WebPage(IModel<?> model)
protected WebPage(PageParameters parameters)
          Constructor which receives wrapped query string parameters for a request.
Method Summary
protected  void configureResponse(WebResponse response)
          Set-up response with appropriate content type, locale and encoding.
 void dirty(boolean isInitialization)
          Prevents page from get dirty inside an AJAX request.
 MarkupType getMarkupType()
          Gets the markup type for a WebPage, which is "html" by default.
protected  BookmarkablePageLink<Void> 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.
protected  void onRender()
          Implementation that renders this component.
protected  void renderXmlDecl()
          The rules if and when to insert an xml decl in the response are a bit tricky.
protected  void reportMissingHead(CharSequence collectedHeaderOutput)
          Reports an error that there is no <head> and/or <body> in the page and there is no where to write the header response.
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
componentChanged, componentRendered, detachModels, dirty, endComponentRender, getAutoIndex, getId, getPageClass, getPageId, getPageParameters, getPageReference, getRenderCount, getSizeInBytes, getStatelessHint, hierarchyAsString, internalOnModelChanged, internalPrepareForRender, isBookmarkable, isErrorPage, isPageStateless, onBeforeRender, onDetach, onInitialize, onRedirect, renderPage, setFreezePageId, setNumericId, setStatelessHint, setWasCreatedBookmarkable, startComponentRender, toString, wasCreatedBookmarkable, wasRendered
Methods inherited from class org.apache.wicket.MarkupContainer
add, addOrReplace, autoAdd, contains, get, get, getAssociatedMarkup, getAssociatedMarkupStream, getMarkup, internalAdd, internalInitialize, iterator, iterator, onAfterRenderChildren, onComponentTagBody, remove, remove, removeAll, renderAll, renderAssociatedMarkup, renderNext, replace, setDefaultModel, size, swap, toString, visitChildren, visitChildren, visitChildren, visitChildren
Methods inherited from class org.apache.wicket.Component
add, addStateChange, afterRender, beforeRender, canCallListenerInterface, checkComponentTag, checkComponentTagAttribute, checkHierarchyChange, clearOriginalDestination, configure, continueToOriginalDestination, debug, detach, detachModel, determineVisibility, error, exceptionMessage, fatal, findMarkupStream, findPage, findParent, findParentWithAssociatedMarkup, getAjaxRegionMarkupId, getApplication, getBehaviorById, getBehaviorId, getBehaviors, getBehaviors, getClassRelativePath, getConverter, getDefaultModel, getDefaultModelObject, getDefaultModelObjectAsString, getDefaultModelObjectAsString, getEscapeModelStrings, getFeedbackMessages, getFlag, getInnermostModel, getInnermostModel, getLocale, getLocalizer, getMarkup, getMarkupAttributes, getMarkupId, getMarkupId, getMarkupIdFromMarkup, getMarkupIdImpl, getMarkupSourcingStrategy, getMetaData, getModelComparator, getOutputMarkupId, getOutputMarkupPlaceholderTag, getPage, getPageRelativePath, getParent, getPath, getRenderBodyOnly, getRequest, getRequestCycle, getRequestFlag, getResponse, getSession, getString, getString, getString, getStyle, getVariation, hasBeenRendered, hasErrorMessage, hasFeedbackMessage, info, initModel, internalRenderComponent, isActionAuthorized, isAuto, isBehaviorAccepted, isEnableAllowed, isEnabled, isEnabledInHierarchy, isIgnoreAttributeModifier, isRenderAllowed, isRendering, isStateless, isVersioned, isVisibilityAllowed, isVisible, isVisibleInHierarchy, markRendering, modelChanged, modelChanging, newMarkupSourcingStrategy, onComponentTag, onConfigure, onEvent, onModelChanged, onModelChanging, onReAdd, onRemove, prepareForRender, redirectToInterceptPage, remove, remove, render, renderComponentTag, rendered, renderHead, renderHead, renderHead, renderPlaceholderTag, replaceComponentTagBody, replaceWith, sameInnermostModel, sameInnermostModel, send, setAuto, setDefaultModelObject, setEnabled, setEscapeModelStrings, setFlag, setIgnoreAttributeModifier, setMarkup, setMarkupId, setMarkupIdImpl, setMetaData, setOutputMarkupId, setOutputMarkupPlaceholderTag, setParent, setRenderBodyOnly, setRequestFlag, setResponsePage, setResponsePage, setResponsePage, setVersioned, setVisibilityAllowed, setVisible, success, urlFor, urlFor, urlFor, urlFor, urlFor, visitParents, 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.request.component.IRequestableComponent
detach, get, getBehaviorById, getBehaviorId, getPage, getPageRelativePath
Methods inherited from interface

Constructor Detail


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


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


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 if you want to remember the pageparameters Page.getPageParameters(). So that they are reused for stateless links.

parameters - Wrapped query string parameters.
Method Detail


public MarkupType 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.

getMarkupType in class Page
Markup type for HTML
See Also:


protected void onRender()
Description copied from class: Component
Implementation that renders this component.

onRender in class Page
See Also:


protected void renderXmlDecl()
The rules if and when to insert an xml decl in the response are a bit tricky. Allow the user to replace the default per page and per application.


protected void configureResponse(WebResponse response)
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()). If null, no xml decl will be written.

response - The WebResponse object


protected void setHeaders(WebResponse response)
Subclasses can override this to set there headers when the Page is being served. By default these headers are set:
 response.setHeader("Date", "[now]");
 response.setHeader("Expires", "[0]");
 response.setHeader("Pragma", "no-cache");
 response.setHeader("Cache-Control", "no-cache");
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.

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


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

onAfterRender in class Page
See Also:


protected void reportMissingHead(CharSequence collectedHeaderOutput)
Reports an error that there is no <head> and/or <body> in the page and there is no where to write the header response.

collectedHeaderOutput - The collected response that should have been written to the <head>
See Also:


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

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


public final void dirty(boolean isInitialization)
Prevents page from get dirty inside an AJAX request.

dirty in class Page
isInitialization - a flag whether this is a page instantiation

Copyright © 2006–2018 Apache Software Foundation. All rights reserved.