java.lang.Object
org.miaixz.bus.core.basic.spring.Controller
org.miaixz.bus.base.advice.BaseAdvice
org.miaixz.bus.starter.sensitive.RequestBodyAdvice
- All Implemented Interfaces:
org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice
public class RequestBodyAdvice
extends org.miaixz.bus.base.advice.BaseAdvice
implements org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice
请求请求处理类(目前仅仅对requestbody有效) 对加了@P的方法的数据进行解密密操作
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionafterBodyRead(Object body, org.springframework.http.HttpInputMessage inputMessage, org.springframework.core.MethodParameter parameter, Type type, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType) 在请求体转换为对象之后调用第三个(也是最后一个).org.springframework.http.HttpInputMessagebeforeBodyRead(org.springframework.http.HttpInputMessage inputMessage, org.springframework.core.MethodParameter parameter, Type type, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType) 在读取和转换请求体之前调用.handleEmptyBody(Object body, org.springframework.http.HttpInputMessage inputMessage, org.springframework.core.MethodParameter parameter, Type type, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType) 如果主体为空,则调用第二个(也是最后一个).booleansupports(org.springframework.core.MethodParameter parameter, Type type, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType) 首次调用,以确定是否应用此拦截.Methods inherited from class org.miaixz.bus.base.advice.BaseAdvice
addAttributes, businessException, crontabException, defaultException, defaultExceptionHandler, handleBodyValidException, httpMediaTypeNotSupportedException, httpRequestMethodNotSupportedException, initBinder, InternalException, noHandlerFoundException, validateExceptionMethods inherited from class org.miaixz.bus.core.basic.spring.Controller
write, write, write, write, write, write, write, writeMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice
determineReadHints
-
Constructor Details
-
RequestBodyAdvice
public RequestBodyAdvice()
-
-
Method Details
-
supports
public boolean supports(org.springframework.core.MethodParameter parameter, Type type, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType) 首次调用,以确定是否应用此拦截.- Specified by:
supportsin interfaceorg.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice- Parameters:
parameter- 方法参数type- 目标类型,不一定与方法相同 参数类型,例如HttpEntity<String>.converterType- 转换器类型- Returns:
- true/false 是否应该调用此拦截
-
beforeBodyRead
public org.springframework.http.HttpInputMessage beforeBodyRead(org.springframework.http.HttpInputMessage inputMessage, org.springframework.core.MethodParameter parameter, Type type, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType) 在读取和转换请求体之前调用.- Specified by:
beforeBodyReadin interfaceorg.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice- Parameters:
inputMessage- HTTP输入消息parameter- 方法参数type- 目标类型,不一定与方法相同 参数类型,例如HttpEntity<String>.converterType- 转换器类型- Returns:
- 输入请求或新实例, 永远不会
null
-
afterBodyRead
public Object afterBodyRead(Object body, org.springframework.http.HttpInputMessage inputMessage, org.springframework.core.MethodParameter parameter, Type type, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType) 在请求体转换为对象之后调用第三个(也是最后一个).- Specified by:
afterBodyReadin interfaceorg.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice- Parameters:
body- 在调用第一个通知之前将其设置为转换器对象inputMessage- HTTP输入消息parameter- 方法参数type- 目标类型,不一定与方法相同 参数类型,例如HttpEntity<String>.converterType- 转换器类型- Returns:
- 相同的主体或新实例
-
handleEmptyBody
public Object handleEmptyBody(Object body, org.springframework.http.HttpInputMessage inputMessage, org.springframework.core.MethodParameter parameter, Type type, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> converterType) 如果主体为空,则调用第二个(也是最后一个).- Specified by:
handleEmptyBodyin interfaceorg.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice- Parameters:
body- 通常在调用第一个通知之前将其设置为nullinputMessage- HTTP输入消息parameter- 方法参数type- 目标类型,不一定与方法相同 参数类型,例如HttpEntity<String>.converterType- 转换器类型- Returns:
- 要使用的值或
null,该值可能会引发HttpMessageNotReadableException.
-