Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse Platform » Show jarred content using internal browser
Show jarred content using internal browser [message #637956] Tue, 09 November 2010 13:14 Go to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Hi,

we have a view that shows some html/css/png content
which is shipped inside the plug-in.
When the plug-in is unpacked during install the
internal browser is happy, however, as unpacking
plug-ins is deprecated I'm looking for ways how the
browser can display content directly from the jarred
plug-in.

Initially, I have a URL like this:
bundleentry://405.fwk29293232/guide/otjld/xdef/index.html

Previously we converted this using
FileLocator.resolve(url)

resulting in s.t. like
file:jar:pathtoplugin.jar!/guide/otjld/xdef/index.html

which doesn't work in the internal browser.
I then tried
FileLocator.toFileURL(url)

which nicely converts the url to some cache location
in the filesystem.

However, any relative URLs within that initial HTML
fail because those files have not been extracted
(included css and png).

Is there a way to let the internal browser see all the
files in the jarred plug-in?

TIA
Stephan
Re: Show jarred content using internal browser [message #638003 is a reply to message #637956] Tue, 09 November 2010 15:40 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Stephan Herrmann wrote:
> I then tried
> FileLocator.toFileURL(url)
> which nicely converts the url to some cache location
> in the filesystem.
>
> However, any relative URLs within that initial HTML
> fail because those files have not been extracted
> (included css and png).

If you use bundleentry://405.fwk29293232/guide/otjld/xdef/ then the
entire folder/subfolder system should be extracted

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Show jarred content using internal browser [message #638057 is a reply to message #638003] Tue, 09 November 2010 19:04 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Paul Webster wrote on Tue, 09 November 2010 16:40
If you use bundleentry://405.fwk29293232/guide/otjld/xdef/ then the
entire folder/subfolder system should be extracted



Great, that seems to do the trick.

Out of curiosity:
Is my interpretation correct that calling toFileURL() with
the URL of any contained directory will cause all content
of the given bundle to be extracted?

thanks,
Stephan
Re: Show jarred content using internal browser [message #638297 is a reply to message #638057] Wed, 10 November 2010 18:16 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Stephan Herrmann wrote:
> Out of curiosity:
> Is my interpretation correct that calling toFileURL() with
> the URL of any contained directory will cause all content of the given
> bundle to be extracted?

Maybe :-)

It specs it will return a file: URL for the system URL. If you did have
a legacy plugin as a directory, it would just point into there, if not
it extracts it.

The corollary is that this file location should still be treated as
read-only.

PW



--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Show jarred content using internal browser [message #638332 is a reply to message #638297] Wed, 10 November 2010 21:21 Go to previous messageGo to next message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Paul Webster wrote on Wed, 10 November 2010 19:16
Stephan Herrmann wrote:
> Out of curiosity:
> Is my interpretation correct that calling toFileURL() with
> the URL of any contained directory will cause all content of the given
> bundle to be extracted?

Maybe Smile

It specs it will return a file: URL for the system URL.


You're not trying to confuse me, are you? Rolling Eyes

Spec guarantees: the one file pointed to by the URL will exist in the filesystem

You told me, passing a dir will cause that dir and all sub dirs to be extracted.

I observed the whole bundle being extracted.

To what degree can I rely on this undocumented extracting?

Quote:
If you did have
a legacy plugin as a directory, it would just point into there, if not
it extracts it.


Yea, using a plugin as a directory everything was easy as pie.

Since I changed the plugin to jarred I need to be sure
whether the browser will reliably be able to follow
relative links starting from the one obtained from toFileURL().
If it works only "maybe" I may feel more comfortable going back
to the safe good-ol plugin-as-directory.

Quote:
The corollary is that this file location should still be treated as
read-only.



rest assured: I wasn't even dreaming of writing to that location.

Stephan
Re: Show jarred content using internal browser [message #638488 is a reply to message #638332] Thu, 11 November 2010 13:18 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

Sorry about rambling on :-)

Stephan Herrmann wrote:
> You told me, passing a dir will cause that dir and all sub dirs to be
> extracted.
>
> I observed the whole bundle being extracted.
>
> To what degree can I rely on this undocumented extracting?

This is well known behaviour, and is used in the SDK. It can be relied on.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/galileo/index.jsp?topic=/org.eclipse .platform.doc.isv/guide/workbench.htm


Re: Show jarred content using internal browser [message #638490 is a reply to message #638488] Thu, 11 November 2010 13:40 Go to previous message
Stephan Herrmann is currently offline Stephan HerrmannFriend
Messages: 1853
Registered: July 2009
Senior Member
Paul Webster wrote on Thu, 11 November 2010 14:18

> To what degree can I rely on this undocumented extracting?

This is well known behaviour, and is used in the SDK. It can be relied on.


Great, one less worry Smile

thanks,
Stephan
Previous Topic:cvs update plugin
Next Topic:3.6.1 Helios update woes
Goto Forum:
  


Current Time: Wed Nov 06 11:55:51 GMT 2024

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

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

Back to the top