The idea behind Ajax is that the application does not load new pages all the time, but loads new pieces of content using Ajax requests in the background. To provide โdeep linksโ to your application, you need URLs containing fragmentation, such as example.com/myapp#mystate . This trick is used because the browser does not reload the page when only the fragmented part of the URL changes.
This is no different from RAP. To deal with such URLs, RWT provides a browser history API. When the state of your application changes, for example, when a user selects a tab or starts a search, you can add a new entry to the browser history, which effectively changes the fragment of the URL in the browser:
RWT.getBrowserHistory().createEntry( "!mystate", "Example" );
This will change the URL to example.com/app/entrypoint#!mystate (โdeep linkโ to this state) and add an entry with the name โExampleโ in your browsing history so you can use the back to back button to go back to this state later ..
To be able to respond to URL changes, you must add a listener to your browser history. This listener will be notified every time a portion of the fragment changes. This also takes place when the application starts with a fragment (someone follows the deep link). Then your application is responsible for reinstalling the state represented by this snippet.
RWT.getBrowserHistory().addBrowserHistoryListener( new BrowserHistoryListener() { public void navigated( BrowserHistoryEvent event ) {
An example for a RAP application that uses snippet URLs for different "subpages" is a demonstration of RAP examples .
The rest of the story should be explained in Google AJAX crawl . Your identifiers must begin with ! to create URLs with a snippet like #!mystate . These URLs are the ones you need to add to your site map. To feed the crawlers, you can implement a servlet filter that catches requests to the URL pattern ?_escaped_fragment_=mystate and returns an HTML representation of a certain state.
source share