public interface ContentType extends TopLevelTypeAccessor, MediaTypeAccessor, org.refcodes.collection.Properties.PropertiesBuilder, HttpMediaType
ContentType
represents a MediaType
and its according
TopLevelType
with additional (optional) suffixed parameters (as of
the according HTTP header fields). In other words, it is a concrete
occurrence of a MediaType
in an HTTP header including the particular
parameters. A ContentType
with the particular parameters may look as
follows: "application/json;charset=UTF-8" in case of
MediaType.APPLICATION_JSON
and the parameter'
MediaTypeParameter.CHARSET
name set to the Encoding.UTF_8
code.TopLevelTypeAccessor.TopLevelTypeBuilder<B extends TopLevelTypeAccessor.TopLevelTypeBuilder<B>>, TopLevelTypeAccessor.TopLevelTypeMutator, TopLevelTypeAccessor.TopLevelTypeProperty
MediaTypeAccessor.MediaTypeBuilder<B extends MediaTypeAccessor.MediaTypeBuilder<B>>, MediaTypeAccessor.MediaTypeMutator, MediaTypeAccessor.MediaTypeProperty
org.refcodes.collection.Properties.ClearableProperties, org.refcodes.collection.Properties.MutableProperties, org.refcodes.collection.Properties.PropertiesBuilder
org.refcodes.collection.Dictionary.MutableDictionary.DictionaryBuilder<K,V,T extends org.refcodes.structure.Relation<K,V>,B extends org.refcodes.collection.Dictionary.MutableDictionary.DictionaryBuilder<K,V,T,B>>
Modifier and Type | Method and Description |
---|---|
default String |
getCharsetParametrer()
Retrieves the charset parameter from the properties of this
ContentType instance. |
default TopLevelType |
getTopLevelType()
Retrieves the Media-Top-Level-Type from the Media-Top-Level-Type
property.
|
default String |
put(MediaTypeParameter aParameter,
String aValue) |
default String |
putCharsetParametrer(String aCharsetCode)
Sets the charset parameter's charset-code.
|
default String |
toHttpMediaType()
Returns the HTTP media type: It consists of the Media-Top-Level-Type (
getTopLevelType() and the Media-Subtype (
MediaTypeAccessor.getMediaType() ) as well as some (optional) suffixed parameters
(as of Keys.keySet() and #get(String) , mutable via
#put(String, String) ) all being concatenated in an HTTP valid
manner, such as: "application/json;charset=UTF-8". |
default ContentType |
withCharsetParametrer(String aValue)
Sets the charset parameter's charset-code.
|
default ContentType |
withPut(MediaTypeParameter aParameter,
String aValue) |
default ContentType |
withPut(org.refcodes.structure.Property aProperty) |
default ContentType |
withPut(String aKey,
String aValue) |
getMediaType
default TopLevelType getTopLevelType()
TopLevelTypeAccessor
getTopLevelType
in interface TopLevelTypeAccessor
default ContentType withPut(String aKey, String aValue)
default ContentType withPut(org.refcodes.structure.Property aProperty)
default String put(MediaTypeParameter aParameter, String aValue)
default ContentType withPut(MediaTypeParameter aParameter, String aValue)
default String getCharsetParametrer()
ContentType
instance.default String putCharsetParametrer(String aCharsetCode)
aCharsetCode
- The code of the charset to be set (e.g. "UTF-8"), see
Encoding
for some common codes.default ContentType withCharsetParametrer(String aValue)
aCharsetCode
- The code of the charset to be set (e.g. "UTF-8"), see
Encoding
for some common codes.ContentType
instance as of the builder pattern.default String toHttpMediaType()
getTopLevelType()
and the Media-Subtype (
MediaTypeAccessor.getMediaType()
) as well as some (optional) suffixed parameters
(as of Keys.keySet()
and #get(String)
, mutable via
#put(String, String)
) all being concatenated in an HTTP valid
manner, such as: "application/json;charset=UTF-8".toHttpMediaType
in interface HttpMediaType
toHttpMediaType
in interface HttpMediaTypeAccessor.HttpMediaTypeProvider<RuntimeException>
Copyright © 2016. All rights reserved.