Re: Best practice to implement hash bang tokens in activities and places keeping @WithTokenizers

131 views
Skip to first unread message

Thomas Broyer

unread,
Nov 15, 2012, 3:53:10 AM11/15/12
to google-we...@googlegroups.com

On Wednesday, November 14, 2012 10:38:50 PM UTC+1, Robert Hoffmann wrote:
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?

Ideally, I'd change the @Prefix annotations to include the "!"; but you can also extend DefaultHistorian, or use your approach, which is fine too (in getPlace, instead of unconditionally trying a substring(1), I'd rather check with a startsWith("!")).

But that's the easiest part of the #! story…

Robert Hoffmann

unread,
Nov 15, 2012, 9:43:19 AM11/15/12
to google-we...@googlegroups.com
Thanks for the quick reply.

Some of my thoughts regarding the different options.

1) @Prefix
- Since the hash bang is part of a a global scheme and the @Prefix a personal attribute of a Place, I don't feel comfortable to add it there.

2) Extending DefaultHistorian
- This does not 'force' the developer to use hash bang notation in hrefs (i.e. of anchors in UiBinder), and a crawler would miss those links. 

3) Extending PlaceHistoryMapper
- maybe I did actually find a good solution at 2am ;-)
- outlined in the my post above

best -R

 

But that's the easiest part of the #! story…

so true ;-)
Reply all
Reply to author
Forward
0 new messages