Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » access RAP from servlet(Dummy-Session?)
access RAP from servlet [message #513421] Wed, 10 February 2010 07:21 Go to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
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] Wed, 10 February 2010 04:10 Go to previous messageGo to next message
Rüdiger Herrmann is currently offline Rüdiger HerrmannFriend
Messages: 581
Registered: July 2009
Senior Member
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 09:30 Go to previous messageGo to next message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
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 10:08 Go to previous messageGo to next message
Benjamin Muskalla is currently offline Benjamin MuskallaFriend
Messages: 338
Registered: July 2009
Senior Member
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 20:27 Go to previous message
Erdal Karaca is currently offline Erdal KaracaFriend
Messages: 854
Registered: July 2009
Senior Member
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 Oct 06 16:19:34 GMT 2024

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

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

Back to the top