public abstract class BHiveSecuredRequestResponseBodyMethodProcessor
extends org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessor
implements org.springframework.beans.factory.InitializingBean
RequestBody, ResponseBody를 처리하는 RequestResponseBodyMethodProcessor와 유사하지만,
SecuredRequestBody, SecuredResponseBody를 암복호화하여 처리
상속등으로 사용하고, secretKey를 서비스에 맞춰서 설정하면 된다.
Resolves method arguments annotated with @SecuredRequestBody and
handles return values from methods annotated with
@SecuredResponseBody by reading and writing to the body of the
request or response with an HttpMessageConverter.
An @SecuredRequestBody method argument is also validated if it is
annotated with @javax.validation.Valid. In case of validation
failure, MethodArgumentNotValidException is raised and results in a
400 response status code if DefaultHandlerExceptionResolver is
configured.
| Constructor and Description |
|---|
BHiveSecuredRequestResponseBodyMethodProcessor(List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters) |
BHiveSecuredRequestResponseBodyMethodProcessor(List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters,
org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager) |
BHiveSecuredRequestResponseBodyMethodProcessor(List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters,
org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager,
List<Object> responseBodyAdvice) |
| Modifier and Type | Method and Description |
|---|---|
void |
afterPropertiesSet() |
protected org.springframework.http.server.ServletServerHttpResponse |
createOutputMessage(org.springframework.web.context.request.NativeWebRequest webRequest) |
String |
getSecretKey() |
void |
handleReturnValue(Object returnValue,
org.springframework.core.MethodParameter returnType,
org.springframework.web.method.support.ModelAndViewContainer mavContainer,
org.springframework.web.context.request.NativeWebRequest webRequest) |
protected <T> Object |
readWithMessageConverters(org.springframework.web.context.request.NativeWebRequest webRequest,
org.springframework.core.MethodParameter methodParam,
Type paramType) |
Object |
resolveArgument(org.springframework.core.MethodParameter parameter,
org.springframework.web.method.support.ModelAndViewContainer mavContainer,
org.springframework.web.context.request.NativeWebRequest webRequest,
org.springframework.web.bind.support.WebDataBinderFactory binderFactory)
Throws MethodArgumentNotValidException if validation fails.
|
void |
setSecretKey(String secretKey) |
boolean |
supportsParameter(org.springframework.core.MethodParameter parameter) |
boolean |
supportsReturnType(org.springframework.core.MethodParameter returnType) |
protected <T> void |
writeWithMessageConverters(T returnValue,
org.springframework.core.MethodParameter returnType,
org.springframework.web.context.request.NativeWebRequest webRequest) |
getProducibleMediaTypes, getProducibleMediaTypes, getReturnValueType, writeWithMessageConvertersprotected String secretKey
public BHiveSecuredRequestResponseBodyMethodProcessor(List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters)
public BHiveSecuredRequestResponseBodyMethodProcessor(List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters, org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager)
public BHiveSecuredRequestResponseBodyMethodProcessor(List<org.springframework.http.converter.HttpMessageConverter<?>> messageConverters, org.springframework.web.accept.ContentNegotiationManager contentNegotiationManager, List<Object> responseBodyAdvice)
public String getSecretKey()
public void setSecretKey(String secretKey)
public void afterPropertiesSet()
throws Exception
afterPropertiesSet in interface org.springframework.beans.factory.InitializingBeanExceptionpublic boolean supportsParameter(org.springframework.core.MethodParameter parameter)
supportsParameter in interface org.springframework.web.method.support.HandlerMethodArgumentResolverpublic boolean supportsReturnType(org.springframework.core.MethodParameter returnType)
supportsReturnType in interface org.springframework.web.method.support.HandlerMethodReturnValueHandlerpublic Object resolveArgument(org.springframework.core.MethodParameter parameter, org.springframework.web.method.support.ModelAndViewContainer mavContainer, org.springframework.web.context.request.NativeWebRequest webRequest, org.springframework.web.bind.support.WebDataBinderFactory binderFactory) throws Exception
resolveArgument in interface org.springframework.web.method.support.HandlerMethodArgumentResolverorg.springframework.http.converter.HttpMessageNotReadableException - if RequestBody.required()
is true and there is no body content or if there is no suitable
converter to read the content with.Exceptionprotected <T> Object readWithMessageConverters(org.springframework.web.context.request.NativeWebRequest webRequest, org.springframework.core.MethodParameter methodParam, Type paramType) throws IOException, org.springframework.web.HttpMediaTypeNotSupportedException
readWithMessageConverters in class org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodArgumentResolverIOExceptionorg.springframework.web.HttpMediaTypeNotSupportedExceptionpublic void handleReturnValue(Object returnValue, org.springframework.core.MethodParameter returnType, org.springframework.web.method.support.ModelAndViewContainer mavContainer, org.springframework.web.context.request.NativeWebRequest webRequest) throws IOException, org.springframework.web.HttpMediaTypeNotAcceptableException
handleReturnValue in interface org.springframework.web.method.support.HandlerMethodReturnValueHandlerIOExceptionorg.springframework.web.HttpMediaTypeNotAcceptableExceptionprotected org.springframework.http.server.ServletServerHttpResponse createOutputMessage(org.springframework.web.context.request.NativeWebRequest webRequest)
createOutputMessage in class org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessorprotected <T> void writeWithMessageConverters(T returnValue,
org.springframework.core.MethodParameter returnType,
org.springframework.web.context.request.NativeWebRequest webRequest)
throws IOException,
org.springframework.web.HttpMediaTypeNotAcceptableException
writeWithMessageConverters in class org.springframework.web.servlet.mvc.method.annotation.AbstractMessageConverterMethodProcessorIOExceptionorg.springframework.web.HttpMediaTypeNotAcceptableExceptionCopyright © 2018. All rights reserved.