Hi,
There is no content within your email. Is this just a reminder that
you require this fixing?
See the issue here:
https://jersey.dev.java.net/issues/show_bug.cgi?id=232
There are actually two issues.
1) The characters '{' and "}' are members of the excluded set of US-
ASCII characters [1]. So if Jersey receives a
request with such characters present it cannot create an
instance of java.net.URI because creation correctly
throws an exception.
2) The JAX-RS/Jersey UriBuilder allows the creation of URI strings
that contain '{' and "}' because it is assuming
that those represent deliminators for template names to be
replaced by template values.
Workarounds:
- For 1) include a servlet filter that correctly encodes the request URI
- Explicitly encode the '{' and '}' characters using
UriComponent.contextualEncode or UriComponent.encode [2].
Paul.
[1]
http://greenbytes.de/tech/webdav/rfc2396.html#rfc.section.2.4.3
[2]
https://jersey.dev.java.net/source/browse/*checkout*/jersey/tags/jersey-1.0.2/api/jersey/com/sun/jersey/api/uri/UriComponent.html
On Apr 13, 2009, at 4:58 AM, kg525 wrote:
>
>
>
> Jersey (1.0.2) throws a java.net.URISyntaxException when it
> encounters a
> URL with a {. Trying an ExceptionMapper does not catch
> UriBuilderException (t appears that the exception is thrown before the
> ExceptionMappers are in place).
>
> The exception looks like this
>
> [[[
> Caused by: java.net.URISyntaxException: Illegal character in query at
> index 56:
> http://192.168.3.200:8080/svc/data/user?fmt=pbuf&start=$
> {rndstart}&count=50
> at java.net.URI$Parser.fail(URI.java:2809)
> at java.net.URI$Parser.checkChars(URI.java:2982)
> at java.net.URI$Parser.parseHierarchical(URI.java:3072)
> at java.net.URI$Parser.parse(URI.java:3014)
> at java.net.URI.<init>(URI.java:578)
> ]]]
>
> I thought it was something goofy in java.net.URI, but debugging this
> call it seems like there is a method in UriComponent class that is not
> fully encoding the query string, ie calling,
>
> UriComponent.contextualEncode("start=^%|{rndstart}",
> UriComponent.Type.QUERY, true)
>
> returns start=%5E%25%7C{rndstart} leaving '{', '}' not encoded.
>
> Does anyone else agrees this is a bug? If so I'll file a ticket and
> submit a patch anon.
>
> Bill
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>
>
>
>
> --
> View this message in context: http://n2.nabble.com/handling-urls-with-%7B-tp2418073p2626140.html
> Sent from the Jersey mailing list archive at Nabble.com.
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>