You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@myfaces.apache.org by Balaji Saranathan <ba...@wipro.com> on 2005/07/11 21:47:09 UTC

Component development help


Hi,

I have some custom components developed. I want to package the
Javascripts/ images files along with the jar file of the custom
components. I'm trying to understand how it is done in MyFaces but is
there any pointers to implementing this.?

Also, this document http://myfaces.apache.org/docs/extensionsFilter.html
mentions adding an attribute to the request so that the filter reads it,
but however, on inspecting the Tree2 code, it is pretty straight forward
and uses the AddResource.addJavaScriptHere which just outputs the html
code for the resource. How does the filter know it in this case? I gues
I'm missing some links here. Can anyone explain ?

TIA
Bala




Confidentiality Notice 

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.

Re: Component development help

Posted by Bruno Aranda <br...@gmail.com>.
Sorry Bala, I didn't understand you correclty and I thought you were
asking how to use the AddResources thing, I cannot give further help.
You should take a look to the AddResources.java and
ExtensionsFilter.java to see what can you do...

Regards,

Bruno

2005/7/11, Balaji Saranathan <ba...@wipro.com>:
> 
> Hi,
> 
> How I wish I could get my management to use MyFaces. I would go ahead
> and use the AddResource directly. Unfortunately, I don't have the
> flexibility to do it or atleast at this initial stage of the project.
> That's the reason I was searching to see how resource serving is done
> using Servlet Filters.
> 
> -----Original Message-----
> From: Bruno Aranda [mailto:brunoaranda@gmail.com]
> Sent: Monday, July 11, 2005 3:58 PM
> To: MyFaces Discussion; balaji.saranathan@wipro.com
> Subject: Re: Component development help
> 
> 
> Hi Bala,
> 
> You have to put your resources (js, css, etc) in a subpackage called
> resource. For instance, if your component renderer
> (YourComponentRenderer.java) is in a package called '
> com.yourcompany.custom.yourcomponent':
> 
> com.yourcompany.custom.yourcomponent.YourComponentRenderer.java
> 
> Then your resource files must be in a package called
> 'com.yourcompany.custom.yourcomponent.resource'.
> 
> e.g com.yourcompany.custom.yourcomponent.resource.YourJavascriptHere.js
> 
> Then, in the encodeBegin of your YourComponentRenderer you have to
> invoke
> 
> AddResource.addJavaScriptToHeader(YourComponentRenderer.class,
> "YourJavascriptHere.js", facesContext);
> 
> The AddResource will search for the javascript file in a folder
> 'resource' relative to the class passed as the first parameter
> (YourComponentRenderer.class).
> 
> Hope this helps,
> 
> Bruno
> 
> 2005/7/11, Balaji Saranathan <ba...@wipro.com>:
> >
> >
> >
> > Hi,
> >
> > I have some custom components developed. I want to package the
> > Javascripts/ images files along with the jar file of the custom
> > components. I'm trying to understand how it is done in MyFaces but is
> > there any pointers to implementing this.?
> >
> > Also, this document
> > http://myfaces.apache.org/docs/extensionsFilter.html
> > mentions adding an attribute to the request so that the filter reads
> > it, but however, on inspecting the Tree2 code, it is pretty straight
> > forward and uses the AddResource.addJavaScriptHere which just outputs
> > the html code for the resource. How does the filter know it in this
> > case? I gues I'm missing some links here. Can anyone explain ?
> >
> > TIA
> > Bala
> >
> >
> >  Confidentiality Notice
> >
> >  The information contained in this electronic message and any
> > attachments to this message are intended  for the exclusive use of the
> 
> > addressee(s) and may contain confidential or privileged information.
> > If  you are not the intended recipient, please notify the sender at
> > Wipro or Mailadmin@wipro.com immediately
> >  and destroy all copies of this message and any attachments.
> >
> 
> 
> 
> 
> Confidentiality Notice
> 
> The information contained in this electronic message and any attachments to this message are intended
> for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
> you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
> and destroy all copies of this message and any attachments.
>

RE: Component development help

Posted by Balaji Saranathan <ba...@wipro.com>.
Hi,

How I wish I could get my management to use MyFaces. I would go ahead
and use the AddResource directly. Unfortunately, I don't have the
flexibility to do it or atleast at this initial stage of the project.
That's the reason I was searching to see how resource serving is done
using Servlet Filters.

-----Original Message-----
From: Bruno Aranda [mailto:brunoaranda@gmail.com] 
Sent: Monday, July 11, 2005 3:58 PM
To: MyFaces Discussion; balaji.saranathan@wipro.com
Subject: Re: Component development help


Hi Bala,

You have to put your resources (js, css, etc) in a subpackage called
resource. For instance, if your component renderer
(YourComponentRenderer.java) is in a package called '
com.yourcompany.custom.yourcomponent':

com.yourcompany.custom.yourcomponent.YourComponentRenderer.java

Then your resource files must be in a package called
'com.yourcompany.custom.yourcomponent.resource'.

e.g com.yourcompany.custom.yourcomponent.resource.YourJavascriptHere.js

Then, in the encodeBegin of your YourComponentRenderer you have to
invoke 

AddResource.addJavaScriptToHeader(YourComponentRenderer.class,
"YourJavascriptHere.js", facesContext);

The AddResource will search for the javascript file in a folder
'resource' relative to the class passed as the first parameter
(YourComponentRenderer.class).

Hope this helps,

Bruno

2005/7/11, Balaji Saranathan <ba...@wipro.com>:
>  
>  
> 
> Hi,
> 
> I have some custom components developed. I want to package the 
> Javascripts/ images files along with the jar file of the custom 
> components. I'm trying to understand how it is done in MyFaces but is 
> there any pointers to implementing this.?
> 
> Also, this document 
> http://myfaces.apache.org/docs/extensionsFilter.html
> mentions adding an attribute to the request so that the filter reads 
> it, but however, on inspecting the Tree2 code, it is pretty straight 
> forward and uses the AddResource.addJavaScriptHere which just outputs 
> the html code for the resource. How does the filter know it in this 
> case? I gues I'm missing some links here. Can anyone explain ?
> 
> TIA
> Bala 
> 
>  
>  Confidentiality Notice
>  
>  The information contained in this electronic message and any 
> attachments to this message are intended  for the exclusive use of the

> addressee(s) and may contain confidential or privileged information. 
> If  you are not the intended recipient, please notify the sender at 
> Wipro or Mailadmin@wipro.com immediately
>  and destroy all copies of this message and any attachments.
>




Confidentiality Notice 

The information contained in this electronic message and any attachments to this message are intended
for the exclusive use of the addressee(s) and may contain confidential or privileged information. If
you are not the intended recipient, please notify the sender at Wipro or Mailadmin@wipro.com immediately
and destroy all copies of this message and any attachments.

Re: Component development help

Posted by Bruno Aranda <br...@gmail.com>.
Hi Bala,

You have to put your resources (js, css, etc) in a subpackage called
resource. For instance, if your component renderer
(YourComponentRenderer.java) is in a package called '
com.yourcompany.custom.yourcomponent':

com.yourcompany.custom.yourcomponent.YourComponentRenderer.java

Then your resource files must be in a package called
'com.yourcompany.custom.yourcomponent.resource'.

e.g com.yourcompany.custom.yourcomponent.resource.YourJavascriptHere.js

Then, in the encodeBegin of your YourComponentRenderer you have to invoke 

AddResource.addJavaScriptToHeader(YourComponentRenderer.class,
"YourJavascriptHere.js", facesContext);

The AddResource will search for the javascript file in a folder
'resource' relative to the class passed as the first parameter
(YourComponentRenderer.class).

Hope this helps,

Bruno

2005/7/11, Balaji Saranathan <ba...@wipro.com>:
>  
>  
> 
> Hi, 
> 
> I have some custom components developed. I want to package the Javascripts/
> images files along with the jar file of the custom components. I'm trying to
> understand how it is done in MyFaces but is there any pointers to
> implementing this.? 
> 
> Also, this document
> http://myfaces.apache.org/docs/extensionsFilter.html
> mentions adding an attribute to the request so that the filter reads it, but
> however, on inspecting the Tree2 code, it is pretty straight forward and
> uses the AddResource.addJavaScriptHere which just outputs the html code for
> the resource. How does the filter know it in this case? I gues I'm missing
> some links here. Can anyone explain ? 
> 
> TIA 
> Bala 
> 
>  
>  Confidentiality Notice 
>  
>  The information contained in this electronic message and any attachments to
> this message are intended
>  for the exclusive use of the addressee(s) and may contain confidential or
> privileged information. If
>  you are not the intended recipient, please notify the sender at Wipro or
> Mailadmin@wipro.com immediately
>  and destroy all copies of this message and any attachments.
>