users@jersey.java.net

[Jersey] Re: Path Parameters

From: Vidar Larsen <vi_larsen_at_yahoo.no>
Date: Sat, 2 Jul 2011 10:25:29 +0200

On 2. juli 2011, at 02:03, "Jim Beard" <jimbeard_at_uoregon.edu> wrote:

> Is there an example of using Path Parameters somewhere?
>
>
>
> I have the following code:
>
>
>
>
>
> WebResource webResource = client.resource("https://r25test.uoregon.edu/r25ws/servlet/wrd/run");
>
>
>
> ClientResponse response = webResource.path("r25user.xml?r25_username="+args[0]).delete(ClientResponse.class);
>
>
>
>
>
> And when it runs the ? converts to the hex encoded values, which is throwing a 500 internal server error on the web service server.
>
>
>
> The web service log shows: REQUEST_URI=/r25ws/servlet/wrd/run/r25user.xml%3Fr25_username=Oscar
>
>
>
> If I paste this in a browser I still get the 500 error, but if I replace the %3F with a ? then it seems to work.
>

The ? is converted so it can be part of the path segment of the uri. I suspect what you are really trying to do, is to introduce a Query Parameter coming _after_ the path.

Your code should then look like this:
> ClientResponse response = webResource.path("r25user.xml").queryParam("r25_username", args[0]).delete(ClientResponse.class);
>
/vidar