Hi Christian, Santiago,
I might be taking the spec too literally, but I would view that the @FormParam annotation indicates that foobar is a parameter, not an entity. The JAX-RS spec shows that the MBR interceptor chain is optional in Appendix C. In this case, I think CXF is optimizing the pipeline since it does not see an entity. If I expand on the example code and use a ParamConverterProvider/ParamConverter, I see that CXF invokes them - allowing me to manipulate the value that is ultimately passed to the post method. I think that this should be the proper way to "intercept" @FormParam (or any other @*Param parameters).
Similarly, CXF will invoke the MBR and ReaderInterceptor if I remove the @FormParam annotation from the parameter - IMO, that changes the foobar parameter from being a parameter to to being an entity.
Christian, would it be possible for you to try those options too? (1) Remove @FormParam and process foobar as an entity and (2) Use a ParamConverterProvider to process foobar as a parameter?
Here is the ParamConverterProvider I used:
@Provider
public class MyParamConverterProvider implements ParamConverterProvider {
private final static Logger _log = Logger.getLogger(MyParamConverterProvider.class.getName());
@SuppressWarnings("unchecked")
@Override
public <T> ParamConverter<T> getConverter(Class<T> aClass, Type type, Annotation[] annos) {
_log.info("getConverter");
if(String.class.isAssignableFrom(aClass)) {
return (ParamConverter<T>) new ParamConverter<String>(){
@Override
public java.lang.String toString(String s) {
return "toString"+s;
}
@Override
public String fromString(String s) {
_log.info("fromString " + s);
return "fromString" + s;
}};
}
return null;
}
}
Thanks,
Andy
To change your delivery options, retrieve your password, or unsubscribe from this list, visit