<div dir="ltr">We&#39;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,&#39;Liberation Mono&#39;,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">&lt;external-component-plugins&gt;</span></div><div class="" id="LC49" style="padding-left:10px">                <span class="" style="color:navy">&lt;target-component&gt;</span>org.exoplatform.web.filter.ExtensibleFilter<span class="" style="color:navy">&lt;/target-component&gt;</span></div>

<div class="" id="LC50" style="padding-left:10px">                <span class="" style="color:navy">&lt;component-plugin&gt;</span></div><div class="" id="LC51" style="padding-left:10px">                        <span class="" style="color:navy">&lt;name&gt;</span>JSP filter Plugin<span class="" style="color:navy">&lt;/name&gt;</span></div>

<div class="" id="LC52" style="padding-left:10px">                        <span class="" style="color:navy">&lt;set-method&gt;</span>addFilterDefinitions<span class="" style="color:navy">&lt;/set-method&gt;</span></div><div class="" id="LC53" style="padding-left:10px">

                        <span class="" style="color:navy">&lt;type&gt;</span>org.exoplatform.web.filter.FilterDefinitionPlugin<span class="" style="color:navy">&lt;/type&gt;</span></div><div class="" id="LC54" style="padding-left:10px">

                        <span class="" style="color:navy">&lt;init-params&gt;</span></div><div class="" id="LC55" style="padding-left:10px">                                <span class="" style="color:navy">&lt;object-param&gt;</span></div>

<div class="" id="LC56" style="padding-left:10px">                                        <span class="" style="color:navy">&lt;name&gt;</span>JSP Filter<span class="" style="color:navy">&lt;/name&gt;</span></div><div class="" id="LC57" style="padding-left:10px">

                                        <span class="" style="color:navy">&lt;object</span> <span class="" style="color:teal">type=</span><span class="" style="color:rgb(221,17,68)">&quot;org.exoplatform.web.filter.FilterDefinition&quot;</span><span class="" style="color:navy">&gt;</span></div>

<div class="" id="LC58" style="padding-left:10px">                                                <span class="" style="color:navy">&lt;field</span> <span class="" style="color:teal">name=</span><span class="" style="color:rgb(221,17,68)">&quot;filter&quot;</span><span class="" style="color:navy">&gt;&lt;object</span> <span class="" style="color:teal">type=</span><span class="" style="color:rgb(221,17,68)">&quot;org.exoplatform.commons.platform.RedefinableResourceFilter&quot;</span><span class="" style="color:navy">/&gt;&lt;/field&gt;</span>                                </div>

<div class="" id="LC59" style="padding-left:10px">                                                <span class="" style="color:navy">&lt;field</span> <span class="" style="color:teal">name=</span><span class="" style="color:rgb(221,17,68)">&quot;patterns&quot;</span><span class="" style="color:navy">&gt;</span></div>

<div class="" id="LC60" style="padding-left:10px">                            <span class="" style="color:rgb(153,153,136);font-style:italic">&lt;!-- WARNING: the mapping is expressed with regular expressions --&gt;</span></div>

<div class="" id="LC61" style="padding-left:10px">                                                        <span class="" style="color:navy">&lt;collection</span> <span class="" style="color:teal">type=</span><span class="" style="color:rgb(221,17,68)">&quot;java.util.ArrayList&quot;</span> <span class="" style="color:teal">item-type=</span><span class="" style="color:rgb(221,17,68)">&quot;java.lang.String&quot;</span><span class="" style="color:navy">&gt;</span></div>

<div class="" id="LC62" style="padding-left:10px">                                                                <span class="" style="color:navy">&lt;value&gt;</span></div><div class="" id="LC63" style="padding-left:10px">

                                                                        <span class="" style="color:navy">&lt;string&gt;</span>.*/.*\.jsp<span class="" style="color:navy">&lt;/string&gt;</span></div><div class="" id="LC64" style="padding-left:10px">

                                                                <span class="" style="color:navy">&lt;/value&gt;</span></div><div class="" id="LC65" style="padding-left:10px">                                <span class="" style="color:navy">&lt;value&gt;</span></div>

<div class="" id="LC66" style="padding-left:10px">                                  <span class="" style="color:navy">&lt;string&gt;</span>.*/favicon\.ico<span class="" style="color:navy">&lt;/string&gt;</span></div><div class="" id="LC67" style="padding-left:10px">

                                <span class="" style="color:navy">&lt;/value&gt;</span>                </div><div class="" id="LC68" style="padding-left:10px">                                                        <span class="" style="color:navy">&lt;/collection&gt;</span></div>

<div class="" id="LC69" style="padding-left:10px">                                                <span class="" style="color:navy">&lt;/field&gt;</span></div><div class="" id="LC70" style="padding-left:10px">                                        <span class="" style="color:navy">&lt;/object&gt;</span></div>

<div class="" id="LC71" style="padding-left:10px">                                <span class="" style="color:navy">&lt;/object-param&gt;</span></div><div class="" id="LC72" style="padding-left:10px">                        <span class="" style="color:navy">&lt;/init-params&gt;</span></div>

<div class="" id="LC73" style="padding-left:10px">                <span class="" style="color:navy">&lt;/component-plugin&gt;</span></div><div class="" id="LC74" style="padding-left:10px">        <span class="" style="color:navy">&lt;/external-component-plugins&gt;</span></div>

</pre></div><div><br><div><br></div>It&#39;s leveraging a customized filter called :  RedefinableResourceFilter that I&#39;m not sure exists in Gatein (but should IMO) :</div><div><br></div><div><br><div><pre style="font-family:Consolas,&#39;Liberation Mono&#39;,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">&amp;&amp;</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">&gt;</span> <span class="" style="color:rgb(0,153,153)">1</span> <span class="" style="font-weight:bold">&amp;&amp;</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">&lt;<a href="mailto:jpkroehling@redhat.com" target="_blank">jpkroehling@redhat.com</a>&gt;</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&#39;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>
&gt; I&#39;m not sure I understand what you want to do, you want to be able to<br>
&gt; modify the favicon from an extension (like sample-extension) or from an<br>
&gt; new portal (like sample-portal)?<br>
&gt;<br>
&gt;<br>
&gt; On Thu, Nov 28, 2013 at 3:40 PM, Juraci Paixão Kröhling<br>
</div><div><div class="h5">&gt; &lt;<a href="mailto:jpkroehling@redhat.com">jpkroehling@redhat.com</a> &lt;mailto:<a href="mailto:jpkroehling@redhat.com">jpkroehling@redhat.com</a>&gt;&gt; wrote:<br>
&gt;<br>
&gt;     All,<br>
&gt;<br>
&gt;     We have a request to display a specific favicon for JBoss Portal, and it<br>
&gt;     seems there&#39;s no &quot;easy&quot; (or correct) solution in place for that<br>
&gt;     right now.<br>
&gt;<br>
&gt;     The first intuitive solution would be to override the templates, to make<br>
&gt;     them link to the desired favicon. This doesn&#39;t scales, as the whole<br>
&gt;     template is duplicated and it will only cause headaches in the future.<br>
&gt;<br>
&gt;     The second possible solution would be to incorporate the path to the<br>
&gt;     favicon into the properties file, but this means having a fixed path to<br>
&gt;     the favicon, which is a step backwards from what there is today: in one<br>
&gt;     of the templates for /portal, it gets the favicon for the context path,<br>
&gt;     so, if the current portal is /example-portal, it currently gets the<br>
&gt;     favicon at /example-portal/favicon . With the favicon coming from the<br>
&gt;     properties file, this would not be the case anymore, as all favicons<br>
&gt;     would be coming from a fixed path.<br>
&gt;<br>
&gt;     The third solution would be to build a FaviconService, that would take<br>
&gt;     care of determining the proper favicon path. It sounds to me that this<br>
&gt;     is a bit of overkill, but would be a clean solution.<br>
&gt;<br>
&gt;     Of course, the best option would be to be possible to override the<br>
&gt;     favicon from /portal, but this doesn&#39;t seems to be possible at the<br>
&gt;     moment. It seems that only templates are overriden.<br>
&gt;<br>
&gt;     Before proceeding with the third solution (which seems the most<br>
&gt;     desirable as of now), I would like to get your comments, opinions and<br>
&gt;     suggestions on how this could be better handled.<br>
&gt;<br>
&gt;     Best Regards,<br>
&gt;     Juca.<br>
&gt;<br>
&gt;<br>
&gt;     _______________________________________________<br>
&gt;     gatein-dev mailing list<br>
</div></div>&gt;     <a href="mailto:gatein-dev@lists.jboss.org">gatein-dev@lists.jboss.org</a> &lt;mailto:<a href="mailto:gatein-dev@lists.jboss.org">gatein-dev@lists.jboss.org</a>&gt;<br>
&gt;     <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">&gt;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; gatein-dev mailing list<br>
&gt; <a href="mailto:gatein-dev@lists.jboss.org">gatein-dev@lists.jboss.org</a><br>
&gt; <a href="https://lists.jboss.org/mailman/listinfo/gatein-dev" target="_blank">https://lists.jboss.org/mailman/listinfo/gatein-dev</a><br>
&gt;<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:&#39;lucida grande&#39;,arial,helvetica,sans-serif;color:rgb(128,128,128);font-size:small">Patrice Lamarque</span><br>

<span style="font-family:&#39;lucida grande&#39;,arial,helvetica,sans-serif;color:rgb(128,128,128);font-size:x-small">eXo - VP Products </span><br><font color="#ff6600" face="&#39;lucida grande&#39;, arial, helvetica, sans-serif" size="1"><br>

</font></span></b>
</div>