Hi,
I am trying to implement a custom parameter ninding, where I can map HTTP
query parameters, form parameters, http headers etc to a custom Java class.
For eg, instead of having something below
@Path("/myResource")
public MyResource {
@GET
public String myMethod(@QueryParam("foo") int foo, @HeaderParam("bar")
double bar) {
}
}
have something like,
@Path("/myResource")
public MyResource {
@GET
public String myMethod(@ComplexType CustomType customType) {
}
}
public class CustomType {
@QueryParam("foo") protected int foo;
@HeaderParam("bar") protected double foo;
}
@ComplexType is a custom annotation I have introduced. I thought one way to
do this was to introduce a custom message reader, and had some success in
getting it working. However, I have run into two issues,
1. If the HTTP method is set to GET, Jersey throws an error stating custom
entities are not allowed with GET
2. The message reader interface provides access only to the HTTP headers and
the message body. So I cant access any query or path parameters.
I would hugely appreciate if someone could please point me to what I am
doing wrong.
Ta
Meeraj