Hi,
I am currently using:
- PlaceHistoryMapper historyMapper =
GWT.create(AppPlaceHistoryMapper.class);
- @WithTokenizers({FrontPlace.Tokenizer.class, ...}) on PlaceHistoryMapper
I'd like to use now hash bang tokens for places to support bot crawling.
What is the best way (minimal change) to do this?
I am currently using a PlaceHistoryMapper-WRAPPER that adds and understands
the bang (!).
The PlaceHistoryMapper I pass to this wrapper is created through the old
process (GWT.create + @WithTokenizers). I've posted the code below for
clarity.
Note: I like that I can continue to use @WithTokenizers.
Is there a better way to achieve this?
I expected that there would be a flag on @WithTokenizers or another
annotation to simply switch hash bang tokens, but did find no reference in
the docs or the web.
Thank you.
>>
PlaceHistoryMapper historyMapper =
GWT.create(AppPlaceHistoryMapper.class);
class PlaceHistoryMapperHashBang implements PlaceHistoryMapper {
private PlaceHistoryMapper historyMapper;
PlaceHistoryMapperHashBang(PlaceHistoryMapper historyMapper) {
this.historyMapper = historyMapper;
}
@Override
public Place getPlace(String token) {
Place p=historyMapper.getPlace(token.substring(1));
if(p!=null) return p;
return historyMapper.getPlace(token);
}
@Override
public String getToken(Place place) {
return "!"+historyMapper.getToken(place);
}
}
PlaceHistoryHandler historyHandler = new PlaceHistoryHandler(new
PlaceHistoryMapperHashBang(historyMapper));
<<
--
You received this message because you are subscribed to the Google Groups
"Google Web Toolkit" group.
To view this discussion on the web visit
https://groups.google.com/d/msg/google-web-toolkit/-/Nrzican0O30J.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-web-toolkit?hl=en.