Problem with images and trailingSlash=append
January 20, 2011 at 2:35 pm #17855
When writing a rule to add slashes at the end of the urls works fine, but do not display the images on the site, in my pretty-config file I added the following rule to try to fix it:
<rewrite match="(?!.*resources.*).*" trailingSlash="append" toCase="lowercase" />
I tried the above regex in “http://www.regexplanet.com/simple/index.html” and it works fine, but not on my site, my development environment is as follows:
– JSF 2
– EJB 3
– Glassfish v3
– PrimeFaces 2.2
For example I have the following line in index.xhtml:
<h:graphicImage url=”/resources/imagenes/logo.png” width=”110px” height=”110px”/>
The rendered output is:
<img src=”/sistelweb/resources/imagenes/logo.png/” height=”110px” width=”110px” />
If the rule is fine, I do not know because it keeps adding slash at the end…
I need your help, I would integrate Prettyface to my project, that is all that I can not solve. Thanks in advanced.
PD: Sorry for my bad English, greetings from Ecuador.January 23, 2011 at 3:18 pm #20632
Could you perhaps provide a minimal demo application reproducing this issue? You could use one of the PrettyFaces archetypes if you want.
It is very strange that this is happening as your regular expression looks fine.January 25, 2011 at 8:59 pm #20633
I created a basic example of what I’m doing (http://www.mediafire.com/?k85rgqo5azamago), it is strange what is happening, according to the rule when the URL contains the word “imagenes” should not apply.
The code in my index.html is the following:
<?xml version=’1.0′ encoding=’UTF-8′ ?>
<!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd”>
<f:view contentType=”text/html” >
<img src=”/WebApplication1/resources/imagenes/logo.png” width=”110px” height=”110px” alt=”” />
<h:link value=”Contacto” outcome=”contacto” />
<h:link value=”Productos” outcome=”productos” />
<h:outputLink value=”/WebApplication1/dos.xhtml” >Productos</h:outputLink>
My pretty-config.xml has the same rule.
In the project I uploaded are all the files, I used to run:
JDK 6 update 23
Glassfish 3.0.1January 26, 2011 at 5:17 am #20634
Thank you! I’ll take a look at it an come back to you as soon as possible..January 26, 2011 at 9:48 am #20635
Don’t ask my why but this seems to do the job:
<rewrite match="^((?!imagenes).)*$" trailingSlash="append" toCase="lowercase" />
Here is the page I got the hint from:January 26, 2011 at 6:12 pm #20636
Excellent, I don’t understand that regex but it works… thanks very much…January 27, 2011 at 6:52 am #20637
Yeah, this regex looks very odd. But it seems to do the job. I guess we should mention this in the documentation because “everything but” is a very common pattern especially when using
You must be logged in to reply to this topic.