@RestControllerAdvice public class GlobalControllerAdvice extends Object implements org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvice
| 构造器和说明 |
|---|
GlobalControllerAdvice(String[] ignoreMethods) |
| 限定符和类型 | 方法和说明 |
|---|---|
Object |
beforeBodyWrite(Object body,
org.springframework.core.MethodParameter returnType,
org.springframework.http.MediaType selectedContentType,
Class selectedConverterType,
org.springframework.http.server.ServerHttpRequest request,
org.springframework.http.server.ServerHttpResponse response)
Invoked after an
HttpMessageConverter is selected and just before
its write method is invoked. |
boolean |
supports(org.springframework.core.MethodParameter returnType,
Class converterType)
Whether this component supports the given controller method return type
and the selected
HttpMessageConverter type. |
public GlobalControllerAdvice(String[] ignoreMethods)
public boolean supports(org.springframework.core.MethodParameter returnType,
Class converterType)
HttpMessageConverter type.supports 在接口中 org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvicereturnType - the return typeconverterType - the selected converter typetrue if beforeBodyWrite(java.lang.Object, org.springframework.core.MethodParameter, org.springframework.http.MediaType, java.lang.Class, org.springframework.http.server.ServerHttpRequest, org.springframework.http.server.ServerHttpResponse) should be invoked;
false otherwisepublic Object beforeBodyWrite(Object body, org.springframework.core.MethodParameter returnType, org.springframework.http.MediaType selectedContentType, Class selectedConverterType, org.springframework.http.server.ServerHttpRequest request, org.springframework.http.server.ServerHttpResponse response)
HttpMessageConverter is selected and just before
its write method is invoked.beforeBodyWrite 在接口中 org.springframework.web.servlet.mvc.method.annotation.ResponseBodyAdvicebody - the body to be writtenreturnType - the return type of the controller methodselectedContentType - the content type selected through content negotiationselectedConverterType - the converter type selected to write to the responserequest - the current requestresponse - the current responseCopyright © 2019. All rights reserved.