beginner trouble with welcome file/home: domain not redirected, links don't work

Splash Forums PrettyFaces Users beginner trouble with welcome file/home: domain not redirected, links don't work

This topic contains 2 replies, has 2 voices, and was last updated by  bcn 5 years, 11 months ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #18084

    bcn
    Participant

    Hi,

    I just started with PrettyFaces and ran into these problem:

    My web app is at root context. When only the domain is entered, it should

    redirect to http://www.mydomain.com/home/. This does not work.

    I tried <rewrite match=”/” substitute=”/home/” />

    which gives an infinite loop of /home/home/home/… in the address bar.

    The mappings are

    @URLMappings(mappings = {

    @URLMapping(pattern = "/home/", viewId = "/index.jsf", id="index", outbound=false),

    @URLMapping(pattern = "/", viewId = "/index.jsf", id="root") })

    Second big problem: when I go explicitly to the http://www.mydomain.com/home/ page, the links to images and scripts are changed dynamically, so I see in firebug

    404 Not Found – http://127.0.0.1:81/home/images/banner/slide_1.jpg

    It should be http://127.0.0.1:81/images/banner/slide_1.jpg instead.

    I tried with/without outbound at either mapping, no luck.

    Configuration:

    RichFaces 4.0.0, PrettyFaces 3.3.1, JBoss AS 7.

    web.xml:

    <welcome-file-list>

    <welcome-file>index.jsf</welcome-file>

    </welcome-file-list>

    <servlet-mapping>

    <servlet-name>Faces Servlet</servlet-name>

    <url-pattern>*.jsf</url-pattern>

    </servlet-mapping>

    Thanks in advance

    #21679

    Hi,

    Try using a more restrictive regex:

    <rewrite match="^/$ substitute="/home/" />

    Does this help?

    ~Lincoln

    #21680

    bcn
    Participant

    Yes, at the end I use

    <rewrite match=”^/$” substitute=”/home” trailingSlash=”remove”/>

    because to get around the second problem I found that the mapping without trailing slashes works:

    @URLMapping(pattern = “/home”, viewId = “/index.jsf”, id = “index”),

    @URLMapping(pattern = “”, viewId = “/index.jsf”, id = “root”),

    Thanks!

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

You must be logged in to reply to this topic.

Comments are closed.