Package org.onlab.rest.exceptions
Class AbstractMapper<E extends java.lang.Throwable>
- java.lang.Object
 - 
- org.onlab.rest.exceptions.AbstractMapper<E>
 
 
- 
- All Implemented Interfaces:
 javax.ws.rs.ext.ExceptionMapper<E>
- Direct Known Subclasses:
 BadRequestMapper,EntityNotFoundMapper,ForbiddenMapper,IllegalArgumentExceptionMapper,IllegalStateExceptionMapper,NotFoundMapper,ServerErrorMapper,ServiceNotFoundMapper,WebApplicationExceptionMapper
public abstract class AbstractMapper<E extends java.lang.Throwable> extends java.lang.Object implements javax.ws.rs.ext.ExceptionMapper<E>Base exception mapper implementation. 
- 
- 
Field Summary
Fields Modifier and Type Field Description protected java.lang.ThrowableerrorHolds the current exception for use in subclasses. 
- 
Constructor Summary
Constructors Constructor Description AbstractMapper() 
- 
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected java.lang.StringmessageFrom(java.lang.Throwable exception)Produces a response message from the supplied exception.protected javax.ws.rs.core.Response.ResponseBuilderresponse(javax.ws.rs.core.Response.Status status, java.lang.Throwable exception)Produces a response builder primed with the supplied status code and JSON entity with the status code and exception message.protected abstract javax.ws.rs.core.Response.StatusresponseStatus()Returns the response status to be given when the exception occurs.javax.ws.rs.core.ResponsetoResponse(E exception) 
 - 
 
- 
- 
Method Detail
- 
responseStatus
protected abstract javax.ws.rs.core.Response.Status responseStatus()
Returns the response status to be given when the exception occurs.- Returns:
 - response status
 
 
- 
toResponse
public javax.ws.rs.core.Response toResponse(E exception)
- Specified by:
 toResponsein interfacejavax.ws.rs.ext.ExceptionMapper<E extends java.lang.Throwable>
 
- 
response
protected javax.ws.rs.core.Response.ResponseBuilder response(javax.ws.rs.core.Response.Status status, java.lang.Throwable exception)Produces a response builder primed with the supplied status code and JSON entity with the status code and exception message.- Parameters:
 status- response statusexception- exception to encode- Returns:
 - response builder
 
 
- 
messageFrom
protected java.lang.String messageFrom(java.lang.Throwable exception)
Produces a response message from the supplied exception. Either it will use the exception message, if there is one, or it will use the top stack-frame message.- Parameters:
 exception- exception from which to produce a message- Returns:
 - response message
 
 
 - 
 
 -