OCPsoft Rewrite Rule no longer works after Update from 1.0.5 to 1.1.0

Splash Forums Rewrite Users OCPsoft Rewrite Rule no longer works after Update from 1.0.5 to 1.1.0

This topic contains 12 replies, has 2 voices, and was last updated by  Lincoln Baxter III 4 years, 3 months ago.

Viewing 13 posts - 1 through 13 (of 13 total)
  • Author
    Posts
  • #19265

    Anonymous

    See my question on stackoverflow please: http://stackoverflow.com/questions/14032854/ocpsoft-rewrite-rule-no-longer-works-after-update-from-1-0-5-to-1-1-0

    I would be happy if someone could help me :)

    #23337

    As answered on StackOverflow:

    Hmm.. that does look like a bug, I’ll try to reproduce this, but you shouldn’t need to re-define {i} and {d} in the target URL. Join will handle that for you automatically if you use request binding, like so:

    .addRule(
    Join.path("/{i}/{d}")
    .where("i").matches("[-_a-zA-Z0-9~*]{8}")
    .where("d").matches("[-_a-zA-Z0-9~*]{32}")
    .to("/resources/html/user/doSomething.html").withRequestBinding();
    )

    I’m guessing if you do that, your problem will go away. You can also use .withInboundCorrection() if you’d like to redirect requests for the old .html URL to the new URL.

    If you still have a problem with this, please post on the support forums and we’ll get it figured out :)

    Sorry you had trouble, hopefully it won’t be trouble any more :)

    #23338

    Anonymous

    Thanks for your fast reply (:

    I changed the rule according to your post and it keeps working in 1.0.5 but fails again in 1.1.0 with the same exception as it did before.

    Edit: Just in case it’s important: The exception is already thrown at server startup, before actually requesting the rewritten URL.

    #23339

    Hmmm okay. Could you perhaps upload an example app that reproduces this so that I can debug? Thanks! We’ll get it figured out, and we have a new release coming soon (2.0.0) so it will be fixed in no time.

    #23340

    Ok, I figured it out. This makes sense but needs to be fixed. You can work around the issue by doing this instead. The NPE comes because the target resource location is not defined yet.

    .addRule(
    Join.path("/{i}/{d}").to("/resources/html/user/doSomething.html")
    .where("i").matches("[-_a-zA-Z0-9~*]{8}")
    .where("d").matches("[-_a-zA-Z0-9~*]{32}");
    )

    #23341

    Anonymous

    Hi again. I finally found the time to build a small example project. The pom.xml only consists of MyFaces, the Tomcat servlet API and Rewrite. Two html files, 1 controller and the config provider. I don’t know why but i get a different exception when using 1.1.0 now:

    Exception starting filter OCPsoft Rewrite Filter
    java.lang.NoSuchMethodError: org.ocpsoft.rewrite.config.ConfigurationBuilder.addRule(Lorg/ocpsoft/rewrite/config/Rule;)Lorg/ocpsoft/rewrite/config/ConfigurationBuilder;

    I then changed the syntax according to your last post, which works for 1.0.5, but fails again in 1.1.0 with the said exception. I attached the .war and the exported eclipse project with the source files:

    #23342

    Anonymous

    Sorry, i can’t upload the 4MB .war for whatever reason… then just the project:

    You can test the application here:http://nachtmenschen.net:8080/rewriteexample/

    (Just reload a few times in case a &JESSIONID=dfgd76fgdd6… is added to the links and breaks them, it will go away then *more weird jsf behaviour* -.-)

    #23343

    GOOD POINT about oubound URLs being rewritten when they do not pass validation. That’s a very good point. I will add a test for this and make sure it gets fixed! Looking into your deployment issue…

    #23344

    By the way, your application runs fine for me. Have you checked to make sure you don’t have any old or duplicate JARs on the classpath?

    #23345

    Anonymous

    Did you change the pom.xml to use 1.1.0? (Just to make sure)

    #23346

    Yes I did :)

    #23347

    Anonymous

    Sorry, didnt have much time to revisit the problem until now. Maybe I didnt try your suggested reordering of the join clauses back then (or I did that and forgot one clause…), I really don’t know. However its now working, as long as I use the ordering join-path-to-where-matches instead of join-path-where-matches-to. Sorry for the trouble and thanks for your great support.

    #23348

    Glad you got it working!

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

You must be logged in to reply to this topic.

Comments are closed.