Jersey Overload path functions with different @QueryParams
I would like to have multiple functions for the same GET Path.
As well i would like my web service to "find" these functions if and only
if the query parameters match the parameters in the URL String.
For example:
I have the Path("/myGET")
And for that path i would like to have 2 functions:
@GET
@Produces(MediaType.APPLICATION_JSON)
@TypeHint(TagSets.class)
public Response getTagSets(@QueryParam("entityId") Integer entityId)
{
...
}
And
@GET
@Produces(MediaType.APPLICATION_JSON)
@TypeHint(TagSets.class)
public Response getTagSets(){
...
}
Right now i am getting an error:
SEVERE: The following errors and warnings have been detected with resource
and/or provider classes: SEVERE: Producing media type conflict. The
resource methods public
javax.ws.rs.core.Response<...>.getTagSets(java.lang.Integer) and public
javax.ws.rs.core.Response<...>.getTagSets(java.lang.Integer,java.lang.Integer)
can produce the same media type SEVERE: Producing media type conflict. The
resource methods public javax.ws.rs.core.Response<...>.getTagSets() and
public javax.ws.rs.core.Response
<...>.getTagSets(java.lang.Integer,java.lang.Integer) can produce the same
media type
So first: Is there any way to achieve what i want to do here..
second: If this is available, is there any way that a path will be found
if and only if the query parameters match exactly what is requested in the
function? for example if the same path will be called with
@QueryParam("differentParam") it will not reach any of the 2 functions.
Thanks
No comments:
Post a Comment