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?