Skip to main content



      Home
Home » Eclipse Projects » Remote Application Platform (RAP) » access RAP from servlet(Dummy-Session?)
access RAP from servlet [message #513421] Wed, 10 February 2010 02:21 Go to next message
Eclipse UserFriend
I need to generate [birt] charts by calling a servlet.

In RCP chart generation is done by generating/rendering on a SWT composite, in RAP an image is to be created.

Unfortunately, the chart generation needs a ui thread, but accessing ui specific code from a servlet is not possible (ui context not available).
Note: servlet runs on the same app server/jvm (embedded jetty).

I solved this by starting a dummy ui session that registers its Display as a service that can be used in the servlet to execute ui specific code.

Unfortunately, this does not seem to be a clean way of doing this task: Would you suggest some other ways?
Re: access RAP from servlet [message #513441 is a reply to message #513421] Tue, 09 February 2010 23:10 Go to previous messageGo to next message
Eclipse UserFriend
I assume that you don't actually need the UI thread but need to have
access the the session. If you really need the UI thread, options are
sparse.
In the latter case there are several ways to accomplish this:
* you may use an IServiceHandler instead of an extra servlet. That
provides you with a "context" which allows you to access
session-singletones etc. See JavaDoc, newsgroup, FAQ for further
information.
* you may put the information that needs to be shared among the
RWT-servlet and the charing-servlet in a session attribute. From RAP,
the http-session can be reached like this:
RWT.getSessionStore().getHttpSession().setAtribute()

HTH
--
Rüdiger Herrmann
http://eclipsesource.com

On 10.02.2010 08:21, Erdal Karaca wrote:
> I need to generate [birt] charts by calling a servlet.
>
> In RCP chart generation is done by generating/rendering on a SWT
> composite, in RAP an image is to be created.
>
> Unfortunately, the chart generation needs a ui thread, but accessing ui
> specific code from a servlet is not possible (ui context not available).
> Note: servlet runs on the same app server/jvm (embedded jetty).
>
> I solved this by starting a dummy ui session that registers its Display
> as a service that can be used in the servlet to execute ui specific code.
>
> Unfortunately, this does not seem to be a clean way of doing this task:
> Would you suggest some other ways?
Re: access RAP from servlet [message #513446 is a reply to message #513441] Wed, 10 February 2010 04:30 Go to previous messageGo to next message
Eclipse UserFriend
I need a ui thread because of some chart handlers making use of swt resources (Images, Fonts) which require a display to be generated...

Anyways, thanks for the hints!
Re: access RAP from servlet [message #514488 is a reply to message #513446] Mon, 15 February 2010 05:08 Go to previous messageGo to next message
Eclipse UserFriend
Hi Erdal,

I'm a little but confused. You mentioned BIRT and the requirements to
use Images, Fonts, etc. How do you try to generate the BIRT charts? In
case you try to use the SWT renderer - don't. It will not work as this
heavily relies on the GC. Instead you should use one of the plain image
renderes (eg. PNG).

See http://wiki.eclipse.org/RAP/BIRT_Integration for some examples.

Regards,
Ben

Erdal Karaca wrote:
> I need a ui thread because of some chart handlers making use of swt
> resources (Images, Fonts) which require a display to be generated...
>
> Anyways, thanks for the hints!


--
Benjamin Muskalla | EclipseSource Karlsruhe
http://www.eclipsesource.com | http://twitter.com/eclipsesource
Re: access RAP from servlet [message #514584 is a reply to message #514488] Mon, 15 February 2010 15:27 Go to previous message
Eclipse UserFriend
Yes, I am using the dv.PNG renderer, but the charts contain graphics which require an active Display for creating Images, resizing them, etc.
Or do I miss something?
Previous Topic:Custom Widget: Composing Qooxdoo Widgets in CanvasLayout, the widget is not shown.
Next Topic:migration route JSP/Servlet-application -> RAP?
Goto Forum:
  


Current Time: Sun Jul 27 11:45:23 EDT 2025

Powered by FUDForum. Page generated in 0.04457 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top