wicket
Class ApplicationPages

java.lang.Object
  extended bywicket.ApplicationPages

public class ApplicationPages
extends java.lang.Object

Holder for specifying Wicket page classes that have special meaning to an application, such as an application's home page and any error display pages.

homePage (required, no default) - You must set this property to the bookmarkable page that you want the framework to respond with when no path information is specified.

internalErrorPage - You can override this with your own page class to display internal errors in a different way.

pageExpiredErrorPage - You can override this with your own bookmarkable page class to display expired page errors in a different way. You can set property homePageRenderStrategy to choose from different ways the home page url shows up in your browser.

You can register aliases for bookmarkable pages by calling putClassAlias; this way you can point to bookmarkable pages with logical names instead of full class names.

Author:
Jonathan Locke, Johan Compagner, Eelco Hillenius

Nested Class Summary
static class ApplicationPages.HomePageRenderStrategy
          Enumerated type for different ways of handling the rendering/ redirecting of the homepage.
 
Field Summary
static ApplicationPages.HomePageRenderStrategy BOOKMARK_REDIRECT
          Use this homepage strategy if you want to redirect the homepage to a bookmarkable url like: bookmarkablePage=mybookmarkablepage This is the same as calling: setResponsePage(MyPage.class);.
static ApplicationPages.HomePageRenderStrategy NO_REDIRECT
          Use this homepage strategy if you don't want to redirect so the url just stays '/' .
static ApplicationPages.HomePageRenderStrategy PAGE_REDIRECT
          Use this homepage strategy if you want to redirect the homepage just as a normal page would be in wicket (when you submit a form on the page or when you do in the code: setResponsePage(new MyPage()); If you have set the overall Redirect Strategy to ONE_PASS_RENDER then the homepage response will honor that.
 
Constructor Summary
ApplicationPages()
           
 
Method Summary
 java.lang.String aliasForClass(java.lang.Class pageClass)
          Returns the alias for the given page class or null if no alias was found.
 java.lang.Class classForAlias(java.lang.String alias)
          Returns the page class for the given alias or null if the alias is not mapped.
 java.lang.Class getHomePage()
          Gets home page class.
 ApplicationPages.HomePageRenderStrategy getHomePageRenderStrategy()
          Gets home page redirect strategy.
 java.lang.Class getInternalErrorPage()
          Gets internal error page class.
 java.lang.Class getPageExpiredErrorPage()
          Gets the page expired page class.
 void putClassAlias(java.lang.Class pageClass, java.lang.String alias)
          Use this method to add logical names to your bookmarkable pages.
 ApplicationPages setHomePage(java.lang.Class homePage)
          Sets home page class.
 ApplicationPages setHomePageRenderStrategy(ApplicationPages.HomePageRenderStrategy homePageStrategy)
          Sets home page strategy.
 ApplicationPages setInternalErrorPage(java.lang.Class internalErrorPage)
          Sets internal error page class.
 ApplicationPages setPageExpiredErrorPage(java.lang.Class pageExpiredErrorPage)
          Sets the page expired page class.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_REDIRECT

public static final ApplicationPages.HomePageRenderStrategy NO_REDIRECT
Use this homepage strategy if you don't want to redirect so the url just stays '/' .


BOOKMARK_REDIRECT

public static final ApplicationPages.HomePageRenderStrategy BOOKMARK_REDIRECT
Use this homepage strategy if you want to redirect the homepage to a bookmarkable url like: bookmarkablePage=mybookmarkablepage This is the same as calling: setResponsePage(MyPage.class);.


PAGE_REDIRECT

public static final ApplicationPages.HomePageRenderStrategy PAGE_REDIRECT
Use this homepage strategy if you want to redirect the homepage just as a normal page would be in wicket (when you submit a form on the page or when you do in the code: setResponsePage(new MyPage()); If you have set the overall Redirect Strategy to ONE_PASS_RENDER then the homepage response will honor that. Then it is the same as setting the homepage strategy to NO_REDIRECT. This one is the default used by wicket.

Constructor Detail

ApplicationPages

public ApplicationPages()
Method Detail

getHomePage

public final java.lang.Class getHomePage()
Gets home page class.

Returns:
Returns the homePage.
See Also:
setHomePage(Class)

getHomePageRenderStrategy

public final ApplicationPages.HomePageRenderStrategy getHomePageRenderStrategy()
Gets home page redirect strategy.

Returns:
Returns the homePage.
See Also:
ApplicationPages#setHomePageRenderStrategy(HomePageRenderStrategy)

getInternalErrorPage

public final java.lang.Class getInternalErrorPage()
Gets internal error page class.

Returns:
Returns the internalErrorPage.
See Also:
setInternalErrorPage(Class)

getPageExpiredErrorPage

public final java.lang.Class getPageExpiredErrorPage()
Gets the page expired page class.

Returns:
Returns the pageExpiredErrorPage.
See Also:
setPageExpiredErrorPage(Class)

setHomePage

public final ApplicationPages setHomePage(java.lang.Class homePage)
Sets home page class. The class must be bookmarkable and must extend Page.

Parameters:
homePage - The home page class
Returns:
This

setHomePageRenderStrategy

public final ApplicationPages setHomePageRenderStrategy(ApplicationPages.HomePageRenderStrategy homePageStrategy)
Sets home page strategy. Set one of the ApplicationPages.NO_REDIRECT, ApplicationPages.BOOKMARK_REDIRECT or ApplicationPages.PAGE_REDIRECT

Parameters:
homePageStrategy - The homepage redirect strategy that has to be used
Returns:
This

setInternalErrorPage

public final ApplicationPages setInternalErrorPage(java.lang.Class internalErrorPage)
Sets internal error page class. The class must be bookmarkable and must extend Page.

Parameters:
internalErrorPage - The internalErrorPage to set.
Returns:
This

setPageExpiredErrorPage

public final ApplicationPages setPageExpiredErrorPage(java.lang.Class pageExpiredErrorPage)
Sets the page expired page class. The class must be bookmarkable and must extend Page.

Parameters:
pageExpiredErrorPage - The pageExpiredErrorPage to set.
Returns:
This

aliasForClass

public final java.lang.String aliasForClass(java.lang.Class pageClass)
Returns the alias for the given page class or null if no alias was found. Returns null when argument pageClass is null.

Parameters:
pageClass - The class to get the alias for
Returns:
the alias of the page class

classForAlias

public final java.lang.Class classForAlias(java.lang.String alias)
Returns the page class for the given alias or null if the alias is not mapped. Returns null if argument alias is null.

Parameters:
alias - the alias to look up
Returns:
The page class for the given alias or null if no mapping was found

putClassAlias

public final void putClassAlias(java.lang.Class pageClass,
                                java.lang.String alias)
Use this method to add logical names to your bookmarkable pages. E.g. "test" could map to "com.mycomp.MyPage".

Parameters:
pageClass - class of the page to map
alias - the alias or logical name of the bookmarkable page


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