1) I'm dealing with similar situation like at How can I pass complex objects as arguments to a RESTful service? , but actually the injection of my custom XML objects if injected all right, IF i do not annotate method parameter with @Form.
This is wrapper request object to injection:
@XmlRootElement(name = "request")
@XmlAccessorType(XmlAccessType.NONE)
@XmlType
@Consumes({"application/xml", "application/json"})
public class TestRequest {
@PathParam(value = "value")
private String value; // this is injected only when @Form param is added to the method parameter definition
@XmlElement(type = Test.class)
private Test test; // this is XML object I want to inject from the REST request
@XmlElement
private String text; // or inject other XML element like this
}
So this would inject me REST parameters (e.g. {value} - @PathParam("value") annotated in TestRequest). BUT this doesn't unmarshall the XML object Test in wrapper object TestRequested.
@POST
@Path("tests/{value}")
@Consumes("application/xml")
@Produces("application/xml")
public void addTest(**@Form** TestRequest req);
And following definition would inject only the XML object Test but doesn't inject the REST annotations (e.g. {value} from URI):
public void addTest(TestRequest req); // without @Form annotation now
2) I also tried another approach by catching request to custom MessageBodyReader implementation but have been lost in the details where to find code, method or class of JAX-RS or RESTEasy that actually does this parsing/injecting of REST annotations(@PathParam, @QueryParam,...).
I also noticed that when there is @Form annotation in method definition, then custom MessageBodyReader isn't even catched (propably built-in one for REST parameters catches that request and custom reader is then ignored).
I could in this custom message body reader solution somehow call that built-in injection provider but i didn't find suitable documentation and it seems I'm doing something wrong and all can be done more simplier some other way.
To summarise the goal: inject both REST parameters (@PathParam, @QueryParam etc.) and custom XML/JSON objects somehow in one request in ONE wrapper object. (It works with one wrapper object annotated @Form and the other parameter to be without @Form annotation, but I would like to have all in one wrapper object).
Thank you for any insights or help.