users@jersey.java.net

Re: Using _at_QueryParam

From: Paul Sandoz <Paul.Sandoz_at_Sun.COM>
Date: Tue, 18 Mar 2008 12:28:43 +0100

Hi James,

We removed (by default) automatic redirection from a request URI without
a '/' to a request URI with a '/'. This "magic" was causing confusion
and was slightly inconsistent sometimes.

Try this request URI:

   http://127.0.0.1:9998/users/jim/appliances/?id=1

You can enable the previous behavior by setting the feature:

   com.sun.ws.rest.config.feature.Redirect

to "true" on the ResourceConfig.

Paul.

James Weir wrote:
> Hi,
>
> I have a resource that will allow me to recuperate an item or query for
> several items. My resource (based on the Storage Example) has the
> following template:
>
> @Path("/users/{name}/appliances/")
> @ProduceMime({"application/xml", "application/json"})
> @ConsumeMime({"application/xml", "application/json"})
> public class MyResource {
>
> // GET for URI: /users/<name>/appliances?id=<appliance id>
> @GET
> public Response get(@PathParam("name") String userName,
> @QueryParam("id") String applId) {
> ....
> }
>
> // GET for URI: /users/<name>/appliances/<id>
> @Path(value="{id}", limited=false)
> @GET
> public Response getItem(@PathParam("name") String userName,
> @PathParam("id") String id) {
> ...
> }
> }
>
> However when I send a GET request:
> http://127.0.0.1:9998/users/jim/appliances?id=1
>
> I get a 404 response back (traces from client side)
>
> 11:46:03,921 DEBUG [Thread-4] (ApplianceMsg.java:UserMsg:316) - Querying
> appliance tickets with uri: http://127.0.0.1:9998/users/jim/appliances?id=1
> 11:46:03,921 DEBUG [Thread-4] (CacheFilter.java:CacheFilter:36) -
> CacheFilter.handle(http://127.0.0.1:9998/users/jim/appliances?id=1)
> 11:46:03,921 DEBUG [Thread-4] (CacheFilter.java:CacheFilter:61) -
> CacheFilter response status....: 404
>
> The server side code does not seem to be executed.
> For the moment I cannot see what I am doing wrong here. Any ideas ?
>
> Thanks for any help
> James
>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>

-- 
| ? + ? = To question
----------------\
    Paul Sandoz
         x38109
+33-4-76188109