Class VoidResponseBodyAdvice

java.lang.Object
com.feiniaojin.gracefulresponse.advice.VoidResponseBodyAdvice
All Implemented Interfaces:
org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice<Object>

@ControllerAdvice @Order(1000) public class VoidResponseBodyAdvice extends Object implements org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice<Object>
空返回值的拦截处理.
Since:
0.1
Version:
0.1
Author:
Yujie
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    beforeBodyWrite(Object body, org.springframework.core.MethodParameter returnType, org.springframework.http.MediaType selectedContentType, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> selectedConverterType, org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response)
     
    boolean
    supports(org.springframework.core.MethodParameter methodParameter, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> clazz)
    只处理返回空的Controller方法.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • VoidResponseBodyAdvice

      public VoidResponseBodyAdvice()
  • Method Details

    • supports

      public boolean supports(org.springframework.core.MethodParameter methodParameter, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> clazz)
      只处理返回空的Controller方法.
      Specified by:
      supports in interface org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice<Object>
      Parameters:
      methodParameter - 返回类型
      clazz - 消息转换器
      Returns:
      是否对这种返回值进行处理
    • beforeBodyWrite

      public Object beforeBodyWrite(Object body, org.springframework.core.MethodParameter returnType, org.springframework.http.MediaType selectedContentType, Class<? extends org.springframework.http.converter.HttpMessageConverter<?>> selectedConverterType, org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response)
      Specified by:
      beforeBodyWrite in interface org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice<Object>