<div dir="ltr">We've done this in eXo Platform : <a href="https://jira.exoplatform.org/browse/PLF-497">https://jira.exoplatform.org/browse/PLF-497</a><div><br></div><div><a href="https://github.com/exoplatform/platform/commit/586e1b411c9a9509e3d415a9f0fcbb91bb76e1ba">https://github.com/exoplatform/platform/commit/586e1b411c9a9509e3d415a9f0fcbb91bb76e1ba</a></div>
<div><br></div><div><br></div><div><pre style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;color:rgb(51,51,51);line-height:17.98611068725586px"><div class="" id="LC48" style="padding-left:10px">
<span class="" style="color:navy"><external-component-plugins></span></div><div class="" id="LC49" style="padding-left:10px"> <span class="" style="color:navy"><target-component></span>org.exoplatform.web.filter.ExtensibleFilter<span class="" style="color:navy"></target-component></span></div>
<div class="" id="LC50" style="padding-left:10px"> <span class="" style="color:navy"><component-plugin></span></div><div class="" id="LC51" style="padding-left:10px"> <span class="" style="color:navy"><name></span>JSP filter Plugin<span class="" style="color:navy"></name></span></div>
<div class="" id="LC52" style="padding-left:10px"> <span class="" style="color:navy"><set-method></span>addFilterDefinitions<span class="" style="color:navy"></set-method></span></div><div class="" id="LC53" style="padding-left:10px">
<span class="" style="color:navy"><type></span>org.exoplatform.web.filter.FilterDefinitionPlugin<span class="" style="color:navy"></type></span></div><div class="" id="LC54" style="padding-left:10px">
<span class="" style="color:navy"><init-params></span></div><div class="" id="LC55" style="padding-left:10px"> <span class="" style="color:navy"><object-param></span></div>
<div class="" id="LC56" style="padding-left:10px"> <span class="" style="color:navy"><name></span>JSP Filter<span class="" style="color:navy"></name></span></div><div class="" id="LC57" style="padding-left:10px">
<span class="" style="color:navy"><object</span> <span class="" style="color:teal">type=</span><span class="" style="color:rgb(221,17,68)">"org.exoplatform.web.filter.FilterDefinition"</span><span class="" style="color:navy">></span></div>
<div class="" id="LC58" style="padding-left:10px"> <span class="" style="color:navy"><field</span> <span class="" style="color:teal">name=</span><span class="" style="color:rgb(221,17,68)">"filter"</span><span class="" style="color:navy">><object</span> <span class="" style="color:teal">type=</span><span class="" style="color:rgb(221,17,68)">"org.exoplatform.commons.platform.RedefinableResourceFilter"</span><span class="" style="color:navy">/></field></span> </div>
<div class="" id="LC59" style="padding-left:10px"> <span class="" style="color:navy"><field</span> <span class="" style="color:teal">name=</span><span class="" style="color:rgb(221,17,68)">"patterns"</span><span class="" style="color:navy">></span></div>
<div class="" id="LC60" style="padding-left:10px"> <span class="" style="color:rgb(153,153,136);font-style:italic"><!-- WARNING: the mapping is expressed with regular expressions --></span></div>
<div class="" id="LC61" style="padding-left:10px"> <span class="" style="color:navy"><collection</span> <span class="" style="color:teal">type=</span><span class="" style="color:rgb(221,17,68)">"java.util.ArrayList"</span> <span class="" style="color:teal">item-type=</span><span class="" style="color:rgb(221,17,68)">"java.lang.String"</span><span class="" style="color:navy">></span></div>
<div class="" id="LC62" style="padding-left:10px"> <span class="" style="color:navy"><value></span></div><div class="" id="LC63" style="padding-left:10px">
<span class="" style="color:navy"><string></span>.*/.*\.jsp<span class="" style="color:navy"></string></span></div><div class="" id="LC64" style="padding-left:10px">
<span class="" style="color:navy"></value></span></div><div class="" id="LC65" style="padding-left:10px"> <span class="" style="color:navy"><value></span></div>
<div class="" id="LC66" style="padding-left:10px"> <span class="" style="color:navy"><string></span>.*/favicon\.ico<span class="" style="color:navy"></string></span></div><div class="" id="LC67" style="padding-left:10px">
<span class="" style="color:navy"></value></span> </div><div class="" id="LC68" style="padding-left:10px"> <span class="" style="color:navy"></collection></span></div>
<div class="" id="LC69" style="padding-left:10px"> <span class="" style="color:navy"></field></span></div><div class="" id="LC70" style="padding-left:10px"> <span class="" style="color:navy"></object></span></div>
<div class="" id="LC71" style="padding-left:10px"> <span class="" style="color:navy"></object-param></span></div><div class="" id="LC72" style="padding-left:10px"> <span class="" style="color:navy"></init-params></span></div>
<div class="" id="LC73" style="padding-left:10px"> <span class="" style="color:navy"></component-plugin></span></div><div class="" id="LC74" style="padding-left:10px"> <span class="" style="color:navy"></external-component-plugins></span></div>
</pre></div><div><br><div><br></div>It's leveraging a customized filter called : RedefinableResourceFilter that I'm not sure exists in Gatein (but should IMO) :</div><div><br></div><div><br><div><pre style="font-family:Consolas,'Liberation Mono',Courier,monospace;font-size:12px;margin-top:0px;margin-bottom:0px;color:rgb(51,51,51);line-height:17.98611068725586px">
<div class="" id="LC20" style="padding-left:10px"><span class="">package</span> <span class="">org</span><span class="" style="font-weight:bold">.</span><span class="" style="color:teal">exoplatform</span><span class="" style="font-weight:bold">.</span><span class="" style="color:teal">web</span><span class="" style="font-weight:bold">.</span><span class="" style="color:teal">filter</span><span class="" style="font-weight:bold">;</span></div>
<div class="" id="LC21" style="padding-left:10px"><br></div><div class="" id="LC22" style="padding-left:10px"><span class="">import</span> <span class="" style="color:rgb(85,85,85)">org.exoplatform.container.PortalContainer</span><span class="" style="font-weight:bold">;</span></div>
<div class="" id="LC23" style="padding-left:10px"><br></div><div class="" id="LC24" style="padding-left:10px"><span class="">import</span> <span class="" style="color:rgb(85,85,85)">java.io.IOException</span><span class="" style="font-weight:bold">;</span></div>
<div class="" id="LC25" style="padding-left:10px"><br></div><div class="" id="LC26" style="padding-left:10px"><span class="">import</span> <span class="" style="color:rgb(85,85,85)">javax.servlet.FilterChain</span><span class="" style="font-weight:bold">;</span></div>
<div class="" id="LC27" style="padding-left:10px"><span class="">import</span> <span class="" style="color:rgb(85,85,85)">javax.servlet.ServletContext</span><span class="" style="font-weight:bold">;</span></div><div class="" id="LC28" style="padding-left:10px">
<span class="">import</span> <span class="" style="color:rgb(85,85,85)">javax.servlet.ServletException</span><span class="" style="font-weight:bold">;</span></div><div class="" id="LC29" style="padding-left:10px"><span class="">import</span> <span class="" style="color:rgb(85,85,85)">javax.servlet.ServletRequest</span><span class="" style="font-weight:bold">;</span></div>
<div class="" id="LC30" style="padding-left:10px"><span class="">import</span> <span class="" style="color:rgb(85,85,85)">javax.servlet.ServletResponse</span><span class="" style="font-weight:bold">;</span></div><div class="" id="LC31" style="padding-left:10px">
<span class="">import</span> <span class="" style="color:rgb(85,85,85)">javax.servlet.http.HttpServletRequest</span><span class="" style="font-weight:bold">;</span></div><div class="" id="LC32" style="padding-left:10px">
<br>
</div><div class="" id="LC33" style="padding-left:10px"><span class="" style="font-weight:bold">public</span> <span class="" style="font-weight:bold">class</span> <span class="" style="color:rgb(68,85,136);font-weight:bold">RedefinableResourceFilter</span> <span class="" style="font-weight:bold">implements</span> <span class="">Filter</span> <span class="" style="font-weight:bold">{</span></div>
<div class="" id="LC34" style="padding-left:10px"><br></div><div class="" id="LC35" style="padding-left:10px"> <span class="" style="font-weight:bold">public</span> <span class="" style="color:rgb(68,85,136);font-weight:bold">void</span> <span class="" style="color:rgb(153,0,0);font-weight:bold">doFilter</span><span class="" style="font-weight:bold">(</span><span class="">ServletRequest</span> <span class="">request</span><span class="" style="font-weight:bold">,</span> <span class="">ServletResponse</span> <span class="">response</span><span class="" style="font-weight:bold">,</span> <span class="">FilterChain</span> <span class="">chain</span><span class="" style="font-weight:bold">)</span> <span class="" style="font-weight:bold">throws</span> <span class="">IOException</span><span class="" style="font-weight:bold">,</span></div>
<div class="" id="LC36" style="padding-left:10px"> <span class="">ServletException</span> <span class="" style="font-weight:bold">{</span></div>
<div class="" id="LC37" style="padding-left:10px"> <span class="">HttpServletRequest</span> <span class="">req</span> <span class="" style="font-weight:bold">=</span> <span class="" style="font-weight:bold">(</span><span class="">HttpServletRequest</span><span class="" style="font-weight:bold">)</span> <span class="">request</span><span class="" style="font-weight:bold">;</span></div>
<div class="" id="LC41" style="padding-left:10px"> <span class="">PortalContainer</span> <span class="">pContainer</span> <span class="" style="font-weight:bold">=</span> <span class="">PortalContainer</span><span class="" style="font-weight:bold">.</span><span class="" style="color:teal">getInstance</span><span class="" style="font-weight:bold">(</span><span class="">req</span><span class="" style="font-weight:bold">.</span><span class="" style="color:teal">getSession</span><span class="" style="font-weight:bold">().</span><span class="" style="color:teal">getServletContext</span><span class="" style="font-weight:bold">());</span></div>
<div class="" id="LC45" style="padding-left:10px"> <span class="">ServletContext</span> <span class="">context</span> <span class="" style="font-weight:bold">=</span> <span class="">pContainer</span><span class="" style="font-weight:bold">.</span><span class="" style="color:teal">getPortalContext</span><span class="" style="font-weight:bold">();</span></div>
<div class="" id="LC46" style="padding-left:10px"> <span class="">String</span> <span class="">path</span> <span class="" style="font-weight:bold">=</span> <span class="">req</span><span class="" style="font-weight:bold">.</span><span class="" style="color:teal">getRequestURI</span><span class="" style="font-weight:bold">();</span></div>
<div class="" id="LC47" style="padding-left:10px"> <span class="">String</span> <span class="">ctx</span> <span class="" style="font-weight:bold">=</span> <span class="">req</span><span class="" style="font-weight:bold">.</span><span class="" style="color:teal">getContextPath</span><span class="" style="font-weight:bold">();</span></div>
<div class="" id="LC48" style="padding-left:10px"> <span class="" style="font-weight:bold">if</span> <span class="" style="font-weight:bold">(</span><span class="">ctx</span> <span class="" style="font-weight:bold">!=</span> <span class="" style="font-weight:bold">null</span> <span class="" style="font-weight:bold">&&</span> <span class="">ctx</span><span class="" style="font-weight:bold">.</span><span class="" style="color:teal">length</span><span class="" style="font-weight:bold">()</span> <span class="" style="font-weight:bold">></span> <span class="" style="color:rgb(0,153,153)">1</span> <span class="" style="font-weight:bold">&&</span> <span class="">path</span><span class="" style="font-weight:bold">.</span><span class="" style="color:teal">startsWith</span><span class="" style="font-weight:bold">(</span><span class="">ctx</span><span class="" style="font-weight:bold">))</span> <span class="" style="font-weight:bold">{</span></div>
<div class="" id="LC49" style="padding-left:10px"> <span class="">path</span> <span class="" style="font-weight:bold">=</span> <span class="">path</span><span class="" style="font-weight:bold">.</span><span class="" style="color:teal">substring</span><span class="" style="font-weight:bold">(</span><span class="">ctx</span><span class="" style="font-weight:bold">.</span><span class="" style="color:teal">length</span><span class="" style="font-weight:bold">());</span></div>
<div class="" id="LC50" style="padding-left:10px"> <span class="" style="font-weight:bold">}</span></div><div class="" id="LC51" style="padding-left:10px"> <span class="">context</span><span class="" style="font-weight:bold">.</span><span class="" style="color:teal">getRequestDispatcher</span><span class="" style="font-weight:bold">(</span><span class="">path</span><span class="" style="font-weight:bold">).</span><span class="" style="color:teal">include</span><span class="" style="font-weight:bold">(</span><span class="">request</span><span class="" style="font-weight:bold">,</span> <span class="">response</span><span class="" style="font-weight:bold">);</span></div>
<div class="" id="LC52" style="padding-left:10px"> <span class="" style="font-weight:bold">}</span></div><div class="" id="LC53" style="padding-left:10px"><br></div><div class="" id="LC54" style="padding-left:10px"><span class="" style="font-weight:bold">}</span></div>
</pre><div><br></div><div><br></div></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Fri, Nov 29, 2013 at 3:23 PM, Juraci Paixão Kröhling <span dir="ltr"><<a href="mailto:jpkroehling@redhat.com" target="_blank">jpkroehling@redhat.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Nicolas,<br>
<br>
My goal is to change the favicon from /portal, without affecting custom<br>
modifications that might have been done at /sample-portal. I think we<br>
have already this behavior for templates via extensions, but it doesn't<br>
seem to work for other resources (like .ico files).<br>
<br>
The final solution could be anything (extensions, service, ...), hence<br>
the request for suggestions :-)<br>
<br>
- Juca.<br>
<div class="im"><br>
On 11/28/2013 05:07 PM, Nicolas Filotto wrote:<br>
> I'm not sure I understand what you want to do, you want to be able to<br>
> modify the favicon from an extension (like sample-extension) or from an<br>
> new portal (like sample-portal)?<br>
><br>
><br>
> On Thu, Nov 28, 2013 at 3:40 PM, Juraci Paixão Kröhling<br>
</div><div><div class="h5">> <<a href="mailto:jpkroehling@redhat.com">jpkroehling@redhat.com</a> <mailto:<a href="mailto:jpkroehling@redhat.com">jpkroehling@redhat.com</a>>> wrote:<br>
><br>
> All,<br>
><br>
> We have a request to display a specific favicon for JBoss Portal, and it<br>
> seems there's no "easy" (or correct) solution in place for that<br>
> right now.<br>
><br>
> The first intuitive solution would be to override the templates, to make<br>
> them link to the desired favicon. This doesn't scales, as the whole<br>
> template is duplicated and it will only cause headaches in the future.<br>
><br>
> The second possible solution would be to incorporate the path to the<br>
> favicon into the properties file, but this means having a fixed path to<br>
> the favicon, which is a step backwards from what there is today: in one<br>
> of the templates for /portal, it gets the favicon for the context path,<br>
> so, if the current portal is /example-portal, it currently gets the<br>
> favicon at /example-portal/favicon . With the favicon coming from the<br>
> properties file, this would not be the case anymore, as all favicons<br>
> would be coming from a fixed path.<br>
><br>
> The third solution would be to build a FaviconService, that would take<br>
> care of determining the proper favicon path. It sounds to me that this<br>
> is a bit of overkill, but would be a clean solution.<br>
><br>
> Of course, the best option would be to be possible to override the<br>
> favicon from /portal, but this doesn't seems to be possible at the<br>
> moment. It seems that only templates are overriden.<br>
><br>
> Before proceeding with the third solution (which seems the most<br>
> desirable as of now), I would like to get your comments, opinions and<br>
> suggestions on how this could be better handled.<br>
><br>
> Best Regards,<br>
> Juca.<br>
><br>
><br>
> _______________________________________________<br>
> gatein-dev mailing list<br>
</div></div>> <a href="mailto:gatein-dev@lists.jboss.org">gatein-dev@lists.jboss.org</a> <mailto:<a href="mailto:gatein-dev@lists.jboss.org">gatein-dev@lists.jboss.org</a>><br>
> <a href="https://lists.jboss.org/mailman/listinfo/gatein-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/gatein-dev</a><br>
<div class="HOEnZb"><div class="h5">><br>
><br>
><br>
><br>
> _______________________________________________<br>
> gatein-dev mailing list<br>
> <a href="mailto:gatein-dev@lists.jboss.org">gatein-dev@lists.jboss.org</a><br>
> <a href="https://lists.jboss.org/mailman/listinfo/gatein-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/gatein-dev</a><br>
><br>
<br>
<br>
</div></div><br>_______________________________________________<br>
gatein-dev mailing list<br>
<a href="mailto:gatein-dev@lists.jboss.org">gatein-dev@lists.jboss.org</a><br>
<a href="https://lists.jboss.org/mailman/listinfo/gatein-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/gatein-dev</a><br></blockquote></div><br><br clear="all"><div><br></div>-- <br><b><span style="font-weight:normal;background-color:rgb(255,255,255)"><span style="font-family:'lucida grande',arial,helvetica,sans-serif;color:rgb(128,128,128);font-size:small">Patrice Lamarque</span><br>
<span style="font-family:'lucida grande',arial,helvetica,sans-serif;color:rgb(128,128,128);font-size:x-small">eXo - VP Products </span><br><font color="#ff6600" face="'lucida grande', arial, helvetica, sans-serif" size="1"><br>
</font></span></b>
</div>