Hi David, Tim,
I just talked with JeanFrancois and he says this is an issue with
grizzly.
Could you log an issue against Grizzly?
https://grizzly.dev.java.net/issues
https://grizzly.dev.java.net/issues/enter_bug.cgi?issue_type=DEFECT
Thanks,
Paul.
On Jun 4, 2009, at 7:38 AM, Tim Edwards wrote:
> Hi,
>
> I think this is a server issue, so it depends on what server you are
> using. I tried this on my app (which has a similar PathParam) which
> is using Grizzly as the server and got the same results as you
> describe.
>
> Looking into it, a GrizzlyAdapter has the setAllowEncodedSlash()
> method which is used when decoding the uri, when false (the default)
> it will treat a uri with a slash as being incorrect and return a 400
> error. However, setting this to true has no effect as there appears
> to be an issue in the code. The offending class seems to be UDecoder
> which will use the value of the system property
> "com.sun.grizzly.util.buf.UDecoder.ALLOW_ENCODED_SLASH" when called
> by the GrizzlyAdapter (via the HttpRequestURiDecoder) but if you set
> that system property to true, then Grizzly throws an error on every
> request. Unless I'm missing something, I don't see an obvious way
> around this.
>
> But if you are not using Grizzly, there may be a setting on your
> server that will help.
>
> Tim
>
> From: City Link Web Development Team [mailto:phpteam_at_city-link.co.uk]
> Sent: 04 June 2009 14:27
> To: users_at_jersey.dev.java.net
> Subject: [Jersey] Trouble with backslashes using @Path annotations
>
> Hi,
>
> Hope anyone can help with this...?
>
>
> We have a bit of code like this:
> public class TrackingResource
> {
> @GET
> @Path("/{tracking_id :.+ }")
> public TrackingConverter
> getConsignment(@PathParam("tracking_id") String trackingId
>
>
> which we need to catch *any* character as a variable trackingId. The
> characters ARE being escaped and all of them work except for \
> (backslash). Even forward slash works ok. Backslash never resolves
> to the function and we just get a blank page come up, no 404, no
> server things logged.
>
> Going to /test%5C fails, when I'd expect the variable trackingId
> to contain "test\"
>
> Does anyone have any idea how to work around this? Annotation?
> Server Settings? Bug? This is a critical thing for us.
>
> Thanks,
> --
> David Harper
> Web Application Developer
> City Link - Head Office
> www.city-link.co.uk
>
>
> Click here to report this email as spam.
>
> _____________________________________________________________________
> The information contained in this e-mail is intended only for the
> individual to whom it is addressed. It may contain privileged and
> confidential information. If you have received this message in
> error or there are any problems, please notify the sender
> immediately and delete the message from your computer. The
> unauthorised use, disclosure, copying or alteration of this
> message is forbidden. This message has been checked for all
> known viruses by City Link prior to sending.
>
>
> If you are not the intended recipient, employee or agent responsible
> for delivering the message to the intended recipient, you are hereby
> notified that any dissemination or copying of this communication and
> its attachments is strictly prohibited. If you have received this
> communication and its attachments in error, please return the
> original message and attachments to the sender using the reply
> facility on e-mail. Internet communications are not secure and
> therefore Cambridge Assessment (the brand name for the University of
> Cambridge Local Examinations Syndicate, the constituent elements of
> which are CIE, ESOL and OCR [Oxford Cambridge and RSA Examinations
> is a Company Limited by Guarantee Registered in England. Registered
> office: 1 Hills Road, Cambridge CB1 2EU. Company number: 3484466])
> does not accept legal responsibility for the contents of this
> message. Any views or opinions presented are solely those of the
> author and do not necessarily represent those of Cambridge
> Assessment unless otherwise specifically stated. The information
> contained in this email may be subject to public disclosure under
> the Freedom of Information Act 2000. Unless the information is
> legally exempt from disclosure, the confidentiality of this email
> and your reply cannot be guaranteed.
>
> This message has been scanned for viruses by BlackSpider MailControl
>