|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.wicket.request.mapper.CompoundRequestMapper
public class CompoundRequestMapper
Thread safe compound IRequestMapper
. The mappers are searched depending on their
compatibility score and the orders they were registered. If two or more IRequestMapper
s
have the same compatibility score, the last registered mapper has highest priority.
Constructor Summary | |
---|---|
CompoundRequestMapper()
Construct. |
Method Summary | |
---|---|
CompoundRequestMapper |
add(IRequestMapper encoder)
Registers a IRequestMapper |
int |
getCompatibilityScore(Request request)
The scope of the compound mapper is the highest score of the registered mappers. |
java.util.Iterator<IRequestMapper> |
iterator()
|
Url |
mapHandler(IRequestHandler handler)
Searches the registered IRequestMapper s to find one that can encode the
IRequestHandler . |
IRequestHandler |
mapRequest(Request request)
Searches the registered IRequestMapper s to find one that can decode the
Request . |
CompoundRequestMapper |
remove(IRequestMapper encoder)
Unregisters IRequestMapper |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public CompoundRequestMapper()
Method Detail |
---|
public CompoundRequestMapper add(IRequestMapper encoder)
ICompoundRequestMapper
IRequestMapper
add
in interface ICompoundRequestMapper
this
for chainingICompoundRequestMapper.add(org.apache.wicket.request.IRequestMapper)
public CompoundRequestMapper remove(IRequestMapper encoder)
ICompoundRequestMapper
IRequestMapper
remove
in interface ICompoundRequestMapper
this
for chainingICompoundRequestMapper.remove(org.apache.wicket.request.IRequestMapper)
public IRequestHandler mapRequest(Request request)
IRequestMapper
s to find one that can decode the
Request
. Each registered IRequestMapper
is asked to provide the matching
segments count. Then the encoders are asked to decode the request in order depending on the
provided segments count.
The encoder with highest matching segments count that can decode the request is returned.
mapRequest
in interface IRequestMapper
request
-
null
if no encoder for the request is
found.public Url mapHandler(IRequestHandler handler)
IRequestMapper
s to find one that can encode the
IRequestHandler
. Each registered IRequestMapper
is asked to encode the
IRequestHandler
until an encoder that can encode the IRequestHandler
is found
or no more encoders are left.
The handlers are searched in reverse order as they have been registered. More recently registered handlers have bigger priority.
mapHandler
in interface IRequestMapper
handler
-
null
if no encoder for the handler is found.public int getCompatibilityScore(Request request)
A good criteria for calculating the score is the number of matched url segments. For example
when there are two encoders for mounted page, one mapped to /foo
another to
/foo/bar
and the incoming request URL is /foo/bar/baz, the encoder
mapped to /foo/bar
will 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 encoder can not decode the request.
getCompatibilityScore
in interface IRequestMapper
public java.util.Iterator<IRequestMapper> iterator()
iterator
in interface java.lang.Iterable<IRequestMapper>
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |