Hi,
Have run into an issue after upgrading to java 1.7 where the resource
methods "preferred" by Jersey (1.4) has changed. From what we can tell
this is consequence of the ordering of Class.getMethods() changing /
becoming less stable in java 7.
Issue description:
- Receiving GET request with Accept: */*
- Have a 'ProductResource' class (below) that produce a StatusResource
from an exposed method
- The resource class (at end of mail) have two @Produces methods, one
for application/xml, and one for plain text
- On java 1.6 Jersey would always choose the getStatus() method. On 1.7
the getStatusAsText() method will be chosen on *some* machines.
Was wondering if anyone else has run into this issue, know of a
workaround, or know that it might have been fixed in a newer version of
Jersey. The nice solution would be if would could specify a priority
between candidate methods, but have not been able to find a way of
doing so.
@Path("/products/{id}")
public class ProductResource{
@Path("status")
return new StatusResource(...);
}
}
public class StatusResource {
@GET
@Produces(MediaType.APPLICATION_XML)
public StatusSO getStatus() {
return ...;
}
@GET
@Produces(MediaType.TEXT_PLAIN)
public String getStatusAsText() {
return ...;
}