Uses of Class
org.springframework.http.MediaType
Packages that use MediaType
Package
Description
Contains a basic abstraction over client/server-side HTTP.
Contains an abstraction over client-side HTTP.
Provides implementations of
Encoder
and Decoder for web use.JSON encoder and decoder support.
Multipart support.
Provides an encoder and a decoder for
Google Protocol Buffers.
Provides an HttpMessageConverter abstraction to convert between Java objects and HTTP input/output messages.
Provides HttpMessageConverter implementations for handling Atom and RSS feeds.
Provides HttpMessageConverter implementations for handling JSON.
Provides an HttpMessageConverter implementation for handling
Google Protocol Buffers.
Provides HttpMessageConverter implementations for handling XML.
Common, generic interfaces that define minimal boundary points
between Spring's web infrastructure and other framework modules.
This package contains classes used to determine the requested the media types in a request.
Core package of the client-side web support.
Support classes for annotation-based handler method processing.
Core interfaces and classes for Spring's generic, reactive web support.
Support for creating a client proxy for an HTTP service annotated with
HttpExchange methods.-
Uses of MediaType in org.springframework.http
Fields in org.springframework.http declared as MediaTypeModifier and TypeFieldDescriptionstatic final MediaTypeMediaType.ALLPublic constant media type that includes all media ranges (i.e.static final MediaTypeMediaType.APPLICATION_ATOM_XMLPublic constant media type forapplication/atom+xml.static final MediaTypeMediaType.APPLICATION_CBORPublic constant media type forapplication/cbor.static final MediaTypeMediaType.APPLICATION_FORM_URLENCODEDPublic constant media type forapplication/x-www-form-urlencoded.static final MediaTypeMediaType.APPLICATION_GRAPHQLDeprecated, for removal: This API element is subject to removal in a future version.static final MediaTypeMediaType.APPLICATION_GRAPHQL_RESPONSEPublic constant media type forapplication/graphql-response+json.static final MediaTypeMediaType.APPLICATION_JSONPublic constant media type forapplication/json.static final MediaTypeMediaType.APPLICATION_JSON_UTF8Deprecated.as of 5.2 in favor ofAPPLICATION_JSONsince major browsers like Chrome now comply with the specification and interpret correctly UTF-8 special characters without requiring acharset=UTF-8parameter.static final MediaTypeMediaType.APPLICATION_NDJSONPublic constant media type forapplication/x-ndjson.static final MediaTypeMediaType.APPLICATION_OCTET_STREAMPublic constant media type forapplication/octet-stream.static final MediaTypeMediaType.APPLICATION_PDFPublic constant media type forapplication/pdf.static final MediaTypeMediaType.APPLICATION_PROBLEM_JSONPublic constant media type forapplication/problem+json.static final MediaTypeMediaType.APPLICATION_PROBLEM_JSON_UTF8Deprecated.as of 5.2 in favor ofAPPLICATION_PROBLEM_JSONsince major browsers like Chrome now comply with the specification and interpret correctly UTF-8 special characters without requiring acharset=UTF-8parameter.static final MediaTypeMediaType.APPLICATION_PROBLEM_XMLPublic constant media type forapplication/problem+xml.static final MediaTypeMediaType.APPLICATION_PROTOBUFPublic constant media type forapplication/x-protobuf.static final MediaTypeMediaType.APPLICATION_RSS_XMLPublic constant media type forapplication/rss+xml.static final MediaTypeMediaType.APPLICATION_STREAM_JSONDeprecated.as of 5.3, see notice onAPPLICATION_STREAM_JSON_VALUE.static final MediaTypeMediaType.APPLICATION_XHTML_XMLPublic constant media type forapplication/xhtml+xml.static final MediaTypeMediaType.APPLICATION_XMLPublic constant media type forapplication/xml.static final MediaTypeMediaType.APPLICATION_YAMLPublic constant media type forapplication/yaml.static final MediaTypeMediaType.IMAGE_GIFPublic constant media type forimage/gif.static final MediaTypeMediaType.IMAGE_JPEGPublic constant media type forimage/jpeg.static final MediaTypeMediaType.IMAGE_PNGPublic constant media type forimage/png.static final MediaTypeMediaType.MULTIPART_FORM_DATAPublic constant media type formultipart/form-data.static final MediaTypeMediaType.MULTIPART_MIXEDPublic constant media type formultipart/mixed.static final MediaTypeMediaType.MULTIPART_RELATEDPublic constant media type formultipart/related.static final MediaTypeMediaType.TEXT_EVENT_STREAMPublic constant media type fortext/event-stream.static final MediaTypeMediaType.TEXT_HTMLPublic constant media type fortext/html.static final MediaTypeMediaType.TEXT_MARKDOWNPublic constant media type fortext/markdown.static final MediaTypeMediaType.TEXT_PLAINPublic constant media type fortext/plain.static final MediaTypeMediaType.TEXT_XMLPublic constant media type fortext/xml.Fields in org.springframework.http with type parameters of type MediaTypeModifier and TypeFieldDescriptionstatic final Comparator<MediaType>MediaType.QUALITY_VALUE_COMPARATORDeprecated, for removal: This API element is subject to removal in a future version.as of 6.0, with no direct replacementstatic final Comparator<MediaType>MediaType.SPECIFICITY_COMPARATORDeprecated, for removal: This API element is subject to removal in a future version.as of 6.0, with no direct replacementMethods in org.springframework.http that return MediaTypeModifier and TypeMethodDescriptionstatic MediaTypeMediaType.asMediaType(org.springframework.util.MimeType mimeType) Re-create the given mime type as a media type.MediaType.copyQualityValue(MediaType mediaType) Return a replica of this instance with the quality value of the givenMediaType.HttpHeaders.getContentType()Return the media type of the body, as specified by theContent-Typeheader.static MediaTypeMediaType.parseMediaType(String mediaType) Parse the given String into a singleMediaType.MediaType.removeQualityValue()Return a replica of this instance with its quality value removed.static MediaTypeParse the given String value into aMediaTypeobject, with this method name following the 'valueOf' naming convention (as supported byConversionService).Methods in org.springframework.http that return types with arguments of type MediaTypeModifier and TypeMethodDescriptionMediaType.asMediaTypes(List<org.springframework.util.MimeType> mimeTypes) Re-create the given mime types as media types.HttpHeaders.getAccept()Return the list of acceptable media types, as specified by theAcceptheader.HttpHeaders.getAcceptPatch()Return the list of acceptable media types forPATCHmethods, as specified by theAccept-Patchheader.MediaTypeFactory.getMediaType(String filename) Determine a media type for the given file name, if possible.MediaTypeFactory.getMediaType(org.springframework.core.io.Resource resource) Determine a media type for the given resource, if possible.MediaTypeFactory.getMediaTypes(String filename) Determine the media types for the given file name, if possible.MediaType.parseMediaTypes(String mediaTypes) Parse the comma-separated string into a list ofMediaTypeobjects.MediaType.parseMediaTypes(List<String> mediaTypes) Parse the given list of (potentially) comma-separated strings into a list ofMediaTypeobjects.Methods in org.springframework.http with parameters of type MediaTypeModifier and TypeMethodDescriptionSet the list of acceptable media types, as specified by theAcceptheader.RequestEntity.BodyBuilder.contentType(MediaType contentType) Set the media type of the body, as specified by theContent-Typeheader.ResponseEntity.BodyBuilder.contentType(MediaType contentType) Set the media type of the body, as specified by theContent-Typeheader.MediaType.copyQualityValue(MediaType mediaType) Return a replica of this instance with the quality value of the givenMediaType.booleanIndicate whether thisMediaTypeincludes the given media type.booleanMediaType.isCompatibleWith(MediaType other) Indicate whether thisMediaTypeis compatible with the given media type.voidHttpHeaders.setContentType(MediaType mediaType) Set the media type of the body, as specified by theContent-Typeheader.Method parameters in org.springframework.http with type arguments of type MediaTypeModifier and TypeMethodDescriptionvoidSet the list of acceptable media types, as specified by theAcceptheader.voidHttpHeaders.setAcceptPatch(List<MediaType> mediaTypes) static voidMediaType.sortByQualityValue(List<MediaType> mediaTypes) Deprecated, for removal: This API element is subject to removal in a future version.as of 6.0, with no direct replacementstatic voidMediaType.sortBySpecificity(List<MediaType> mediaTypes) Deprecated, for removal: This API element is subject to removal in a future version.as of 6.0, in favor ofMimeTypeUtils.sortBySpecificity(List)static voidMediaType.sortBySpecificityAndQuality(List<MediaType> mediaTypes) Deprecated, for removal: This API element is subject to removal in a future version.as of 6.0, in favor ofMimeTypeUtils.sortBySpecificity(List)static StringMediaType.toString(Collection<MediaType> mediaTypes) Return a string representation of the given list ofMediaTypeobjects.Constructors in org.springframework.http with parameters of type MediaTypeModifierConstructorDescriptionCopy-constructor that copies the type, subtype and parameters of the givenMediaType, and allows to set the specified character set.Copy-constructor that copies the type and subtype of the givenMediaType, and allows for different parameters. -
Uses of MediaType in org.springframework.http.client
Methods in org.springframework.http.client with parameters of type MediaTypeModifier and TypeMethodDescriptionMultipartBodyBuilder.PartBuilder.contentType(MediaType contentType) Set the media type of the part.Variant ofMultipartBodyBuilder.part(String, Object)that also accepts a MediaType. -
Uses of MediaType in org.springframework.http.codec
Methods in org.springframework.http.codec that return MediaTypeModifier and TypeMethodDescriptionprotected MediaTypeDecoderHttpMessageReader.getContentType(HttpMessage inputMessage) Determine the Content-Type of the HTTP message based on the "Content-Type" header or otherwise default toAPPLICATION_OCTET_STREAM.protected MediaTypeFormHttpMessageWriter.getMediaType(MediaType mediaType) Return the content type used to write forms, either the given media type or otherwiseapplication/x-www-form-urlencoded.Methods in org.springframework.http.codec that return types with arguments of type MediaTypeModifier and TypeMethodDescriptionDecoderHttpMessageReader.getReadableMediaTypes()DecoderHttpMessageReader.getReadableMediaTypes(org.springframework.core.ResolvableType elementType) FormHttpMessageReader.getReadableMediaTypes()HttpMessageReader.getReadableMediaTypes()Return the list of media types supported by this reader.HttpMessageReader.getReadableMediaTypes(org.springframework.core.ResolvableType elementType) Return the list of media types supported by this Reader for the given type of element.ServerSentEventHttpMessageReader.getReadableMediaTypes()HttpMessageEncoder.getStreamingMediaTypes()Return "streaming" media types for which flushing should be performed automatically vs at the end of the input stream.EncoderHttpMessageWriter.getWritableMediaTypes()EncoderHttpMessageWriter.getWritableMediaTypes(org.springframework.core.ResolvableType elementType) FormHttpMessageWriter.getWritableMediaTypes()HttpMessageWriter.getWritableMediaTypes()Return the list of media types supported by this Writer.HttpMessageWriter.getWritableMediaTypes(org.springframework.core.ResolvableType elementType) Return the list of media types supported by this Writer for the given type of element.ResourceHttpMessageWriter.getWritableMediaTypes()ServerSentEventHttpMessageWriter.getWritableMediaTypes()Methods in org.springframework.http.codec with parameters of type MediaTypeModifier and TypeMethodDescriptionreactor.core.publisher.Mono<Void>ResourceHttpMessageWriter.addDefaultHeaders(ReactiveHttpOutputMessage message, org.springframework.core.io.Resource resource, MediaType contentType, Map<String, Object> hints) Adds the default headers for the given resource to the given message.booleanDecoderHttpMessageReader.canRead(org.springframework.core.ResolvableType elementType, MediaType mediaType) booleanFormHttpMessageReader.canRead(org.springframework.core.ResolvableType elementType, MediaType mediaType) booleanWhether the given object type is supported by this reader.booleanServerSentEventHttpMessageReader.canRead(org.springframework.core.ResolvableType elementType, MediaType mediaType) booleanEncoderHttpMessageWriter.canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType) booleanFormHttpMessageWriter.canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType) booleanHttpMessageWriter.canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType) Whether the given object type is supported by this writer.booleanResourceHttpMessageWriter.canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType) booleanServerSentEventHttpMessageWriter.canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType) HttpMessageEncoder.getEncodeHints(org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) Get decoding hints based on the server request or annotations on the target controller method parameter.protected MediaTypeFormHttpMessageWriter.getMediaType(MediaType mediaType) Return the content type used to write forms, either the given media type or otherwiseapplication/x-www-form-urlencoded.EncoderHttpMessageWriter.getWriteHints(org.springframework.core.ResolvableType streamType, org.springframework.core.ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) Get additional hints for encoding for example based on the server request or annotations from controller method parameters.reactor.core.publisher.Mono<Void>EncoderHttpMessageWriter.write(Publisher<? extends T> inputStream, org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> hints) reactor.core.publisher.Mono<Void>EncoderHttpMessageWriter.write(Publisher<? extends T> inputStream, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints) reactor.core.publisher.Mono<Void>FormHttpMessageWriter.write(Publisher<? extends org.springframework.util.MultiValueMap<String, String>> inputStream, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints) default reactor.core.publisher.Mono<Void>HttpMessageWriter.write(Publisher<? extends T> inputStream, org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> hints) Server-side only alternative toHttpMessageWriter.write(Publisher, ResolvableType, MediaType, ReactiveHttpOutputMessage, Map)with additional context available.reactor.core.publisher.Mono<Void>HttpMessageWriter.write(Publisher<? extends T> inputStream, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints) Write a given stream of object to the output message.reactor.core.publisher.Mono<Void>ResourceHttpMessageWriter.write(Publisher<? extends org.springframework.core.io.Resource> inputStream, org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> hints) reactor.core.publisher.Mono<Void>ResourceHttpMessageWriter.write(Publisher<? extends org.springframework.core.io.Resource> inputStream, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints) reactor.core.publisher.Mono<Void>ServerSentEventHttpMessageWriter.write(Publisher<?> input, org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response, Map<String, Object> hints) reactor.core.publisher.Mono<Void>ServerSentEventHttpMessageWriter.write(Publisher<?> input, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage message, Map<String, Object> hints) Method parameters in org.springframework.http.codec with type arguments of type MediaTypeModifier and TypeMethodDescriptionvoidKotlinSerializationStringEncoder.setStreamingMediaTypes(Collection<MediaType> streamingMediaTypes) Set streamingMediaTypes. -
Uses of MediaType in org.springframework.http.codec.json
Methods in org.springframework.http.codec.json that return types with arguments of type MediaTypeMethods in org.springframework.http.codec.json with parameters of type MediaTypeModifier and TypeMethodDescriptionAbstractJackson2Encoder.getEncodeHints(org.springframework.core.ResolvableType actualType, org.springframework.core.ResolvableType elementType, MediaType mediaType, ServerHttpRequest request, ServerHttpResponse response) Method parameters in org.springframework.http.codec.json with type arguments of type MediaTypeModifier and TypeMethodDescriptionvoidAbstractJackson2Encoder.setStreamingMediaTypes(List<MediaType> mediaTypes) Configure "streaming" media types for which flushing should be performed automatically vs at the end of the stream. -
Uses of MediaType in org.springframework.http.codec.multipart
Methods in org.springframework.http.codec.multipart that return MediaTypeModifier and TypeMethodDescriptionprotected MediaTypeMultipartWriterSupport.getMultipartMediaType(MediaType mediaType, byte[] boundary) Prepare theMediaTypeto use by adding "boundary" and "charset" parameters to the givenmediaTypeor "multipart/form-data" otherwise by default.Methods in org.springframework.http.codec.multipart that return types with arguments of type MediaTypeModifier and TypeMethodDescriptionDefaultPartHttpMessageReader.getReadableMediaTypes()MultipartHttpMessageReader.getReadableMediaTypes()PartEventHttpMessageReader.getReadableMediaTypes()MultipartWriterSupport.getWritableMediaTypes()Methods in org.springframework.http.codec.multipart with parameters of type MediaTypeModifier and TypeMethodDescriptionbooleanDefaultPartHttpMessageReader.canRead(org.springframework.core.ResolvableType elementType, MediaType mediaType) booleanMultipartHttpMessageReader.canRead(org.springframework.core.ResolvableType elementType, MediaType mediaType) booleanPartEventHttpMessageReader.canRead(org.springframework.core.ResolvableType elementType, MediaType mediaType) booleanMultipartHttpMessageWriter.canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType) booleanPartEventHttpMessageWriter.canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType) booleanPartHttpMessageWriter.canWrite(org.springframework.core.ResolvableType elementType, MediaType mediaType) static reactor.core.publisher.Flux<FilePartEvent>FilePartEvent.create(String partName, String filename, MediaType contentType, reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer> contents) Creates a stream ofFilePartEventobjects based on the given name, FilePartEvent.filename(), content-type, and contents.static reactor.core.publisher.Flux<FilePartEvent>FilePartEvent.create(String partName, String filename, MediaType contentType, reactor.core.publisher.Flux<org.springframework.core.io.buffer.DataBuffer> contents, Consumer<HttpHeaders> headersConsumer) Creates a stream ofFilePartEventobjects based on the given name, FilePartEvent.filename(), content-type, and contents.protected MediaTypeMultipartWriterSupport.getMultipartMediaType(MediaType mediaType, byte[] boundary) Prepare theMediaTypeto use by adding "boundary" and "charset" parameters to the givenmediaTypeor "multipart/form-data" otherwise by default.reactor.core.publisher.Mono<Void>MultipartHttpMessageWriter.write(Publisher<? extends org.springframework.util.MultiValueMap<String, ?>> inputStream, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage outputMessage, Map<String, Object> hints) reactor.core.publisher.Mono<Void>PartEventHttpMessageWriter.write(Publisher<? extends PartEvent> partDataStream, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage outputMessage, Map<String, Object> hints) reactor.core.publisher.Mono<Void>PartHttpMessageWriter.write(Publisher<? extends Part> parts, org.springframework.core.ResolvableType elementType, MediaType mediaType, ReactiveHttpOutputMessage outputMessage, Map<String, Object> hints) Constructor parameters in org.springframework.http.codec.multipart with type arguments of type MediaTypeModifierConstructorDescriptionprotectedMultipartWriterSupport(List<MediaType> supportedMediaTypes) Constructor with the list of supported media types. -
Uses of MediaType in org.springframework.http.codec.protobuf
Methods in org.springframework.http.codec.protobuf that return types with arguments of type MediaTypeModifier and TypeMethodDescriptionProtobufEncoder.getStreamingMediaTypes()ProtobufJsonEncoder.getStreamingMediaTypes()Methods in org.springframework.http.codec.protobuf with parameters of type MediaType -
Uses of MediaType in org.springframework.http.converter
Methods in org.springframework.http.converter that return MediaTypeModifier and TypeMethodDescriptionprotected MediaTypeAbstractHttpMessageConverter.getDefaultContentType(T t) Returns the default content type for the given type.BufferedImageHttpMessageConverter.getDefaultContentType()Returns the defaultContent-Typeto be used for writing.protected MediaTypeResourceHttpMessageConverter.getDefaultContentType(org.springframework.core.io.Resource resource) protected MediaTypeResourceRegionHttpMessageConverter.getDefaultContentType(Object object) protected MediaTypeFormHttpMessageConverter.getFormContentType(MediaType contentType) Return the content type used to write forms, either the given content type or otherwiseapplication/x-www-form-urlencoded.Methods in org.springframework.http.converter that return types with arguments of type MediaTypeModifier and TypeMethodDescriptionAbstractHttpMessageConverter.getSupportedMediaTypes()AbstractKotlinSerializationHttpMessageConverter.getSupportedMediaTypes(Class<?> clazz) BufferedImageHttpMessageConverter.getSupportedMediaTypes()FormHttpMessageConverter.getSupportedMediaTypes()Return the list of media types supported by this converter.HttpMessageConverter.getSupportedMediaTypes()Return the list of media types supported by this converter.HttpMessageConverter.getSupportedMediaTypes(Class<?> clazz) Return the list of media types supported by this converter for the given class.Methods in org.springframework.http.converter with parameters of type MediaTypeModifier and TypeMethodDescriptionprotected voidAbstractHttpMessageConverter.addDefaultHeaders(HttpHeaders headers, T t, MediaType contentType) Add default headers to the output message.voidResourceHttpMessageConverter.addDefaultHeaders(HttpOutputMessage message, org.springframework.core.io.Resource resource, MediaType contentType) Add the default headers for the given resource to the given message.protected voidStringHttpMessageConverter.addDefaultHeaders(HttpHeaders headers, String s, MediaType type) voidFormHttpMessageConverter.addSupportedMediaTypes(MediaType... supportedMediaTypes) AddMediaTypeobjects to be supported by this converter.booleanbooleanThis implementation checks if the given class is supported, and if the supported media types include the given media type.protected booleanbooleanAbstractKotlinSerializationHttpMessageConverter.canRead(org.springframework.core.ResolvableType type, MediaType mediaType) booleanAbstractSmartHttpMessageConverter.canRead(org.springframework.core.ResolvableType type, MediaType mediaType) booleanbooleanbooleanIndicates whether the given type can be read by this converter.booleanIndicates whether the given class can be read by this converter.booleanbooleanbooleandefault booleanbooleanSmartHttpMessageConverter.canRead(org.springframework.core.ResolvableType type, MediaType mediaType) Indicates whether the given type can be read by this converter.booleanbooleanprotected booleanReturnstrueif the given media type includes any of the supported media types.booleanAbstractKotlinSerializationHttpMessageConverter.canWrite(org.springframework.core.ResolvableType type, Class<?> clazz, MediaType mediaType) booleanAbstractSmartHttpMessageConverter.canWrite(org.springframework.core.ResolvableType type, Class<?> clazz, MediaType mediaType) booleanbooleanbooleanIndicates whether the given class can be written by this converter.booleanIndicates whether the given class can be written by this converter.booleanbooleanbooleandefault booleanbooleanSmartHttpMessageConverter.canWrite(org.springframework.core.ResolvableType targetType, Class<?> valueClass, MediaType mediaType) Indicates whether the given class can be written by this converter.protected LongAbstractHttpMessageConverter.getContentLength(T t, MediaType contentType) Returns the content length for the given type.protected LongByteArrayHttpMessageConverter.getContentLength(byte[] bytes, MediaType contentType) protected LongObjectToStringHttpMessageConverter.getContentLength(Object obj, MediaType contentType) protected LongResourceHttpMessageConverter.getContentLength(org.springframework.core.io.Resource resource, MediaType contentType) protected LongStringHttpMessageConverter.getContentLength(String str, MediaType contentType) protected MediaTypeFormHttpMessageConverter.getFormContentType(MediaType contentType) Return the content type used to write forms, either the given content type or otherwiseapplication/x-www-form-urlencoded.voidBufferedImageHttpMessageConverter.setDefaultContentType(MediaType defaultContentType) Sets the defaultContent-Typeto be used for writing.final voidAbstractGenericHttpMessageConverter.write(T t, Type type, MediaType contentType, HttpOutputMessage outputMessage) This implementation sets the default headers by callingAbstractHttpMessageConverter.addDefaultHeaders(org.springframework.http.HttpHeaders, T, org.springframework.http.MediaType), and then callsAbstractGenericHttpMessageConverter.writeInternal(T, org.springframework.http.HttpOutputMessage).final voidAbstractHttpMessageConverter.write(T t, MediaType contentType, HttpOutputMessage outputMessage) This implementation sets the default headers by callingAbstractHttpMessageConverter.addDefaultHeaders(org.springframework.http.HttpHeaders, T, org.springframework.http.MediaType), and then callsAbstractHttpMessageConverter.writeInternal(T, org.springframework.http.HttpOutputMessage).final voidAbstractSmartHttpMessageConverter.write(T t, org.springframework.core.ResolvableType type, MediaType contentType, HttpOutputMessage outputMessage, Map<String, Object> hints) This implementation sets the default headers by callingAbstractHttpMessageConverter.addDefaultHeaders(org.springframework.http.HttpHeaders, T, org.springframework.http.MediaType), and then callsAbstractSmartHttpMessageConverter.writeInternal(T, org.springframework.http.HttpOutputMessage).voidBufferedImageHttpMessageConverter.write(BufferedImage image, MediaType contentType, HttpOutputMessage outputMessage) voidFormHttpMessageConverter.write(org.springframework.util.MultiValueMap<String, ?> map, MediaType contentType, HttpOutputMessage outputMessage) voidGenericHttpMessageConverter.write(T t, Type type, MediaType contentType, HttpOutputMessage outputMessage) Write a given object to the given output message.voidHttpMessageConverter.write(T t, MediaType contentType, HttpOutputMessage outputMessage) Write a given object to the given output message.voidSmartHttpMessageConverter.write(T t, org.springframework.core.ResolvableType type, MediaType contentType, HttpOutputMessage outputMessage, Map<String, Object> hints) Write a given object to the given output message.default voidSmartHttpMessageConverter.write(T t, MediaType contentType, HttpOutputMessage outputMessage) Method parameters in org.springframework.http.converter with type arguments of type MediaTypeModifier and TypeMethodDescriptionvoidAbstractHttpMessageConverter.setSupportedMediaTypes(List<MediaType> supportedMediaTypes) Set the list ofMediaTypeobjects supported by this converter.voidFormHttpMessageConverter.setSupportedMediaTypes(List<MediaType> supportedMediaTypes) Set the list ofMediaTypeobjects supported by this converter.Constructors in org.springframework.http.converter with parameters of type MediaTypeModifierConstructorDescriptionprotectedAbstractGenericHttpMessageConverter(Charset defaultCharset, MediaType... supportedMediaTypes) Construct anAbstractGenericHttpMessageConverterwith a default charset and multiple supported media types.protectedAbstractGenericHttpMessageConverter(MediaType supportedMediaType) Construct anAbstractGenericHttpMessageConverterwith one supported media type.protectedAbstractGenericHttpMessageConverter(MediaType... supportedMediaTypes) Construct anAbstractGenericHttpMessageConverterwith multiple supported media type.protectedAbstractHttpMessageConverter(Charset defaultCharset, MediaType... supportedMediaTypes) Construct anAbstractHttpMessageConverterwith a default charset and multiple supported media types.protectedAbstractHttpMessageConverter(MediaType supportedMediaType) Construct anAbstractHttpMessageConverterwith one supported media type.protectedAbstractHttpMessageConverter(MediaType... supportedMediaTypes) Construct anAbstractHttpMessageConverterwith multiple supported media types.protectedAbstractKotlinSerializationHttpMessageConverter(T format, MediaType... supportedMediaTypes) Construct anAbstractKotlinSerializationHttpMessageConverterwith multiple supported media type and format.protectedAbstractSmartHttpMessageConverter(MediaType supportedMediaType) Construct anAbstractSmartHttpMessageConverterwith one supported media type.protectedAbstractSmartHttpMessageConverter(MediaType... supportedMediaTypes) Construct anAbstractSmartHttpMessageConverterwith multiple supported media type.protectedKotlinSerializationBinaryHttpMessageConverter(T format, MediaType... supportedMediaTypes) Construct anKotlinSerializationBinaryHttpMessageConverterwith format and supported media types.protectedKotlinSerializationStringHttpMessageConverter(T format, MediaType... supportedMediaTypes) Construct anKotlinSerializationStringHttpMessageConverterwith format and supported media types. -
Uses of MediaType in org.springframework.http.converter.feed
Constructors in org.springframework.http.converter.feed with parameters of type MediaTypeModifierConstructorDescriptionprotectedAbstractWireFeedHttpMessageConverter(MediaType supportedMediaType) -
Uses of MediaType in org.springframework.http.converter.json
Methods in org.springframework.http.converter.json that return MediaTypeModifier and TypeMethodDescriptionprotected MediaTypeAbstractJackson2HttpMessageConverter.getDefaultContentType(Object object) Methods in org.springframework.http.converter.json that return types with arguments of type MediaTypeModifier and TypeMethodDescriptionAbstractJackson2HttpMessageConverter.getMediaTypesForProblemDetail()Return the supported media type(s) forProblemDetail.MappingJackson2HttpMessageConverter.getMediaTypesForProblemDetail()AbstractJackson2HttpMessageConverter.getObjectMappersForType(Class<?> clazz) Return ObjectMapper registrations for the given class, if any.AbstractJackson2HttpMessageConverter.getSupportedMediaTypes(Class<?> clazz) Methods in org.springframework.http.converter.json with parameters of type MediaTypeModifier and TypeMethodDescriptionbooleanbooleanbooleanprotected ObjectWriterAbstractJackson2HttpMessageConverter.customizeWriter(ObjectWriter writer, JavaType javaType, MediaType contentType) Subclasses can use this method to customizeObjectWriterused for writing values.protected CharsetAbstractJackson2HttpMessageConverter.getCharset(MediaType contentType) Determine the charset to use for JSON input.protected LongAbstractJackson2HttpMessageConverter.getContentLength(Object object, MediaType contentType) protected JsonEncodingAbstractJackson2HttpMessageConverter.getJsonEncoding(MediaType contentType) Determine the JSON encoding to use for the given content type.Method parameters in org.springframework.http.converter.json with type arguments of type MediaTypeModifier and TypeMethodDescriptionvoidAbstractJackson2HttpMessageConverter.registerObjectMappersForType(Class<?> clazz, Consumer<Map<MediaType, ObjectMapper>> registrar) Configure theObjectMapperinstances to use for the givenClass.voidAbstractJackson2HttpMessageConverter.setSupportedMediaTypes(List<MediaType> supportedMediaTypes) Constructors in org.springframework.http.converter.json with parameters of type MediaTypeModifierConstructorDescriptionprotectedAbstractJackson2HttpMessageConverter(ObjectMapper objectMapper, MediaType supportedMediaType) protectedAbstractJackson2HttpMessageConverter(ObjectMapper objectMapper, MediaType... supportedMediaTypes) -
Uses of MediaType in org.springframework.http.converter.protobuf
Fields in org.springframework.http.converter.protobuf declared as MediaTypeModifier and TypeFieldDescriptionstatic final MediaTypeProtobufHttpMessageConverter.PROTOBUFThe media-type for protobufapplication/x-protobuf.Methods in org.springframework.http.converter.protobuf that return MediaTypeModifier and TypeMethodDescriptionprotected MediaTypeProtobufHttpMessageConverter.getDefaultContentType(com.google.protobuf.Message message) Methods in org.springframework.http.converter.protobuf with parameters of type MediaType -
Uses of MediaType in org.springframework.http.converter.xml
Methods in org.springframework.http.converter.xml that return types with arguments of type MediaTypeModifier and TypeMethodDescriptionMappingJackson2XmlHttpMessageConverter.getMediaTypesForProblemDetail()Methods in org.springframework.http.converter.xml with parameters of type MediaTypeModifier and TypeMethodDescriptionbooleanAlways returnsfalsesince Jaxb2CollectionHttpMessageConverter required generic type information in order to read a Collection.booleanIndicates whether the given type can be read by this converter.booleanbooleanbooleanAlways returnsfalsesince Jaxb2CollectionHttpMessageConverter does not convert collections to XML.booleanAlways returnsfalsesince Jaxb2CollectionHttpMessageConverter does not convert collections to XML.booleanbooleanprotected LongSourceHttpMessageConverter.getContentLength(T t, MediaType contentType) voidJaxb2CollectionHttpMessageConverter.write(T t, Type type, MediaType contentType, HttpOutputMessage outputMessage) -
Uses of MediaType in org.springframework.web
Methods in org.springframework.web that return MediaTypeModifier and TypeMethodDescriptionHttpMediaTypeNotSupportedException.getContentType()Return the HTTP request content type method that caused the failure.Methods in org.springframework.web that return types with arguments of type MediaTypeModifier and TypeMethodDescriptionHttpMediaTypeException.getSupportedMediaTypes()Return the list of supported media types.Constructors in org.springframework.web with parameters of type MediaTypeModifierConstructorDescriptionHttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> mediaTypes) Create a new HttpMediaTypeNotSupportedException.HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> mediaTypes, HttpMethod httpMethod) Create a new HttpMediaTypeNotSupportedException.HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> supportedMediaTypes, HttpMethod httpMethod, String message) Create a new HttpMediaTypeNotSupportedException.Constructor parameters in org.springframework.web with type arguments of type MediaTypeModifierConstructorDescriptionprotectedHttpMediaTypeException(String message, List<MediaType> supportedMediaTypes) Deprecated.as of 6.0protectedHttpMediaTypeException(String message, List<MediaType> supportedMediaTypes, String messageDetailCode, Object[] messageDetailArguments) Create a new HttpMediaTypeException with a list of supported media types.HttpMediaTypeNotAcceptableException(List<MediaType> mediaTypes) Create a new HttpMediaTypeNotSupportedException.HttpMediaTypeNotSupportedException(String message, List<MediaType> mediaTypes) Create a new HttpMediaTypeNotSupportedException for a parse error.HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> mediaTypes) Create a new HttpMediaTypeNotSupportedException.HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> mediaTypes, HttpMethod httpMethod) Create a new HttpMediaTypeNotSupportedException.HttpMediaTypeNotSupportedException(MediaType contentType, List<MediaType> supportedMediaTypes, HttpMethod httpMethod, String message) Create a new HttpMediaTypeNotSupportedException. -
Uses of MediaType in org.springframework.web.accept
Fields in org.springframework.web.accept with type parameters of type MediaTypeModifier and TypeFieldDescriptionContentNegotiationStrategy.MEDIA_TYPE_ALL_LISTA singleton list withALLthat is returned fromContentNegotiationStrategy.resolveMediaTypes(org.springframework.web.context.request.NativeWebRequest)when no specific media types are requested.Methods in org.springframework.web.accept that return MediaTypeModifier and TypeMethodDescriptionPathExtensionContentNegotiationStrategy.getMediaTypeForResource(org.springframework.core.io.Resource resource) Deprecated.A public method exposing the knowledge of the path extension strategy to resolve file extensions to aMediaTypein this case for a givenResource.ServletPathExtensionContentNegotiationStrategy.getMediaTypeForResource(org.springframework.core.io.Resource resource) Deprecated.Extends the base classPathExtensionContentNegotiationStrategy.getMediaTypeForResource(org.springframework.core.io.Resource)with the ability to also look up through the ServletContext.protected MediaTypeAbstractMappingContentNegotiationStrategy.handleNoMatch(NativeWebRequest request, String key) Override to provide handling when a key is not resolved via.protected MediaTypeServletPathExtensionContentNegotiationStrategy.handleNoMatch(NativeWebRequest webRequest, String extension) Deprecated.Resolve file extension viaServletContext.getMimeType(String)and also delegate to base class for a potentialMediaTypeFactorylookup.protected MediaTypeMappingMediaTypeFileExtensionResolver.lookupMediaType(String extension) Use this method for a reverse lookup from extension to MediaType.Methods in org.springframework.web.accept that return types with arguments of type MediaTypeModifier and TypeMethodDescriptionMappingMediaTypeFileExtensionResolver.getAllMediaTypes()FixedContentNegotiationStrategy.getContentTypes()Return the configured list of media types.ContentNegotiationManager.getMediaTypeMappings()Return all registered lookup key to media type mappings by iteratingMediaTypeFileExtensionResolvers.MappingMediaTypeFileExtensionResolver.getMediaTypes()AbstractMappingContentNegotiationStrategy.resolveMediaTypeKey(NativeWebRequest webRequest, String key) An alternative toAbstractMappingContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest)that accepts an already extracted key.AbstractMappingContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest webRequest) ContentNegotiationManager.resolveMediaTypes(NativeWebRequest request) ContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest webRequest) Resolve the given request to a list of media types.FixedContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest request) HeaderContentNegotiationStrategy.resolveMediaTypes(NativeWebRequest request) Resolve the given request to a list of media types.Methods in org.springframework.web.accept with parameters of type MediaTypeModifier and TypeMethodDescriptionprotected voidMappingMediaTypeFileExtensionResolver.addMapping(String extension, MediaType mediaType) Map an extension to a MediaType.voidContentNegotiationManagerFactoryBean.addMediaType(String key, MediaType mediaType) An alternative toContentNegotiationManagerFactoryBean.setMediaTypes(java.util.Properties)for programmatic registrations.protected voidAbstractMappingContentNegotiationStrategy.handleMatch(String key, MediaType mediaType) Override to provide handling when a key is successfully resolved viaMappingMediaTypeFileExtensionResolver.lookupMediaType(java.lang.String).ContentNegotiationManager.resolveFileExtensions(MediaType mediaType) MappingMediaTypeFileExtensionResolver.resolveFileExtensions(MediaType mediaType) MediaTypeFileExtensionResolver.resolveFileExtensions(MediaType mediaType) Resolve the given media type to a list of file extensions.voidContentNegotiationManagerFactoryBean.setDefaultContentType(MediaType contentType) Set the default content type to use when no content type is requested.Method parameters in org.springframework.web.accept with type arguments of type MediaTypeModifier and TypeMethodDescriptionvoidContentNegotiationManagerFactoryBean.addMediaTypes(Map<String, MediaType> mediaTypes) An alternative toContentNegotiationManagerFactoryBean.setMediaTypes(java.util.Properties)for programmatic registrations.voidContentNegotiationManagerFactoryBean.setDefaultContentTypes(List<MediaType> contentTypes) Set the default content types to use when no content type is requested.Constructors in org.springframework.web.accept with parameters of type MediaTypeModifierConstructorDescriptionFixedContentNegotiationStrategy(MediaType contentType) Constructor with a single defaultMediaType.Constructor parameters in org.springframework.web.accept with type arguments of type MediaTypeModifierConstructorDescriptionAbstractMappingContentNegotiationStrategy(Map<String, MediaType> mediaTypes) Create an instance with the given map of file extensions and media types.FixedContentNegotiationStrategy(List<MediaType> contentTypes) Constructor with an ordered List of defaultMediaType's to return for use in applications that support a variety of content types.MappingMediaTypeFileExtensionResolver(Map<String, MediaType> mediaTypes) Create an instance with the given map of file extensions and media types.ParameterContentNegotiationStrategy(Map<String, MediaType> mediaTypes) Create an instance with the given map of file extensions and media types.PathExtensionContentNegotiationStrategy(Map<String, MediaType> mediaTypes) Deprecated.Create an instance with the given map of file extensions and media types.ServletPathExtensionContentNegotiationStrategy(ServletContext servletContext, Map<String, MediaType> mediaTypes) Deprecated.Create an instance with the given extension-to-MediaType lookup. -
Uses of MediaType in org.springframework.web.client
Methods in org.springframework.web.client that return MediaTypeModifier and TypeMethodDescriptionprotected MediaTypeHttpMessageConverterExtractor.getContentType(ClientHttpResponse response) Determine the Content-Type of the response based on the "Content-Type" header or otherwise default toAPPLICATION_OCTET_STREAM.UnknownContentTypeException.getContentType()Return the content type of the response, or "application/octet-stream".Methods in org.springframework.web.client with parameters of type MediaTypeModifier and TypeMethodDescriptionSet the list of acceptable media types, as specified by theAcceptheader.RestClient.RequestBodySpec.contentType(MediaType contentType) Set the media type of the body, as specified by theContent-Typeheader.Constructors in org.springframework.web.client with parameters of type MediaTypeModifierConstructorDescriptionUnknownContentTypeException(Type targetType, MediaType contentType, int statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody) Construct a new instance of with the given response data.UnknownContentTypeException(Type targetType, MediaType contentType, HttpStatusCode statusCode, String statusText, HttpHeaders responseHeaders, byte[] responseBody) Construct a new instance of with the given response data. -
Uses of MediaType in org.springframework.web.method.annotation
Methods in org.springframework.web.method.annotation that return types with arguments of type MediaTypeModifier and TypeMethodDescriptionExceptionHandlerMappingInfo.getProducibleTypes()Return the producible media types by this handler.Methods in org.springframework.web.method.annotation with parameters of type MediaTypeModifier and TypeMethodDescriptionExceptionHandlerMethodResolver.resolveExceptionMapping(Throwable exception, MediaType mediaType) ExceptionHandlerMethodResolver.resolveExceptionMappingByExceptionType(Class<? extends Throwable> exceptionType, MediaType mediaType) Find aMethodto handle the given exception type and media type. -
Uses of MediaType in org.springframework.web.server
Methods in org.springframework.web.server that return MediaTypeModifier and TypeMethodDescriptionUnsupportedMediaTypeStatusException.getContentType()Return the request Content-Type header if it was parsed successfully, ornullotherwise.Methods in org.springframework.web.server that return types with arguments of type MediaTypeModifier and TypeMethodDescriptionNotAcceptableStatusException.getSupportedMediaTypes()Return the list of supported content types in cases when the Accept header is parsed but not supported, or an empty list otherwise.UnsupportedMediaTypeStatusException.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.Constructors in org.springframework.web.server with parameters of type MediaTypeModifierConstructorDescriptionUnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes) Constructor for when the Content-Type can be parsed but is not supported.UnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes, org.springframework.core.ResolvableType bodyType) Constructor for when trying to encode from or decode to a specific Java type.UnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes, org.springframework.core.ResolvableType bodyType, HttpMethod method) Constructor for when trying to encode from or decode to a specific Java type.UnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes, HttpMethod method) Constructor that provides the HTTP method.Constructor parameters in org.springframework.web.server with type arguments of type MediaTypeModifierConstructorDescriptionNotAcceptableStatusException(List<MediaType> mediaTypes) Constructor for when the requested Content-Type is not supported.UnsupportedMediaTypeStatusException(String reason, List<MediaType> supportedTypes) 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, org.springframework.core.ResolvableType bodyType) Constructor for when trying to encode from or decode to a specific Java type.UnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes, org.springframework.core.ResolvableType bodyType, HttpMethod method) Constructor for when trying to encode from or decode to a specific Java type.UnsupportedMediaTypeStatusException(MediaType contentType, List<MediaType> supportedTypes, HttpMethod method) Constructor that provides the HTTP method. -
Uses of MediaType in org.springframework.web.service.invoker
Methods in org.springframework.web.service.invoker that return MediaTypeModifier and TypeMethodDescriptionHttpRequestValues.Builder.getContentType()HttpRequestValues.Metadata.getContentType()Return the content type, if set already.Methods in org.springframework.web.service.invoker that return types with arguments of type MediaTypeModifier and TypeMethodDescriptionHttpRequestValues.Builder.getAcceptMediaTypes()HttpRequestValues.Metadata.getAcceptMediaTypes()Return the acceptable media types, if set already.Methods in org.springframework.web.service.invoker with parameters of type MediaTypeModifier and TypeMethodDescriptionHttpRequestValues.Builder.setContentType(MediaType contentType) Set the media type for the requestContent-Typeheader.ReactiveHttpRequestValues.Builder.setContentType(MediaType contentType) Method parameters in org.springframework.web.service.invoker with type arguments of type MediaTypeModifier and TypeMethodDescriptionSet the media types for the requestAcceptheader.
APPLICATION_GRAPHQL_RESPONSE