Url encoding (again) and /#{some}strage#{links}

Splash Forums PrettyFaces Users Url encoding (again) and /#{some}strage#{links}

Tagged: ,

This topic contains 7 replies, has 3 voices, and was last updated by  Christian Kaltepoth 6 years, 6 months ago.

Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #17900

    Krzysiek
    Participant

    Hi,

    I have some legacy links structure that I need to follow:

    /x,Y,123

    Where ‘x’ is a name and it is not revelant, ‘,Y,’ is a enumeration that defines the link type and 123 is an id.

    So I would like to have a pattern:

    /#{name},Y,#{id}

    but such pattern does not work in PrettyFaces (does it?)

    So I try to use a pattern like (I use annotations):

    /#{ /.*,Y,\\d+/ full}

    And it works, well… almost. When I hit an address like /x,Y,123 and then do something (so outbound rewrite is used) I am redirected to url: /x%2CY%2C123

    Nevertheless this url still matches the pattern :)

    So:

    1) Is it possible to use slashless patterns like /#{one}two#{three}

    2) Can I plug into outbound link generation? Preferably in a way that does not involve AspectJ :)

    There are some characters that can, but does not have to be encoded like ‘,’ ‘(‘ ‘)’. Or ‘+’, but this one have been already mentioned in other thread. Not sure is there more of them.

    Regards,

    Krzysztof Kowalczyk

    #20833

    Hey Krzysztof,

    thanks for bringing this up! I think I know what is going wrong here. I think there is one place left in our code where we are still using URLEncoder which is not correct. URLEncoder encodes some characters not correctly for URLs. Especially the space character and maybe also the comma character.

    I’ll have a look at this and come back to you soon.

    Christian

    PS: Could you perhaps provide a minimal example to reproduce this issue. This would help me to get down to the problem faster.

    #20834

    Hey Krzysztof,

    I’ve just committed a patch that should fix the issues you are having. Could you perhaps give the latest snapshots of 3.2.1 a try?

    https://github.com/ocpsoft/prettyfaces/wiki/Snapshots

    Thanks

    Christian

    #20835

    Krzysiek
    Participant

    Hey,

    Just checked snapshot, it does work now, with ()+, etc. I only checked forum once and it’s already fixed. Very nice :) Thanks.

    Do you plan to support links like /#{param1}marker#{param2}, or there is no hope for me ;) and I have to split variables in my beans?

    Thanks,

    Krzysztof

    #20836

    This doesn’t work? I thought it did…

    /#{param1}marker#{param2}

    #20837

    Lincoln is right! This pattern should actually work. Could you give an concrete example that is not working?

    #20838

    Krzysiek
    Participant

    Oh, sorry for the confusion, it does work now. I did not check it after the last patch. My marker has commas and the link must have been broken because of that. How silly of me ;)

    Now everything seems to work ok. Thanks.

    Krzysztof

    #20839

    Great! :)

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

You must be logged in to reply to this topic.

Comments are closed.