Eclipse RAP crawled by Google?

I am developing a RAP site and want to make it accessible to robots such as Google (I mean only Google, but I think other search engines work the same way). Webapp contains dynamic content that I download from the database, depending on what the user is looking for. How to make this content available for Google? I read the Google manual for ajax workaround, but don't know how to apply it for RAP:

  • RAP makes AJAX calls internally. Can I use them for Google; And How?
  • RAP is a separate page, how can I provide Sitemap (XML) for Google?

Thanks in advance!

+4
source share
1 answer

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 ) { // show state represented by event.entryId } } ); 

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.

+6
source

All Articles