users@jersey.java.net

[Jersey] Re: Question Mark in Path Param

From: Martin Matula <martin.matula_at_oracle.com>
Date: Fri, 11 Mar 2011 20:01:36 +0100

Hi,
Query string is not part of the path, so you can't get it this way. Here
is one example of what you can do:
     @GET @Path("/{query}")
     public String getSearch(@PathParam("query") String query, @Context
UriInfo ui) {
         String uri = ui.getRequestUri().toString();
         int i = uri.indexOf('?');
         return query + (i != -1 ? uri.substring(i) : "");
     }
Regards,
Martin

On 11.3.2011 17:56, jmandawg wrote:
> Hi,
>
> I'm trying to get the Path param from this url:
>
> http://yourhost.tld:9999/solr/select?q=cat:electronics+Belkin&version=2.1&start=2&rows=2&indent=on&fl=id+name+score
>
> I want to be able to pull out the string:
> "select?q=cat:electronics+Belkin&version=2.1&start=2&rows=2&indent=on&fl=id+name+score"
>
> But when i try to i only get: "select"
>
> Here is the code:
>
> @GET @Path("/{query}")
> public String getSearch(@PathParam("query") String query) {
> System.out.println(query);
> }
>
> How can i get the entire string?
>
> Thanks.
>
> --
> View this message in context: http://jersey.576304.n2.nabble.com/Question-Mark-in-Path-Param-tp6162107p6162107.html
> Sent from the Jersey mailing list archive at Nabble.com.