Tripping on external urls

Splash Forums Rewrite Users Tripping on external urls

This topic contains 4 replies, has 2 voices, and was last updated by  fabmars 3 years, 1 month ago.

Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • #24339

    fabmars
    Participant

    Hi.
    Now one can write an external link like <a href="http://ocpsoft.org">OCP</a> in a facelet whereas it had to be written via a h:outputLink before JSF2. Well, I have several “useless” outputLink’s because my code is old and got migrated from JSF 1.2.

    I noticed that when I have such an external link <h:outputLink value="http://www.someexternalsite.com">, Rewrite gives me a NPE.

    The issue happens in Path#evaluateHttp:`if (event instanceof HttpOutboundServletRewrite)
    url = ((HttpOutboundServletRewrite)event).getOutboundAddress().getPath();`

    Right, but in the case of an external URL like this, in the AddressResult object, host is filled but path is null, thus url == null.
    Then just after, if (url.startsWith(event.getContextPath())) gives the NPE obviously.

    OK the obvious workaround is to remove useless outputLink’s, nonetheless, I find this quite suspicuous. Or is there anything I’m doing wrong?
    My config: Glassfish 3.1.2.2, JSF 2.1, Rewrite 2.0.4.Final

    #24343

    Hey, sorry for the late response. Yeah, this looks like a bug. Could you open an issue for that?

    https://github.com/ocpsoft/rewrite/issues

    I guess it will work if you add a trailing slash to the URL, right? Something like http://something.com/ instead of http://something.com?

    #24345

    fabmars
    Participant

    Hi
    Yes correct, the NPE disappears with a trailing slash.
    OK I’m logging an issue and I think I can submit a patch.

    #24347

    Awesome! Thank you.

    Perhaps the best starting point would be to provide a failing integration test. But patches for fixing the bug itself are also welcome. 🙂

    #24348

    fabmars
    Participant

    Yes I’m going to submit patch+test for https://github.com/ocpsoft/rewrite/issues/117

    • This reply was modified 3 years, 1 month ago by  fabmars.
Viewing 5 posts - 1 through 5 (of 5 total)

You must be logged in to reply to this topic.

Comments are closed.