Redirect to external URL

Splash Forums PrettyFaces Users Redirect to external URL

This topic contains 19 replies, has 4 voices, and was last updated by  m1m 5 years, 7 months ago.

Viewing 15 posts - 1 through 15 (of 20 total)
  • Author
    Posts
  • #17877

    Moddus
    Participant

    Hi,

    is it possible to redirect to a external URL ?

    Example:

    <url-mapping id=”foo”>

    <pattern>/bar</pattern>

    <view-id>http://www.google.de</view-id&gt;

    </url-mapping>

    Of course it can’t work to put the external URL into the view-id Tag. It was only meant as an example.

    Thanks

    #20722
    #20723

    <rewrite match="/foo" url="http://www.google.de" />

    #20724

    Moddus
    Participant

    Hi,

    first of all thanks for your replay.

    I tried to use <rewirte> to solve my problem but it doesn’t work.

    I’ve create a link in my jsf page.

    For example:

    http://localhost:8080/prettytest/foo/bar

    In my pretty-config.xml i’ve created following rewrite-rule:

    <rewrite match=”/foo/bar” url=”http://www.google.de&#8221; redirect=”301″/>

    PrettyFaces rewrites http://localhost:8080/prettytest/foo/bar to http://localhost:8080/prettytest/http://www.google.de. So now i get 404 Error by using the link. Of course because the link was not rewrite to http://www.google.de.

    Where is my mistake ?

    Thanks

    #20725

    Hey Moddus,

    your configuration is correct. Unfortunately there is a known bug in PrettyFaces 3.2.0 that causes this broken link. Could you switch to 3.1.0 and try again? It should work there without problems. I hope to find some time in the next days to fix this issue.

    Christian

    #20726

    Moddus
    Participant

    Hi Christian,

    thanks for your turbo fast replay ;)

    I switched to 3.1.0 and 3.0.0. But it have the same im Problem in this versions.

    I used following maven dependencies:

    <dependency>

    <groupId>com.ocpsoft</groupId>

    <artifactId>prettyfaces-jsf12</artifactId>

    <version>(3.0.0 to 3.2.0)</version>

    </dependency>

    Thanks,

    Markus

    #20727

    Hey Markus,

    I just checked this again and I can confirm that 3.1.0 works well:

    <dependency>
    <groupId>com.ocpsoft</groupId>
    <artifactId>prettyfaces-jsf12</artifactId>
    <version>3.1.0</version>
    </dependency>

    <rewrite match="/foo/bar" url="http://www.google.de" redirect="301"/>

    Just 3.2.0 is currently broken. Could you make sure PrettyFaces 3.1.0 is the only PrettyFaces version on your classpath? Some build tools (like M2Eclipse) require you to perform a full “clean” if you change an artifact version as otherwise there may be older JARs in your classpath.

    Christian

    #20728

    Moddus
    Participant

    Hi Christian,

    i created an new Example Application with prettyfaces 3.1.0 an everythink works fine!

    Now i have just to figure out why prettyfaces is not running in my Project. I’m sure there aren’t classpath problems. What ever … :)

    Thanks for your great support and your work !

    PrettyFaces ROCKS !!!

    #20729

    Awesome! Glad you got *something* working! We will keep looking in to this though :)

    #20730

    Hey Markus,

    I hope you get it working in your primary project too! :-)

    I’m currently working on the redirect issues you had with 3.2.0. I think I found the root cause of the problem. I will push a fix to the main repository tomorrow. It would be great if you could find some time to check the latest snapshots and if they work for you then.

    I’ll come back to you as soon as the new snapshots with my fix are ready! I just want to double check everything to make sure the patch doesn’t break anything! :-)

    Christian

    #20731

    Hey Markus,

    I think I’ve fixed your issue regarding the external redirect. Could you perhaps give the latest snapshot a try and confirm that it is working for you?

    Just add the following repository to your pom.xml:

    <repository>
    <id>ocpsoft</id>
    <name>OcpSoft</name>
    <url>http://ocpsoft.com/repository/</url>
    <releases>
    <enabled>true</enabled>
    </releases>
    <snapshots>
    <enabled>true</enabled>
    </snapshots>
    </repository>

    Then change the PrettyFaces version to 3.2.1-SNAPSHOT:

    <dependency>
    <groupId>com.ocpsoft</groupId>
    <artifactId>prettyfaces-jsf12</artifactId>
    <version>3.2.1-SNAPSHOT</version>
    </dependency>

    Thanks

    Christian

    #20732

    Moddus
    Participant

    Hi Christian,

    i’ve tested the latest snapshot an my rewrite:

    <rewrite match=”/foo/bar” url=”http://www.google.de&#8221; redirect=”301″/>

    is working.

    Thanks for fixing and i await the next release :)

    Markus

    #20733

    Great! Thanks for testing! :-)

    #20734

    m1m
    Participant

    Unfortuntely it’s not working with latest 3.3.3 snapshot:

    <rewrite match="/test" url="http://google.com/"/>

    and I’ve got redirected to:

    http://localhost/http:/google.com/index.xhtml

    #20735

    Hey M1m,

    Did this work in previous versions for you?

    Thanks,

    Lincoln

Viewing 15 posts - 1 through 15 (of 20 total)

You must be logged in to reply to this topic.

Comments are closed.