Hi

Here's what JAXRS spec mandates. A method can have only a single parameter which is not annotated with one of the JAXRS annotations (such as @PathParam, @QueryParam, @Context, etc), for ex

@POST
@Path("/foo")
void foo(String s)

@POST
@Path("{foo}")
void foo(@PathParam("foo") String s1, String s2)

JAXRS-annotated parameters can be populated from URI path segments (@PathParam - all HTTP verbs - as Gabo said in the otehr email), GET queries (@QueryParam), HTTP headers (@HeaderParam), POST form requests (@FormParam - not in CXF yet).

Also, as Aji said, you can have a single MulttivaluedMap parameter when dealing 
with form requests.

It's not possible in JAXRS to have a method with multiple not-annotated 
parameters :

@POST
@Path("/foo")
void foo(String s1, String s2)

We might look at it a bit closer once we start working on the advanced 
JAXRS-JAXWS intergration.

Hope it helps
Sergey


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.


Reply via email to