It's embarrassing, I've just made another typo

<bean id="paramHandler" "org.apache.cxf.systest.jaxrs.MapParamHandler"/>

should be

<bean id="paramHandler" class="org.apache.cxf.systest.jaxrs.MapParamHandler"/>


----- Original Message ----- From: "Sergey Beryozkin" <[email protected]>
To: <[email protected]>
Sent: Thursday, October 15, 2009 11:02 AM
Subject: Re: ParameterHandler Question


Hi Eric

It's a typo, sorry. Just fixed it. ParameterHandler implementations can be registered as providers; there're examples showing how to register providers, so I don't show it every time to save some space. For ex, here's how you can do it from Spring :

<jaxrs:server address="/">
<jaxrs:providers>
  <ref bean="paramHandler"/>
</jaxrs:providers>
</jaxrs:server>

<bean id="paramHandler" "org.apache.cxf.systest.jaxrs.MapParamHandler"/>


thanks, Sergey

----- Original Message ----- From: "Eric Johnson" <[email protected]>
To: <[email protected]>
Sent: Wednesday, October 14, 2009 10:05 PM
Subject: ParameterHandler Question


I was looking through the documentation on JAX-RS and found this:
CXF JAXRS supports ParameterHandler extensions which can be used to deal
with method parameters annotated with one of the JAXRS parameter
annotations :
public class MapHandler implements ParameterHandler<Map> {
   public Map fromString(String s) {...}
}

@Path("/")
public class Service {


   @PUT
   @Path("{id}")
   public Response update(@PathParam("g") Map m, byte[] bytes) {
       ...
   }
}
Note that ParameterHandlers can not be used to deal with parameters
representing a message body, "byte[] byte" in this example.
MessageBodyReaders have to deal with this task. That said, a given
MessageBodyReader implementation can also implement ParameterHandler.
ParameterHandlers can be registered as providers either from Spring or
programmatically.
I'm feeling a little stupid because I cannot figure out from the example
code what is going on. I see that the PathParam is looking for the path
segment "g" which does not appear to exist in the URI template and wants
to map that value into a Map. I also see that there is a
ParameterHandler implemented that maps a PathParam to a Map. So, does
the ParameterHandler get used when the URI template variable does not
exist? Or is it just a typo? Or does it not matter?
Also could an example of how the ParameterHandler is registered be
added?


Reply via email to