org.apache.wicket.request.target.component
Class BookmarkablePageRequestTarget

java.lang.Object
  extended by org.apache.wicket.request.target.component.BookmarkablePageRequestTarget
All Implemented Interfaces:
IRequestTarget, IBookmarkablePageRequestTarget, IEventProcessor
Direct Known Subclasses:
BookmarkableListenerInterfaceRequestTarget, CapturingBookmarkablePageRequestTarget, ExpiredPageClassRequestTarget, HybridUrlCodingStrategy.HybridBookmarkablePageRequestTarget

public class BookmarkablePageRequestTarget
extends Object
implements IBookmarkablePageRequestTarget

Default implementation of IBookmarkablePageRequestTarget. Target that denotes a page that is to be created from the provided page class. This is typically used for redirects to bookmarkable pages or mounted pages.

We cannot issue redirects even with IRequestCycleSettings.REDIRECT_TO_RENDER because the url has to be bookmarkable, eg user actually being able to bookmark it in the browser. if we always redirected to a stateful url (e.g. /?wicket:interface=:0::::)that wouldn't work, as it wouldn't be bookmarkable.

Author:
Eelco Hillenius, Igor Vaynberg (ivaynberg)

Constructor Summary
BookmarkablePageRequestTarget(Class<C> pageClass)
          Construct.
BookmarkablePageRequestTarget(Class<C> pageClass, PageParameters pageParameters)
          Construct.
BookmarkablePageRequestTarget(String pageMapName, Class<C> pageClass)
          Construct.
BookmarkablePageRequestTarget(String pageMapName, Class<C> pageClass, PageParameters pageParameters)
          Construct.
 
Method Summary
 void detach(RequestCycle requestCycle)
          This method is called at the end of a request cycle to indicate that processing is done and that cleaning up of the subject(s) of this target may be done.
 boolean equals(Object obj)
           
 Page getPage()
           
protected  Page getPage(RequestCycle requestCycle)
          Gets a newly constructed page if we are not in a redirect.
 Class<? extends Page> getPageClass()
          Gets the page class.
 String getPageMapName()
          Gets the optional page map name.
 PageParameters getPageParameters()
          Gets the optional page parameters.
 int hashCode()
           
protected
<C extends Page>
Page
newPage(Class<C> pageClass, RequestCycle requestCycle)
          Constructs a new instance of a page given its class name
 void processEvents(RequestCycle requestCycle)
          After a page is restored, this method is responsible for calling any event handling code based on the request.
 void respond(RequestCycle requestCycle)
          Generates a response.
protected  void setPage(Page page)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

BookmarkablePageRequestTarget

public BookmarkablePageRequestTarget(Class<C> pageClass)
Construct.

Type Parameters:
C -
Parameters:
pageClass - the class of the page

BookmarkablePageRequestTarget

public BookmarkablePageRequestTarget(Class<C> pageClass,
                                     PageParameters pageParameters)
Construct.

Type Parameters:
C -
Parameters:
pageClass - the class of the page
pageParameters - optional page parameters

BookmarkablePageRequestTarget

public BookmarkablePageRequestTarget(String pageMapName,
                                     Class<C> pageClass)
Construct.

Type Parameters:
C -
Parameters:
pageMapName - optional page map name
pageClass - the class of the page

BookmarkablePageRequestTarget

public BookmarkablePageRequestTarget(String pageMapName,
                                     Class<C> pageClass,
                                     PageParameters pageParameters)
Construct.

Type Parameters:
C - type of page
Parameters:
pageMapName - optional page map name
pageClass - the class of the page
pageParameters - optional page parameters
Method Detail

detach

public void detach(RequestCycle requestCycle)
Description copied from interface: IRequestTarget
This method is called at the end of a request cycle to indicate that processing is done and that cleaning up of the subject(s) of this target may be done.

Specified by:
detach in interface IRequestTarget
Parameters:
requestCycle - the current request cycle
See Also:
IRequestTarget.detach(org.apache.wicket.RequestCycle)

equals

public boolean equals(Object obj)
Overrides:
equals in class Object
See Also:
Object.equals(java.lang.Object)

getPage

public final Page getPage()
Returns:
The page that was created, null if the response did not happen yet

setPage

protected final void setPage(Page page)

getPageClass

public final Class<? extends Page> getPageClass()
Description copied from interface: IBookmarkablePageRequestTarget
Gets the page class.

Specified by:
getPageClass in interface IBookmarkablePageRequestTarget
Returns:
the page class
See Also:
IBookmarkablePageRequestTarget.getPageClass()

getPageMapName

public final String getPageMapName()
Description copied from interface: IBookmarkablePageRequestTarget
Gets the optional page map name.

Specified by:
getPageMapName in interface IBookmarkablePageRequestTarget
Returns:
the optional page map name
See Also:
IBookmarkablePageRequestTarget.getPageMapName()

getPageParameters

public final PageParameters getPageParameters()
Description copied from interface: IBookmarkablePageRequestTarget
Gets the optional page parameters.

Specified by:
getPageParameters in interface IBookmarkablePageRequestTarget
Returns:
the page parameters or null
See Also:
IBookmarkablePageRequestTarget.getPageParameters()

hashCode

public int hashCode()
Overrides:
hashCode in class Object
See Also:
Object.hashCode()

processEvents

public void processEvents(RequestCycle requestCycle)
Description copied from interface: IEventProcessor
After a page is restored, this method is responsible for calling any event handling code based on the request.

Specified by:
processEvents in interface IEventProcessor
Parameters:
requestCycle - the current request cycle

respond

public void respond(RequestCycle requestCycle)
Description copied from interface: IRequestTarget
Generates a response.

Specified by:
respond in interface IRequestTarget
Parameters:
requestCycle - the current request cycle

toString

public String toString()
Overrides:
toString in class Object
See Also:
Object.toString()

newPage

protected <C extends Page> Page newPage(Class<C> pageClass,
                                        RequestCycle requestCycle)
Constructs a new instance of a page given its class name

Type Parameters:
C - type of page
Parameters:
pageClass - class name of the page to be created
requestCycle - request cycle
Returns:
new instance of page

getPage

protected final Page getPage(RequestCycle requestCycle)
Gets a newly constructed page if we are not in a redirect.

Parameters:
requestCycle - the request cycle
Returns:
the page


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