Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Remote Application Platform (RAP) » Using images and javascripts in ServiceHandler
Using images and javascripts in ServiceHandler [message #102756] Fri, 22 August 2008 03:24 Go to next message
Boris Stepanov is currently offline Boris StepanovFriend
Messages: 68
Registered: July 2009
Member
Hi everybody,

I use Browser control connecting to IServiceHadler implementation which
returns HTML text, images and scripts including in this HTML saved in
directory inside plugin. What URLs I should use for images and
javascripts in that HTML?

Thanks.
Re: Using images and javascripts in ServiceHandler [message #102794 is a reply to message #102756] Fri, 22 August 2008 06:55 Go to previous messageGo to next message
Stefan   is currently offline Stefan Friend
Messages: 316
Registered: July 2009
Senior Member
Hi Boris,

you can first register your images, scripts, etc. at the
IResourceManager with a relative path and use this path in your rendered
HTML.

Example:

IResourceManager resourceManager = ResourceManager.getInstance();
ClassLoader classLoader = getClass().getClassLoader();
InputStream inputStream =
classLoader.getResourceAsStream("resources/styles.css");
resourceManager.register("resources/styles.css", inputStream);

This can also be done declaratively via the extension point
org.eclipse.rap.ui.resources.

Hope that helps,
Stefan.


Boris Stepanov schrieb:
> Hi everybody,
>
> I use Browser control connecting to IServiceHadler implementation which
> returns HTML text, images and scripts including in this HTML saved in
> directory inside plugin. What URLs I should use for images and
> javascripts in that HTML?
>
> Thanks.
Re: Using images and javascripts in ServiceHandler [message #102888 is a reply to message #102794] Fri, 22 August 2008 10:12 Go to previous messageGo to next message
Benjamin Muskalla is currently offline Benjamin MuskallaFriend
Messages: 237
Registered: July 2009
Senior Member
Hi,

as the resources are for a IServiceHandler it may even be possible to
register them with the org.eclipse.equinox.http.registry.resources
extension point.

Best regards
Benny

Stefan Roeck wrote:
> Hi Boris,
>
> you can first register your images, scripts, etc. at the
> IResourceManager with a relative path and use this path in your rendered
> HTML.
>
> Example:
>
> IResourceManager resourceManager = ResourceManager.getInstance();
> ClassLoader classLoader = getClass().getClassLoader();
> InputStream inputStream =
> classLoader.getResourceAsStream("resources/styles.css");
> resourceManager.register("resources/styles.css", inputStream);
>
> This can also be done declaratively via the extension point
> org.eclipse.rap.ui.resources.
>
> Hope that helps,
> Stefan.
>
>
> Boris Stepanov schrieb:
>> Hi everybody,
>>
>> I use Browser control connecting to IServiceHadler implementation
>> which returns HTML text, images and scripts including in this HTML
>> saved in directory inside plugin. What URLs I should use for images
>> and javascripts in that HTML?
>>
>> Thanks.
Re: Using images and javascripts in ServiceHandler [message #103030 is a reply to message #102888] Sat, 23 August 2008 09:08 Go to previous messageGo to next message
Boris Stepanov is currently offline Boris StepanovFriend
Messages: 68
Registered: July 2009
Member
Hi, Benjamin

I have tens of resources, if I will use extension point I should create
Resource class for each of them and add it to plugin.xml. I think the
best way is analize folder with resources and register each of them
using IResourceManager as Stefan suggested. I did not find a way to
unregister resources using IResourceManager, it is possible? My
application generates some images for HTML dinamicly, so I need a way to
remove them when user will be finished browsing. Now I found only one
mean to implement it - create special IServiceHandler which will manage
directory with generated images and returns image content when request
comes. It is alternative mean how my goal can be solved.

> Hi,
>
> as the resources are for a IServiceHandler it may even be possible to
> register them with the org.eclipse.equinox.http.registry.resources
> extension point.
>
> Best regards
> Benny
>
> Stefan Roeck wrote:
>> Hi Boris,
>>
>> you can first register your images, scripts, etc. at the
>> IResourceManager with a relative path and use this path in your
>> rendered HTML.
>>
>> Example:
>>
>> IResourceManager resourceManager = ResourceManager.getInstance();
>> ClassLoader classLoader = getClass().getClassLoader();
>> InputStream inputStream =
>> classLoader.getResourceAsStream("resources/styles.css");
>> resourceManager.register("resources/styles.css", inputStream);
>>
>> This can also be done declaratively via the extension point
>> org.eclipse.rap.ui.resources.
>>
>> Hope that helps,
>> Stefan.
>>
>>
>> Boris Stepanov schrieb:
>>> Hi everybody,
>>>
>>> I use Browser control connecting to IServiceHadler implementation
>>> which returns HTML text, images and scripts including in this HTML
>>> saved in directory inside plugin. What URLs I should use for images
>>> and javascripts in that HTML?
>>>
>>> Thanks.
Re: Using images and javascripts in ServiceHandler [message #103362 is a reply to message #103030] Fri, 29 August 2008 06:48 Go to previous message
Eclipse UserFriend
Originally posted by: fappel.innoopract.com

Hello Boris,

unregistering of resources isn't available in RAP as images are treated as
shared objects between session. This assumption is true for most of the
use cases. But there are use cases (as the one you're describing) where
this isn't true.

I've been discussing this with Stefan before because he has implemented a
solution using the servicehandler approach. Unfortunately this solution
isn't generic enough (we encountered several other use cases during that
discussion) to take this over into the RAP.

To trace this I have created an bug entry:
245635: Provide an mechanism to handle different lifetimes of resources
https://bugs.eclipse.org/bugs/show_bug.cgi?id=245635


Ciao
Frank

-----Ursprüngliche Nachricht-----
Von: Boris Stepanov [mailto:freepriman@rambler.ru]
Bereitgestellt: Samstag, 23. August 2008 11:08
Bereitgestellt in: eclipse.technology.rap
Unterhaltung: Using images and javascripts in ServiceHandler
Betreff: Re: Using images and javascripts in ServiceHandler

Hi, Benjamin

I have tens of resources, if I will use extension point I should create
Resource class for each of them and add it to plugin.xml. I think the
best way is analize folder with resources and register each of them
using IResourceManager as Stefan suggested. I did not find a way to
unregister resources using IResourceManager, it is possible? My
application generates some images for HTML dinamicly, so I need a way to
remove them when user will be finished browsing. Now I found only one
mean to implement it - create special IServiceHandler which will manage
directory with generated images and returns image content when request
comes. It is alternative mean how my goal can be solved.

> Hi,
>
> as the resources are for a IServiceHandler it may even be possible to
> register them with the org.eclipse.equinox.http.registry.resources
> extension point.
>
> Best regards
> Benny
>
> Stefan Roeck wrote:
>> Hi Boris,
>>
>> you can first register your images, scripts, etc. at the
>> IResourceManager with a relative path and use this path in your
>> rendered HTML.
>>
>> Example:
>>
>> IResourceManager resourceManager = ResourceManager.getInstance();
>> ClassLoader classLoader = getClass().getClassLoader();
>> InputStream inputStream =
>> classLoader.getResourceAsStream("resources/styles.css");
>> resourceManager.register("resources/styles.css", inputStream);
>>
>> This can also be done declaratively via the extension point
>> org.eclipse.rap.ui.resources.
>>
>> Hope that helps,
>> Stefan.
>>
>>
>> Boris Stepanov schrieb:
>>> Hi everybody,
>>>
>>> I use Browser control connecting to IServiceHadler implementation
>>> which returns HTML text, images and scripts including in this HTML
>>> saved in directory inside plugin. What URLs I should use for images
>>> and javascripts in that HTML?
>>>
>>> Thanks.
Previous Topic:Administrator entry point
Next Topic:Will RAP work in a load-balanced system?
Goto Forum:
  


Current Time: Thu Apr 25 18:07:24 GMT 2024

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

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

Back to the top