0

I have a RAP application which we deploy into a Tomcat instance. The application does some additional stuff during it's first startup.

Currently when the first user opens the webpage in a Browser, it takes quite a while until the application is ready because of this one-time initialization work.

This is bad for usability as the first user needs to wait a long time until this startup-work is done.

Is there a way to trigger or simulate a first session after the Tomcat is started so we can warmup the application and the first user receives feedback quickly?

I tried to do some simple URL-requests via URLConnection to simulate a browser, but it seems the protocol to trigger a new session is non-trivial.

I also tried to use HtmlUnit to request the page with JavaScript enabled, this works to some degree, but HtmlUnit is quite heavy for this simple step.

So is there an official API or at least some sort of workaround that allows me to pre-start and initialize the application?

centic
  • 15,565
  • 9
  • 68
  • 125

1 Answers1

3

Unless this initialization requires a UI session (i.e. a user), the configure method of your ApplicationConfiguration could be a suitable place. However, at this point, the ApplicationContext has not been completely set up, so it could be too early. Also, if your application is based on the workbench and extension points, you won't have an ApplicationConfiguration of your own.

Would you mind opening a bug report (http://eclipse.org/rap/bugs) and describe your use case? I think we should provide some kind of hook for applications to setup and clean up, e.g. an ApplicationContextListener?

ralfstx
  • 3,893
  • 2
  • 25
  • 41
  • Thanks, I opened https://bugs.eclipse.org/bugs/show_bug.cgi?id=401219, we worked around it by making the initialization work independend of RAP/RWT and doing it as part of the Tomcat startup. – centic Feb 19 '13 at 18:13