How to do parameterization?

Splash Forums Rewrite Users How to do parameterization?

This topic contains 16 replies, has 3 voices, and was last updated by  banifou 2 years, 10 months ago.

Viewing 15 posts - 1 through 15 (of 17 total)
  • Author
    Posts
  • #24954

    banifou
    Participant

    Hello,

    I want to rewrite an url like this

    http://www.mywebsite.com/page.jsf?id=1234

    to

    http://www.mywebsite.com/page/1234

    . I tried with .addRule(Join.path("/page/{id}").to("/page.jsf")); but no success.

    What am I doing wrong? Thanks

    #24955

    Your configuration looks good. Does Rewrite start up correctly? You should see something like this in the logs:

    2013-09-19 13:30:52,840 INFO  [RewriteFilter] RewriteFilter initialized.
    
    #24956

    banifou
    Participant

    Yes, is there. Other rewrites are working, like .addRule(Join.path("/home").to("/home.jsf"))

    #24957

    Could you explain a little bit more what happens when you try to navigate to something like /page/1234? Do you get a 404? Or does the page start to render but fails due to a missing value of the id?

    #24958

    banifou
    Participant

    It works! Everything is fine. I thought when I click http://www.mywebsite.com/page.jsf?id=1234 its gonna be redirected to http://www.mywebsite.com/page/1234!!
    Its much easier! I like ocpsoft 😉

    Thank u very much for ur fast reply.

    #24959

    Hey there banifou!

    If you want to do inbound redirection, then your rule should specify that 🙂

    .addRule(Join.path("/page/{id}").to("/page.jsf").withInboundCorrection());

    Cheers!

    #24960

    banifou
    Participant

    hmm, this seams not to work for me. The redirection as mentioned above is not taking place! At least not with a h:link like <h:link value="click me" outcome="/page.jsf" >
    <f:param name="id" value="#{mybean.id}" />
    </h:link>

    • This reply was modified 2 years, 10 months ago by  banifou.
    #24963

    Hmmm…. that link should be rewritten for you automatically to “/page/{id}” even without this setting. Is this not occurring?

    #24964

    banifou
    Participant

    Unfortunately not!?

    #24965

    0_o…

    Can you maybe upload a sample app that reproduces this?

    #24966

    You could have a look at the Bookstore showcase app:

    https://github.com/ocpsoft/rewrite/tree/master/showcase/bookstore

    There are many Joins with parameters in there.

    BTW: Which version of Rewrite do you use? And which modules did you add to your project. Did you add rewrite-integration-faces or rewrite-config-prettyfaces?

    #24969

    banifou
    Participant

    This is a bigger project using (Primefaces-3.5, Springframework-3.1.2, Spring Security-3.1.2, Omnifaces-1.5, rewrite-servlet-2.0.7).
    I did not add rewrite-integration-faces or rewrite-config-prettyfaces.
    I’ll try this now.

    #24970

    If you just started using Rewrite, I recommend to add rewrite-integration-faces instead of rewrite-config-prettyfaces.

    #24971

    banifou
    Participant

    I just tried rewrite-integration-faces, no effect!

    #24972

    banifou
    Participant

    Does it matter where to put the Joins? As Annotation in the beans or as a rule in the ConfigProvider? thanks

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

You must be logged in to reply to this topic.

Comments are closed.