public class DefaultExceptionTranslator extends Object implements ExceptionTranslator, cn.home1.oss.lib.common.msginterpolate.MessageInterpolatorAware
ExceptionTranslator.Location| Constructor and Description |
|---|
DefaultExceptionTranslator() |
| Modifier and Type | Method and Description |
|---|---|
Optional<Integer> |
defaultStatus(org.springframework.context.MessageSource messageSource) |
Optional<String> |
defaultTemplate(org.springframework.context.MessageSource messageSource) |
Optional<ExceptionTranslator.Location> |
find(Throwable throwable)
locate info.
|
protected String |
getValue(org.springframework.context.MessageSource messageSource,
String type,
String field) |
protected static String |
getValue(org.springframework.context.MessageSource messageSource,
String type,
String field,
Locale locale) |
Optional<String> |
localizedMessage(String template,
org.springframework.web.context.request.RequestAttributes request,
Throwable throwable,
Map<String,Serializable> contextVariables)
Translate exception and generates localized message.
|
void |
setMessageInterpolator(cn.home1.oss.lib.common.msginterpolate.MessageInterpolator messageInterpolator) |
void |
setMessageSources(List<org.springframework.context.MessageSource> messageSources) |
Optional<Integer> |
status(ExceptionTranslator.Location location) |
protected Optional<Integer> |
status(org.springframework.context.MessageSource messageSource,
String type) |
Optional<String> |
template(ExceptionTranslator.Location location) |
protected Optional<String> |
template(org.springframework.context.MessageSource messageSource,
String type) |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitrootMessageSourcepublic void setMessageSources(List<org.springframework.context.MessageSource> messageSources)
public void setMessageInterpolator(cn.home1.oss.lib.common.msginterpolate.MessageInterpolator messageInterpolator)
setMessageInterpolator in interface cn.home1.oss.lib.common.msginterpolate.MessageInterpolatorAwarepublic Optional<ExceptionTranslator.Location> find(Throwable throwable)
ExceptionTranslatorfind in interface ExceptionTranslatorthrowable - The exception to handle and get data from.public Optional<String> defaultTemplate(org.springframework.context.MessageSource messageSource)
public Optional<Integer> defaultStatus(org.springframework.context.MessageSource messageSource)
public Optional<String> localizedMessage(String template, org.springframework.web.context.request.RequestAttributes request, Throwable throwable, Map<String,Serializable> contextVariables)
ExceptionTranslatorlocalizedMessage in interface ExceptionTranslatortemplate - templaterequest - The current request attributes.throwable - throwablecontextVariables - The variables in contextpublic Optional<Integer> status(ExceptionTranslator.Location location)
status in interface ExceptionTranslatorprotected Optional<Integer> status(org.springframework.context.MessageSource messageSource, String type)
public Optional<String> template(ExceptionTranslator.Location location)
template in interface ExceptionTranslatorprotected Optional<String> template(org.springframework.context.MessageSource messageSource, String type)
protected String getValue(org.springframework.context.MessageSource messageSource, String type, String field)
Copyright © 2017. All rights reserved.