Class RequestBodyAdvice

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
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    afterBodyRead(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.HttpInputMessage
    beforeBodyRead(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)
    如果主体为空,则调用第二个(也是最后一个).
    boolean
    supports(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, validateException

    Methods inherited from class org.miaixz.bus.core.basic.spring.Controller

    write, write, write, write, write

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • 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:
      supports in interface org.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:
      beforeBodyRead in interface org.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:
      afterBodyRead in interface org.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:
      handleEmptyBody in interface org.springframework.web.servlet.mvc.method.annotation.RequestBodyAdvice
      Parameters:
      body - 通常在调用第一个通知之前将其设置为null
      inputMessage - HTTP输入消息
      parameter - 方法参数
      type - 目标类型,不一定与方法相同 参数类型,例如 HttpEntity<String>.
      converterType - 转换器类型
      Returns:
      要使用的值或null,该值可能会引发HttpMessageNotReadableException.