|
Back to GWTP Home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.gwtplatform.mvp.client.proxy.RouteTokenFormatter
public class RouteTokenFormatter
Implementation of TokenFormatter
with support for route like place names.
Instead of wiring a hierarchy of several places bound to multiple presenters this implements a flat structure where every history token is bound to a single presenter.
Usage:
Replace the default binding to ParameterTokenFormatter
with RouteTokenFormatter
. In case you use
GWTPs DefaultModule
:
install(new DefaultModule(DefaultPlaceManager.class, RouteTokenFormatter.class));
Now all @NameToken's are treated as routes. Routes are expected to start with an '/' and can contain path parameters as well as query parameters.
Constructor Summary | |
---|---|
RouteTokenFormatter(com.gwtplatform.mvp.client.proxy.RouteTokenFormatter.UrlUtils urlUtils,
PlaceTokenRegistry tokenRegistry)
|
Method Summary | |
---|---|
String |
toHistoryToken(List<PlaceRequest> placeRequestHierarchy)
Converts a place request hierarchy (a list of PlaceRequest ) into a history token. |
PlaceRequest |
toPlaceRequest(String placeToken)
Converts a place token into a PlaceRequest . |
List<PlaceRequest> |
toPlaceRequestHierarchy(String historyToken)
Converts a history token into a place request hierarchy (a list of PlaceRequest ). |
String |
toPlaceToken(PlaceRequest placeRequest)
Converts a PlaceRequest into a place token. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
@Inject public RouteTokenFormatter(com.gwtplatform.mvp.client.proxy.RouteTokenFormatter.UrlUtils urlUtils, PlaceTokenRegistry tokenRegistry)
Method Detail |
---|
public String toPlaceToken(PlaceRequest placeRequest) throws TokenFormatException
TokenFormatter
PlaceRequest
into a place token. A place token is different than a history
token, since the history token can contain a hierarchy of different place requests. The history
token will not be fully query encoded, it may still contain some unescaped separators.
However, these separators can be encoded and it will still work, making the scheme robust to
systems that force encoding these characters like some email apps.
toPlaceToken
in interface TokenFormatter
placeRequest
- The place request.
TokenFormatException
- if there is an error converting.public String toHistoryToken(List<PlaceRequest> placeRequestHierarchy) throws TokenFormatException
TokenFormatter
PlaceRequest
) into a history token. The
history token will not be fully query encoded, it may still contain some unescaped separators.
However, these separators can be encoded and it will still work, making the scheme robust to
systems that force encoding these characters like some email apps.
toHistoryToken
in interface TokenFormatter
placeRequestHierarchy
- The place request hierarchy.
TokenFormatException
- if there is an error converting.public PlaceRequest toPlaceRequest(String placeToken) throws TokenFormatException
TokenFormatter
PlaceRequest
. A place token is different than a history
token, since the history token can contain a hierarchy of different place requests.
toPlaceRequest
in interface TokenFormatter
placeToken
- The place token.
TokenFormatException
- if there is an error converting.public List<PlaceRequest> toPlaceRequestHierarchy(String historyToken) throws TokenFormatException
TokenFormatter
PlaceRequest
).
toPlaceRequestHierarchy
in interface TokenFormatter
historyToken
- The history token.
TokenFormatException
- if there is an error converting.
|
Back to GWTP Home | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |