users@jersey.java.net

ExceptionMapper and constructor injection of _at_Context UriInfo ?

From: Morten <mortench2004_at_yahoo.dk>
Date: Thu, 23 Jul 2009 12:14:12 +0000 (GMT)

I would like to provide some great context specific errors to jersey 1.1.1 so I have added an ExceptionMapper like the code extract below which access UriInfo using CTR injection. Unfortunately, jersey gives an error that the class can't be instantiated (assumingly because it does not support injection of the provider). Is this a bug in jersey 1.1.1 or a know limitation ? @Provider public class CustomExceptionMapper implements ExceptionMapper<java.lang.Throwable> { public CustomExceptionMapper(@Context UriInfo uriInfox) { // Save uri for late (note this req. class is NOT a singleton). } public Response toResponse(java.lang.Throwable ex) { // Detailed response here. } } /Cheers, Morten Trænger du til at se det store billede? Kelkoo giver dig gode tilbud på LCD TV! Se her http://dk.yahoo.com/r/pat/lcd