cxf-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Aji John" <aji.j...@gmail.com>
Subject Re: [JAX-RS] Can't get passing multiple parameters to work
Date Sat, 08 Nov 2008 18:39:08 GMT
 Try this, they are passed as a Map

@POST
@Path("/addStrs")
@ConsumeMime("application/x-www-form-urlencoded")
 public String addStrs(MultivaluedMap<String, String> parameters)
{

     String str1 = parameters.getFirst("str1");
}
.....

If my understanding is correct, @PathParam injections are avaliable only on
HTTP GET method.

Aji
On Fri, Nov 7, 2008 at 10:15 PM, guofoo <guofoo@gmail.com> wrote:

>
> I've searched and read all the posts related to multiple parameters but
> still
> can't seem to find a good working example or even whether it is possible or
> not? Some posts claim JAX-RS supports multiple parameters yet others claim
> it only supports 1 parameter. Maybe I'm missing something. Any help would
> be
> appreciated.
>
> @POST
> @Path("/addStrs")
>    public String addStrs(@PathParam("str1") String str1,
>                @PathParam("str2") String str2);
>
> I have the method above, and I'm passing two strings in the POST data, but
> no matter what I use to delimit them, (, or ; or / ) they are always passed
> in as a single value for "str1" only and str2 is always empty. I've tried
> various combinations of the @Path such as @Path("/addStrs/{str1}/) which
> works the same as above, or @Path("/addStrs/{str1}/{str2}/) which always
> gives "No operation matching request path.." exception.
>
> I was hoping to get this working first, before attempting to pass other
> more
> complex object types besides String, but I can't even get past this simple
> case. Can someone tell me whether the above is possible? Is it the
> annotation that could be wrong or is it the way I'm passing the parameters
> from the client?
>
> Any pointers to examples would be appreciated as well, since I've looked
> through both the CXF examples but didn't find anything similar.
>
> -GF
> --
> View this message in context:
> http://www.nabble.com/-JAX-RS--Can%27t-get-passing-multiple-parameters-to-work-tp20393374p20393374.html
> Sent from the cxf-user mailing list archive at Nabble.com.
>
>

Mime
  • Unnamed multipart/alternative (inline, None, 0 bytes)
View raw message