Hierarchical Places in GWT 2.1

92 views
Skip to first unread message

dominic jansen

unread,
Dec 15, 2010, 5:22:52 AM12/15/10
to google-we...@googlegroups.com
Hey,

is there a way to implement hierarchical places in gwt 2.1?

E.g. i want:
http://www.myexample.com/foo/bar

In gwt 2.1 i get sth like this:
http://www.myexample.com#foo:bar

Regarding some posts of Thomas Broyer and the GWTP team it looks like
there is no direct way to use hierarchical places in pure gwt 2.1
(e.g. http://groups.google.com/group/gwt-platform/browse_thread/thread/4c00e59dc139ccdf?fwc=1).

Are there workarounds (without involving a third party lib)?

Replacing ":" with "/" may work with a customized
AbstractPlaceHistoryMapper. So maybe the parameters of a place can
mock hierarchical places.
But what about removing the "#" hashtag?

A different way may be using sth like "nested places". But when a
place has no parameters, it results in #Place:null. Is there a way to
disable this "null" token?

Thanks for any ideas or remarks!

Best
dom

Thomas Broyer

unread,
Dec 15, 2010, 8:28:34 AM12/15/10
to google-we...@googlegroups.com


On Wednesday, December 15, 2010 11:22:52 AM UTC+1, dom.jansen wrote:
Hey,

is there a way to implement hierarchical places in gwt 2.1?

E.g. i want:
http://www.myexample.com/foo/bar

In gwt 2.1 i get sth like this:
http://www.myexample.com#foo:bar

Regarding some posts of Thomas Broyer and the GWTP team it looks like
there is no direct way to use hierarchical places in pure gwt 2.1
(e.g. http://groups.google.com/group/gwt-platform/browse_thread/thread/4c00e59dc139ccdf?fwc=1).


That was about activities, not places.
 

Are there workarounds (without involving a third party lib)?

Replacing ":" with "/" may work with a customized
AbstractPlaceHistoryMapper. So maybe the parameters of a place can
mock hierarchical places.


If you don't want the prefix:place-specific-token pair, then indeed you have to create your own PlaceHistoryMapper instead of relying on the generator (do not use AbstractPlaceHistoryMapper though, it's really made for the prefix/token approach, which is not really –really not?– "hierarchical")
With your own PlaceHistoryMapper, you're free to parse an serialize your places the way you want. What's left then is to define Place types that model your "hierarchy".

But what about removing the "#" hashtag?


Theoretically you could pass an Historian to the PlaceHistoryHandler that uses HTML5's pushState/onpopstate, but then that requires you to also handle the URLs on the server-side, because when people will bookmark the URLs, the browser will then request the full URL to the server.

Reply all
Reply to author
Forward
0 new messages