@RestController public abstract class BaseController extends Object implements org.springframework.web.context.ServletConfigAware
Serves as central ExceptionHandler for all Web bindings inheriting from this class.
WebExceptions indicate an expected workflows while unexpected exceptions are automatically wrapped
to InternalServerExceptions as fallback.
Developers should consider to add hints via WebException.addHint(String) so that as much
information is communicated to the caller as possible.
| Constructor and Description |
|---|
BaseController() |
| Modifier and Type | Method and Description |
|---|---|
protected com.fasterxml.jackson.databind.ObjectMapper |
createObjectMapper() |
protected IoParameters |
createParameters(Map<String,String> query,
String locale) |
protected IoParameters |
createParameters(org.springframework.util.MultiValueMap<String,String> query,
String locale) |
protected IoParameters |
createParameters(RequestSimpleParameterSet query,
String locale) |
protected IoParameters |
createParameters(RequestStyledParameterSet query,
String locale) |
protected IoParameters |
createParameters(String datasetId,
Map<String,String> query,
String locale) |
protected IoParameters |
createParameters(String datasetId,
org.springframework.util.MultiValueMap<String,String> query,
String locale) |
protected BiConsumer<String,IoParseException> |
getExceptionHandle() |
javax.servlet.ServletConfig |
getServletConfig() |
void |
handle400(Exception e,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
handle404(Exception e,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
handle500(Exception e,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
void |
handleException(Exception e,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response) |
protected boolean |
isRequestingJsonData(javax.servlet.http.HttpServletRequest request) |
protected boolean |
isRequestingPdfData(javax.servlet.http.HttpServletRequest request) |
protected boolean |
isRequestingPngData(javax.servlet.http.HttpServletRequest request) |
void |
setServletConfig(javax.servlet.ServletConfig servletConfig) |
protected BiConsumer<String,IoParseException> getExceptionHandle()
protected IoParameters createParameters(RequestSimpleParameterSet query, String locale)
protected IoParameters createParameters(RequestStyledParameterSet query, String locale)
protected IoParameters createParameters(org.springframework.util.MultiValueMap<String,String> query, String locale)
protected IoParameters createParameters(String datasetId, org.springframework.util.MultiValueMap<String,String> query, String locale)
protected IoParameters createParameters(Map<String,String> query, String locale)
protected IoParameters createParameters(String datasetId, Map<String,String> query, String locale)
public void setServletConfig(javax.servlet.ServletConfig servletConfig)
setServletConfig in interface org.springframework.web.context.ServletConfigAwarepublic javax.servlet.ServletConfig getServletConfig()
protected boolean isRequestingJsonData(javax.servlet.http.HttpServletRequest request)
protected boolean isRequestingPdfData(javax.servlet.http.HttpServletRequest request)
protected boolean isRequestingPngData(javax.servlet.http.HttpServletRequest request)
@ExceptionHandler(value={BadRequestException.class,BadQueryParameterException.class})
public void handle400(Exception e,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
@ExceptionHandler(value=ResourceNotFoundException.class) public void handle404(Exception e, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
@ExceptionHandler(value=InternalServerException.class) public void handle500(Exception e, javax.servlet.http.HttpServletRequest request, javax.servlet.http.HttpServletResponse response)
@ExceptionHandler(value={java.lang.RuntimeException.class,java.lang.Exception.class,java.lang.Throwable.class})
public void handleException(Exception e,
javax.servlet.http.HttpServletRequest request,
javax.servlet.http.HttpServletResponse response)
protected com.fasterxml.jackson.databind.ObjectMapper createObjectMapper()
Copyright © 2013–2019 52North Initiative for Geospatial Open Source Software GmbH. All rights reserved.