users@jersey.java.net

Re: [Jersey] handling urls with {

From: kg525 <kg525_at_163.com>
Date: Sun, 12 Apr 2009 19:58:28 -0700 (PDT)

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.