类 UnsupportedMediaTypeStatusException
- java.lang.Object
- java.lang.Throwable
- java.lang.Exception
- java.lang.RuntimeException
- org.springframework.core.NestedRuntimeException
- org.springframework.web.server.ResponseStatusException
- org.springframework.web.server.UnsupportedMediaTypeStatusException
- 所有已实现的接口:
Serializable
public class UnsupportedMediaTypeStatusException extends ResponseStatusException
Exception for errors that fit response status 415 (unsupported media type).- 从以下版本开始:
- 5.0
- 作者:
- Rossen Stoyanchev
- 另请参阅:
- 序列化表格
构造器概要
构造器 构造器 说明 UnsupportedMediaTypeStatusException(String reason)
Constructor for when the specified Content-Type is invalid.UnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes)
Constructor for when the Content-Type can be parsed but is not supported.UnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes, ResolvableType bodyType)
Constructor for when trying to encode from or decode to a specific Java type.
方法概要
所有方法 实例方法 具体方法 修饰符和类型 方法 说明 ResolvableType
getBodyType()
Return the body type in the context of which this exception was generated.MediaType
getContentType()
Return the request Content-Type header if it was parsed successfully, ornull
otherwise.List<MediaType>
getSupportedMediaTypes()
Return the list of supported content types in cases when the Content-Type header is parsed but not supported, or an empty list otherwise.从类继承的方法 org.springframework.web.server.ResponseStatusException
getHeaders, getMessage, getReason, getResponseHeaders, getStatus
从类继承的方法 org.springframework.core.NestedRuntimeException
contains, getMostSpecificCause, getRootCause
构造器详细资料
UnsupportedMediaTypeStatusException
public UnsupportedMediaTypeStatusException(@Nullable String reason)
Constructor for when the specified Content-Type is invalid.
UnsupportedMediaTypeStatusException
public UnsupportedMediaTypeStatusException(@Nullable MediaType contentType, List<MediaType> supportedTypes)
Constructor for when the Content-Type can be parsed but is not supported.
UnsupportedMediaTypeStatusException
public UnsupportedMediaTypeStatusException(@Nullable MediaType contentType, List<MediaType> supportedTypes, @Nullable ResolvableType bodyType)
Constructor for when trying to encode from or decode to a specific Java type.- 从以下版本开始:
- 5.1
方法详细资料
getContentType
@Nullable public MediaType getContentType()
Return the request Content-Type header if it was parsed successfully, ornull
otherwise.
getSupportedMediaTypes
public List<MediaType> getSupportedMediaTypes()
Return the list of supported content types in cases when the Content-Type header is parsed but not supported, or an empty list otherwise.
getBodyType
@Nullable public ResolvableType getBodyType()
Return the body type in the context of which this exception was generated.This is applicable when the exception was raised as a result trying to encode from or decode to a specific Java type.
- 返回:
- the body type, or
null
if not available - 从以下版本开始:
- 5.1