|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.wicket.request.mapper.AbstractMapper org.apache.wicket.request.mapper.AbstractComponentMapper org.apache.wicket.request.mapper.AbstractBookmarkableMapper org.apache.wicket.request.mapper.PackageMapper
public class PackageMapper
A request mapper that mounts all bookmarkable pages in a given package.
To mount this mapper onto a path use the WebApplication.mountPackage(String, Class)
, ex:
MyApp#init() { super.init(); mountPackage("/my/path", MyPage.class); }will result in urls like
/my/path/MyPage
Page Class - Render (BookmarkablePageRequestHandler) /MyPage (will redirect to hybrid alternative if page is not stateless) Page Instance - Render Hybrid (RenderPageRequestHandler for pages that were created using bookmarkable URLs) /MyPage?2 Page Instance - Bookmarkable Listener (BookmarkableListenerInterfaceRequestHandler) /MyPage?2-click-foo-bar-baz /MyPage?2-click.1-foo-bar-baz (1 is behavior index) (these will redirect to hybrid if page is not stateless)
Nested Class Summary |
---|
Nested classes/interfaces inherited from class org.apache.wicket.request.mapper.AbstractBookmarkableMapper |
---|
AbstractBookmarkableMapper.UrlInfo |
Constructor Summary | |
---|---|
PackageMapper(PackageName packageName)
Construct. |
|
PackageMapper(PackageName packageName,
IPageParametersEncoder pageParametersEncoder)
Construct. |
Method Summary | |
---|---|
protected Url |
buildUrl(AbstractBookmarkableMapper.UrlInfo info)
Builds URL for the given AbstractBookmarkableMapper.UrlInfo instance. |
int |
getCompatibilityScore(Request request)
Returns the score representing how compatible this request mapper is to processing the given request. |
protected boolean |
pageMustHaveBeenCreatedBookmarkable()
Indicates whether hybrid RenderPageRequestHandler URL for page will be generated only
if page has been created with bookmarkable URL. |
protected AbstractBookmarkableMapper.UrlInfo |
parseRequest(Request request)
Parse the given request to an AbstractBookmarkableMapper.UrlInfo instance. |
protected java.lang.String |
transformForUrl(java.lang.String className)
Gives a chance to specializations of this mapper to transform the real class name to an alias which is prettier to represent in the Url |
protected java.lang.String |
transformFromUrl(java.lang.String classNameAlias)
Gives a chance to specializations of this mapper to transform the alias of the class name to the real class name |
Methods inherited from class org.apache.wicket.request.mapper.AbstractBookmarkableMapper |
---|
checkPageClass, mapHandler, mapRequest, processBookmarkable, processHybrid, processListener |
Methods inherited from class org.apache.wicket.request.mapper.AbstractComponentMapper |
---|
encodePageComponentInfo, getContext, getPageClass, getPageComponentInfo, removeMetaParameter, requestListenerInterfaceFromString, requestListenerInterfaceToString |
Methods inherited from class org.apache.wicket.request.mapper.AbstractMapper |
---|
encodePageParameters, extractPageParameters, getMountSegments, getOptionalPlaceholder, getPlaceholder, getPlaceholder, urlStartsWith |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public PackageMapper(PackageName packageName)
packageName
- public PackageMapper(PackageName packageName, IPageParametersEncoder pageParametersEncoder)
packageName
- pageParametersEncoder
- Method Detail |
---|
protected Url buildUrl(AbstractBookmarkableMapper.UrlInfo info)
AbstractBookmarkableMapper
AbstractBookmarkableMapper.UrlInfo
instance. The URL this method produces must be
parseable by the AbstractBookmarkableMapper.parseRequest(Request)
method.
buildUrl
in class AbstractBookmarkableMapper
AbstractBookmarkableMapper.buildUrl(org.apache.wicket.request.mapper.AbstractBookmarkableMapper.UrlInfo)
protected AbstractBookmarkableMapper.UrlInfo parseRequest(Request request)
AbstractBookmarkableMapper
AbstractBookmarkableMapper.UrlInfo
instance.
parseRequest
in class AbstractBookmarkableMapper
null
if this encoder can not handle the requestAbstractBookmarkableMapper.parseRequest(org.apache.wicket.request.Request)
protected java.lang.String transformFromUrl(java.lang.String classNameAlias)
classNameAlias
- the alias for the class name
protected java.lang.String transformForUrl(java.lang.String className)
className
- the real class name
protected boolean pageMustHaveBeenCreatedBookmarkable()
AbstractBookmarkableMapper
RenderPageRequestHandler
URL for page will be generated only
if page has been created with bookmarkable URL.
For generic bookmarkable encoders this method should return true
. For explicit
(mounted) encoders this method should return false
pageMustHaveBeenCreatedBookmarkable
in class AbstractBookmarkableMapper
true
if hybrid URL requires page created bookmarkable,
false
otherwise.AbstractBookmarkableMapper.pageMustHaveBeenCreatedBookmarkable()
public int getCompatibilityScore(Request request)
IRequestMapper
A good criteria for calculating the score is the number of matched url segments. For example
when there are two mappers for a mounted page, one mapped to /foo
another to
/foo/bar
and the incoming request URL is /foo/bar/baz, the mapping
to /foo/bar
should probably handle the request first as it has matching segments
count of 2 while the first one has only matching segments count of 1.
Note that the method can return value greater then zero even if the mapper does not recognize the request.
getCompatibilityScore
in interface IRequestMapper
getCompatibilityScore
in class AbstractBookmarkableMapper
AbstractBookmarkableMapper.getCompatibilityScore(org.apache.wicket.request.Request)
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |