* @param exception
* @return true if an ExceptionMapper was found and executed
*/
public boolean executeExceptionMapper(HttpResponse response, Throwable exception)
{
ExceptionMapper mapper = null;
Class causeClass = exception.getClass();
while (mapper == null)
{
if (causeClass == null) break;
mapper = providerFactory.getExceptionMapper(causeClass);
if (mapper == null) causeClass = causeClass.getSuperclass();
}
if (mapper != null)
{
writeFailure(response, mapper.toResponse(exception));
return true;
}
return false;
}