类 AbstractJsonpResponseBodyAdvice
- java.lang.Object
- org.springframework.web.servlet.mvc.method.annotation.AbstractMappingJacksonResponseBodyAdvice
- org.springframework.web.servlet.mvc.method.annotation.AbstractJsonpResponseBodyAdvice
- 所有已实现的接口:
ResponseBodyAdvice<Object>
@Deprecated public abstract class AbstractJsonpResponseBodyAdvice extends AbstractMappingJacksonResponseBodyAdvice
已过时。Will be removed as of Spring Framework 5.1, use CORS instead.A convenient base class for aResponseBodyAdvice
to instruct theMappingJackson2HttpMessageConverter
to serialize with JSONP formatting.Sub-classes must specify the query parameter name(s) to check for the name of the JSONP callback function.
Sub-classes are likely to be annotated with the
@ControllerAdvice
annotation and auto-detected or otherwise must be registered directly with theRequestMappingHandlerAdapter
andExceptionHandlerExceptionResolver
.- 从以下版本开始:
- 4.1
- 作者:
- Rossen Stoyanchev
构造器概要
构造器 限定符 构造器 说明 protected
AbstractJsonpResponseBodyAdvice(String... queryParamNames)
已过时。
方法概要
所有方法 实例方法 具体方法 已过时的方法 修饰符和类型 方法 说明 protected void
beforeBodyWriteInternal(MappingJacksonValue bodyContainer, MediaType contentType, MethodParameter returnType, ServerHttpRequest request, ServerHttpResponse response)
已过时。Invoked only if the converter type isMappingJackson2HttpMessageConverter
.protected MediaType
getContentType(MediaType contentType, ServerHttpRequest request, ServerHttpResponse response)
已过时。Return the content type to set the response to.protected boolean
isValidJsonpQueryParam(String value)
已过时。Validate the jsonp query parameter value.从类继承的方法 org.springframework.web.servlet.mvc.method.annotation.AbstractMappingJacksonResponseBodyAdvice
beforeBodyWrite, getOrCreateContainer, supports
构造器详细资料
AbstractJsonpResponseBodyAdvice
protected AbstractJsonpResponseBodyAdvice(String... queryParamNames)
已过时。
方法详细资料
beforeBodyWriteInternal
protected void beforeBodyWriteInternal(MappingJacksonValue bodyContainer, MediaType contentType, MethodParameter returnType, ServerHttpRequest request, ServerHttpResponse response)
已过时。Invoked only if the converter type isMappingJackson2HttpMessageConverter
.
isValidJsonpQueryParam
protected boolean isValidJsonpQueryParam(String value)
已过时。Validate the jsonp query parameter value. The default implementation returns true if it consists of digits, letters, or "_" and ".". Invalid parameter values are ignored.- 参数:
value
- the query param value, nevernull
- 从以下版本开始:
- 4.1.8
getContentType
protected MediaType getContentType(MediaType contentType, ServerHttpRequest request, ServerHttpResponse response)
已过时。Return the content type to set the response to. This implementation always returns "application/javascript".- 参数:
contentType
- the content type selected through content negotiationrequest
- the current requestresponse
- the current response- 返回:
- the content type to set the response to