Hi Alex,
Can you provide more details on where the exception is thrown?
Not sure you can read the longer email on your phone, but i have
included the code that catches and maps exceptions.
Paul.
private void _handleRequest(final WebApplicationContext
localContext,
ContainerRequest request, ContainerResponse response)
throws IOException {
try {
for (ContainerRequestFilter f :
filterFactory.getRequestFilters()) {
request = f.filter(request);
localContext.setContainerRequest(request);
}
/**
* The matching algorithm currently works from an
absolute path.
* The path is required to be in encoded form.
*/
StringBuilder path = new StringBuilder();
path.append("/").append(request.getPath(false));
if (!
resourceConfig.getFeature(ResourceConfig.FEATURE_MATCH_MATRIX_PARAMS)) {
path = stripMatrixParams(path);
}
if (!rootsRule.accept(path, null, localContext)) {
throw new NotFoundException(request.getRequestUri());
}
} catch (WebApplicationException e) {
response.mapWebApplicationException(e);
} catch (MappableContainerException e) {
response.mapMappableContainerException(e);
} catch (RuntimeException e) {
if (!response.mapException(e)) {
LOGGER.log(Level.SEVERE, "The RuntimeException could
not be mapped to a response, " +
"re-throwing to the HTTP container", e);
throw e;
}
}
try {
// Process response filters from resources
for (ContainerResponseFilter f :
localContext.getResponseFilters()) {
response = f.filter(request, response);
localContext.setContainerResponse(response);
}
for (ContainerResponseFilter f :
filterFactory.getResponseFilters()) {
response = f.filter(request, response);
localContext.setContainerResponse(response);
}
} catch (WebApplicationException e) {
response.mapWebApplicationException(e);
} catch (MappableContainerException e) {
response.mapMappableContainerException(e);
} catch (RuntimeException e) {
if (!response.mapException(e)) {
LOGGER.log(Level.SEVERE, "The RuntimeException could
not be mapped to a response, " +
"re-throwing to the HTTP container", e);
throw e;
}
}
try {
response.write();
} catch (WebApplicationException e) {
if (response.isCommitted()) {
LOGGER.log(Level.SEVERE, "The response of the
WebApplicationException cannot be utilized " +
"as the response is already committed. Re-
throwing to the HTTP container", e);
throw e;
} else {
response.mapWebApplicationException(e);
response.write();
}
}
}
On Apr 21, 2010, at 2:24 AM, Alex Sherwin wrote:
> ExceptionMapper<Throwable> not getting all RuntimeExceptions in
> Spring.
>
> It gets some, but not all. For example, it is not getting
> IbatisException (ib3 -- they are unchecked.)
>
> Is there some existing provider included in the spring jersey
> integration that could be getting some of them?
>
> My bean is present in the spring ApplicationContext and is annotated
> with @Provider
>
>
>
> Sent from my iPhone
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_jersey.dev.java.net
> For additional commands, e-mail: users-help_at_jersey.dev.java.net
>