E
- Type of the Exception this mapper works for.public abstract class AbstractExceptionMapper<E extends Throwable> extends Object implements javax.ws.rs.ext.ExceptionMapper<E>
Constructor and Description |
---|
AbstractExceptionMapper() |
Modifier and Type | Method and Description |
---|---|
protected Locale |
getCurrentUserLocale(org.restlet.Request request)
Get the locale of the current user
|
abstract String |
getErrorMessage(E exception)
Get the message of the exception in mapper.
|
protected String |
getLocalizedMessage(String messageKey,
Object... arguments) |
abstract int |
getStatusCode() |
ApiResult<Object> |
handle(E exception,
ApiResult<Object> apiResult)
Subclass can override this method to add more detailed information to the response via the
api result.
|
javax.ws.rs.core.Response |
toResponse(E exception) |
protected Locale getCurrentUserLocale(org.restlet.Request request)
request
- Request
Locale
public abstract String getErrorMessage(E exception)
exception
- thrownprotected String getLocalizedMessage(String messageKey, Object... arguments)
messageKey
- key of the messagearguments
- argumentspublic abstract int getStatusCode()
public ApiResult<Object> handle(E exception, ApiResult<Object> apiResult)
exception
- The exception.apiResult
- The api result this mapper can handle with.ApiResult
which should be used for the response.Copyright © 2019 Communote team. All rights reserved.