Re: Problems with slash (/) and plus (+) in URL
I know about this possibility, but it does not solve my problems. The slashes within the path segments are decoded already, so that I can’t distinguish between slashes for splitting the path into segments and slashes contained in the path segment’s name.
The problem with this is that the encoded and the decoded form of a character (for example
%2F) in fact represent the same character from the URL perspective. I also think that some browser may try to convert the
%2F into a
/ before sending the request to the server (because both represent the same character and
/ is a more common form) which will break your links.
The url is always decoded prior to setting the attributes in my bean. It would be nice to disable the decoding in the path mapping.
This might work. But I’m not sure if this parameter would be useful in any other case than yours.
@lincoln: What do you think. I think it won’t do any harm to add something like this.
When using pretty:link the plus signs however are not encoded, i.e. path1=”a”, path2=”b + / c” is rendered as “a/b+++%2F+c”
I think that the plus sign is the correct encoding for a space character in URLs. But I might we wrong. So this would be intended behavior.
However, I think if there are slash and plus characters in the segment names it would be the best solution to manually escape them somehow. For example use
_ instead of the space when creating a URL and do it the other way around after the value has been injected into your bean. This way you won’t get into any trouble.