Problem with images and trailingSlash=append

Splash Forums PrettyFaces Users Problem with images and trailingSlash=append

This topic contains 6 replies, has 2 voices, and was last updated by  Christian Kaltepoth 6 years, 8 months ago.

Viewing 7 posts - 1 through 7 (of 7 total)
  • Author
    Posts
  • #17855

    Lynx6
    Participant

    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:

    <pretty-config xmlns="http://ocpsoft.com/prettyfaces/3.2.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://ocpsoft.com/prettyfaces/3.2.0
    http://ocpsoft.com/xml/ns/prettyfaces/ocpsoft-pretty-faces-3.2.0.xsd">

    <rewrite match="(?!.*resources.*).*" trailingSlash="append" toCase="lowercase" />

    </pretty-config>

    I tried the above regex in “http://www.regexplanet.com/simple/index.html&#8221; and it works fine, but not on my site, my development environment is as follows:

    – JSF 2

    – EJB 3

    – Facelets

    – Glassfish v3

    – PrimeFaces 2.2

    – JQuery

    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.

    #20632

    Could you perhaps provide a minimal demo application reproducing this issue? You could use one of the PrettyFaces archetypes if you want.

    https://github.com/chkal/prettyfaces-archetypes/wiki

    It is very strange that this is happening as your regular expression looks fine.

    #20633

    Lynx6
    Participant

    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”&gt;

    <html xmlns=”http://www.w3.org/1999/xhtml&#8221;

    xmlns:h=”http://java.sun.com/jsf/html&#8221;

    xmlns:f=”http://java.sun.com/jsf/core”&gt;

    <f:view contentType=”text/html” >

    <h:head>

    <title>Facelet Title</title>

    </h:head>

    <h:body>

    <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>

    </h:body>

    </f:view>

    </html>

    My pretty-config.xml has the same rule.

    In the project I uploaded are all the files, I used to run:

    Netbeans 6.9.1

    JDK 6 update 23

    Glassfish 3.0.1

    #20634

    Thank you! I’ll take a look at it an come back to you as soon as possible..

    #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:

    http://stackoverflow.com/questions/406230/regular-expression-to-match-string-not-containing-a-word

    #20636

    Lynx6
    Participant

    Excellent, I don’t understand that regex but it works… thanks very much… :D

    #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 trailingSlash and toCase.

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic.

Comments are closed.