@Provider
public class DirectTemplateExceptionMapper
extends java.lang.Object
implements org.glassfish.jersey.spi.ExtendedExceptionMapper<javax.ws.rs.NotFoundException>
NotFoundException thrown by jersey when matching rest path not found. Exception mapper detects it
and if it is template call tries to render template directly instead.
Handler is applied to all rest, but as its an extended mapper, it will not influence normal rest calls.
NOTE: application may declare different exception mapper for NotFoundException and so it may
override this mapper. It is highly unlikely, but still could happen.
Another drawback is template rendering errors will be unreachable for default dropwizard exception mapper
(IllegalStateExceptionMapper which logs all rest exceptions. But
this is compensated by direct exception error logging.
| Constructor and Description |
|---|
DirectTemplateExceptionMapper() |
| Modifier and Type | Method and Description |
|---|---|
protected static boolean |
canHandle(org.glassfish.jersey.server.monitoring.RequestEvent event)
Exception event first will be catched by listener and it must not handle it initially.
|
boolean |
isMappable(javax.ws.rs.NotFoundException exception) |
javax.ws.rs.core.Response |
toResponse(javax.ws.rs.NotFoundException exception) |
public boolean isMappable(javax.ws.rs.NotFoundException exception)
isMappable in interface org.glassfish.jersey.spi.ExtendedExceptionMapper<javax.ws.rs.NotFoundException>public javax.ws.rs.core.Response toResponse(javax.ws.rs.NotFoundException exception)
toResponse in interface javax.ws.rs.ext.ExceptionMapper<javax.ws.rs.NotFoundException>protected static boolean canHandle(org.glassfish.jersey.server.monitoring.RequestEvent event)
As a side effect, template rendering errors will be impossible to intercept with custom exception mappers.
event - exception event