You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Dan Corneanu <cd...@savatech.ro> on 2010/12/03 09:15:06 UTC

serving views from jar files

Hi,
I'm using JSF 2.0 (myfaces 2.0.2). 

I am trying to implement a modularization solution for my application.
The basing idea is that I would like to be able to pack some xhtml view
definitions in a jar file and put it on the classpath and be able to use
this views as values of |<to-view-id>| in navigation rules.
Is this possible?
Ex.

|<to-view-id>/plugins/foobar/foo.xhtml</to-view-id>
|

I would like this id to be associated with an XHTML file located at
jar:file:foobar.jar!/foo.xhtml
I have tried to implement a custom resource loader but it seems that in
the process of finding the right xhtml file to associate with a view ID,
the implementation is always looking for the existence of a file on the
local file system. Is there any extension point in the JSF 2.0 API that
I can use in order to modify this behavior?

Best regards,
Dan.


Re: serving views from jar files

Posted by Mark Struberg <st...@yahoo.de>.
u r welcome.

Btw, if you run on Apache tomcat, you should also check your settings in context.xml [1]  Especially take care that 'antiJARLocking' is enabled!

Otherwise you might get problems with locked files...

LieGrue,
strub

[1] http://tomcat.apache.org/tomcat-6.0-doc/config/context.html


--- On Mon, 12/6/10, Dan Corneanu <cd...@savatech.ro> wrote:

> From: Dan Corneanu <cd...@savatech.ro>
> Subject: Re: serving views from jar files
> To: "MyFaces Discussion" <us...@myfaces.apache.org>
> Date: Monday, December 6, 2010, 11:13 AM
> Thank you,
> indeed the blog pointed by you was very helpful. I am
> currently able to
> load view definition files from jar files sitting on the
> classpath.
> 
> Best regards,
> Dan.
> 
> On 03.12.2010 10:43, Mark Struberg wrote:
> > Hi Dan!
> > 
> > You might take a look at Jason Lees blog if this is
> what you need:
> > 
> > http://blogs.steeplesoft.com/2010/05/putting-facelets-in-a-jar/
> > 
> > look at the custom ResourceResolver. 
> > You can also find this info in the JavaDoc (found the
> ResourceResolver trick in 2009 somewhere else too at
> least).
> > 
> > LieGrue,
> > strub
> > 
> > --- On Fri, 12/3/10, Dan Corneanu <cd...@savatech.ro>
> wrote:
> > 
> >> From: Dan Corneanu <cd...@savatech.ro>
> >> Subject: serving views from jar files
> >> To: users@myfaces.apache.org
> >> Date: Friday, December 3, 2010, 8:15 AM
> >> Hi,
> >> I'm using JSF 2.0 (myfaces 2.0.2). 
> >>
> >> I am trying to implement a modularization solution
> for my
> >> application.
> >> The basing idea is that I would like to be able to
> pack
> >> some xhtml view
> >> definitions in a jar file and put it on the
> classpath and
> >> be able to use
> >> this views as values of |<to-view-id>| in
> navigation
> >> rules.
> >> Is this possible?
> >> Ex.
> >>
> >>
> |<to-view-id>/plugins/foobar/foo.xhtml</to-view-id>
> >> |
> >>
> >> I would like this id to be associated with an
> XHTML file
> >> located at
> >> jar:file:foobar.jar!/foo.xhtml
> >> I have tried to implement a custom resource loader
> but it
> >> seems that in
> >> the process of finding the right xhtml file to
> associate
> >> with a view ID,
> >> the implementation is always looking for the
> existence of a
> >> file on the
> >> local file system. Is there any extension point in
> the JSF
> >> 2.0 API that
> >> I can use in order to modify this behavior?
> >>
> >> Best regards,
> >> Dan.
> >>
> >>
> > 
> > 
> >       
> > 
> > 
> 
> 


      

Re: serving views from jar files

Posted by Dan Corneanu <cd...@savatech.ro>.
Thank you,
indeed the blog pointed by you was very helpful. I am currently able to
load view definition files from jar files sitting on the classpath.

Best regards,
Dan.

On 03.12.2010 10:43, Mark Struberg wrote:
> Hi Dan!
> 
> You might take a look at Jason Lees blog if this is what you need:
> 
> http://blogs.steeplesoft.com/2010/05/putting-facelets-in-a-jar/
> 
> look at the custom ResourceResolver. 
> You can also find this info in the JavaDoc (found the ResourceResolver trick in 2009 somewhere else too at least).
> 
> LieGrue,
> strub
> 
> --- On Fri, 12/3/10, Dan Corneanu <cd...@savatech.ro> wrote:
> 
>> From: Dan Corneanu <cd...@savatech.ro>
>> Subject: serving views from jar files
>> To: users@myfaces.apache.org
>> Date: Friday, December 3, 2010, 8:15 AM
>> Hi,
>> I'm using JSF 2.0 (myfaces 2.0.2). 
>>
>> I am trying to implement a modularization solution for my
>> application.
>> The basing idea is that I would like to be able to pack
>> some xhtml view
>> definitions in a jar file and put it on the classpath and
>> be able to use
>> this views as values of |<to-view-id>| in navigation
>> rules.
>> Is this possible?
>> Ex.
>>
>> |<to-view-id>/plugins/foobar/foo.xhtml</to-view-id>
>> |
>>
>> I would like this id to be associated with an XHTML file
>> located at
>> jar:file:foobar.jar!/foo.xhtml
>> I have tried to implement a custom resource loader but it
>> seems that in
>> the process of finding the right xhtml file to associate
>> with a view ID,
>> the implementation is always looking for the existence of a
>> file on the
>> local file system. Is there any extension point in the JSF
>> 2.0 API that
>> I can use in order to modify this behavior?
>>
>> Best regards,
>> Dan.
>>
>>
> 
> 
>       
> 
> 


Re: serving views from jar files

Posted by Mark Struberg <st...@yahoo.de>.
Hi Dan!

You might take a look at Jason Lees blog if this is what you need:

http://blogs.steeplesoft.com/2010/05/putting-facelets-in-a-jar/

look at the custom ResourceResolver. 
You can also find this info in the JavaDoc (found the ResourceResolver trick in 2009 somewhere else too at least).

LieGrue,
strub

--- On Fri, 12/3/10, Dan Corneanu <cd...@savatech.ro> wrote:

> From: Dan Corneanu <cd...@savatech.ro>
> Subject: serving views from jar files
> To: users@myfaces.apache.org
> Date: Friday, December 3, 2010, 8:15 AM
> Hi,
> I'm using JSF 2.0 (myfaces 2.0.2). 
> 
> I am trying to implement a modularization solution for my
> application.
> The basing idea is that I would like to be able to pack
> some xhtml view
> definitions in a jar file and put it on the classpath and
> be able to use
> this views as values of |<to-view-id>| in navigation
> rules.
> Is this possible?
> Ex.
> 
> |<to-view-id>/plugins/foobar/foo.xhtml</to-view-id>
> |
> 
> I would like this id to be associated with an XHTML file
> located at
> jar:file:foobar.jar!/foo.xhtml
> I have tried to implement a custom resource loader but it
> seems that in
> the process of finding the right xhtml file to associate
> with a view ID,
> the implementation is always looking for the existence of a
> file on the
> local file system. Is there any extension point in the JSF
> 2.0 API that
> I can use in order to modify this behavior?
> 
> Best regards,
> Dan.
> 
>