How to create a url to a generated resource? [message #657608] |
Thu, 03 March 2011 13:22 |
Paul Ramsden Messages: 84 Registered: February 2011 Location: BW, Germany |
Member |
|
|
I am trying to use BIRT in a RAP app to display reports and charts. For reports, BIRT generates Images and HTML and loads the images via the HTML. This is not working for me as the URL to the image returns 404 NotFound.
I downloaded the examples from http://wiki.eclipse.org/RAP/BIRT_Integration but the report example does not work either.
I can see that an image is generated and saved to
D:\eclipse-rcp-helios-SR1-win32\eclipse\workspace\.metadata\ .plugins\org.eclipse.rap.ui\context\rwt-resources\1.23\2.30\ 0.31\0.32
The HTML then tries to load the image using
<img id="__bookmark_1" src="/1.23/2.30/0.31/0.32" alt="" style=" width: 400pt; height: 250pt;display: block;"></img>
but gets a 404.
Do I need to register a resource alias or something in order to get at that image?
(The Chart example works ok but this uses an Image in a Label on a Canvas which is quite a different approach)
I am using RAP 1.3 and BIRT 2.6.
[Updated on: Thu, 03 March 2011 13:23] Report message to a moderator
|
|
|
|
Re: How to create a url to a generated resource? [message #657846 is a reply to message #657621] |
Fri, 04 March 2011 10:39 |
Paul Ramsden Messages: 84 Registered: February 2011 Location: BW, Germany |
Member |
|
|
Thanks Ben,
looks interesting but couldn't figure out how to get BIRT to generate just an image. Sure it's possible, just didn't spot it.
I have actually managed to get my original attempt to work by using a different ImageHandler -- HTMLCompleteImageHandler in place of HTMLServerImageHandler.
// Render the report to HTML
renderOptions = new HTMLRenderOption();
renderOptions.setOutputFormat(HTMLRenderOption.HTML);
renderOptions.setOutputStream(outputStream);
// Get the path to the local context directory to save the rendered
// chart image
String webAppBase = (ContextProvider.getWebAppBase()).replaceAll("\\\\", "/");
String path = webAppBase + reportDirServer + RWT.getSessionStore().getId();
// Handle the image path
//renderOptions.setImageHandler(new HTMLServerImageHandler());
renderOptions.setImageHandler(new HTMLCompleteImageHandler());
renderOptions.setImageDirectory(path);
renderOptions.setBaseImageURL(URL + reportDirServer + RWT.getSessionStore().getId());
task.setRenderOption(renderOptions);
task.run();
task.close();
UPDATE
Forget that idea. When I look at the source code I see that the IMG src is 'file:/D:/...' which is really not what I want. So the question is still open - why can I not get at these resources using HTMLServerImageHandler?
[Updated on: Tue, 08 March 2011 07:19] Report message to a moderator
|
|
|
|
|
|
(no subject) [message #696993 is a reply to message #696967] |
Fri, 15 July 2011 09:09 |
Eclipse User |
|
|
|
Originally posted by:
Paul,
you are right, the content of 'internal' packages is not considered API
and therefore may change or vanish without prior notice.
The way out of this would be to describe your use case and the desired
API extension in an enhancement request.
Regards,
Rüdiger
On 15.07.2011 10:23, Paul Ramsden wrote:
> Hi Nikolai
> I just just got back to this project today and ran into this problem as
> soon as I upgraded to RAP 1.4. Thanks for the fix!
>
> However, I noticed that the package name contains 'internal' which is
> usually a sign that it shouldn't be used directly by applications.
>
> Any thoughts on that?
>
> Regards
>
> Paul
--
Rüdiger Herrmann
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
|
Re: (no subject) [message #697903 is a reply to message #697822] |
Mon, 18 July 2011 09:45 |
Eclipse User |
|
|
|
Originally posted by:
Paul,
regardless how you obtain the web-app base, with putting your images
below 'rwt-resouces' you may interfere with internal workings of RAP as
well. This path is meant for resources that were registered with the
IResourceManager.
As far as I understand, BIRT resources don't necessarily have to lie
below 'rwt-resources'.
At least With RAP 1.5, the path of the web-app base in the local file
system can be obtained like so:
RWT.getRequest().getSession().getServletContext().getRealPath("foo")
Though I am not entirely sure, the same should also work for 1.4.
HTH
Rüdiger
On 18.07.2011 08:42, Paul Ramsden wrote:
> Hi Rüdiger
>
> thanks for the interest. I have been trying to generate reports and
> chart in a RAP app using BIRT. My approach (see earlier posts in this
> thread) includes setting a path where BIRT outputs images. This path
> needs to be the context path which is why I'm trying to find the
> absolute path using the 'internal' classes. It could be that there is a
> better way to do this, of course.
>
> Assuming this is the correct approach, I would need an API extension
> which returns the WebAppBase path.
>
> Paul
--
Rüdiger Herrmann
Twitter: @EclipseRAP
Blog: http://eclipsesource.com/blogs/
Professional services for RAP and RCP?
http://eclipsesource.com/services/rap/
|
|
|
Powered by
FUDForum. Page generated in 1.40038 seconds