public class MetadataService extends Service
addCommonExtensions()
method.Constructor and Description |
---|
MetadataService()
Constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
addCommonExtensions()
Adds a common list of associations from extensions to metadata.
|
void |
addExtension(java.lang.String extension,
Metadata metadata)
Maps an extension to some metadata (media type, language or character
set) to an extension.
|
void |
addExtension(java.lang.String extension,
Metadata metadata,
boolean preferred)
Maps an extension to some metadata (media type, language or character
set) to an extension.
|
void |
clearExtensions()
clears the mappings for all extensions.
|
java.util.List<java.lang.String> |
getAllCharacterSetExtensionNames()
Return the ordered list of extension names mapped to character set.
|
java.util.List<CharacterSet> |
getAllCharacterSets(java.lang.String extension)
Returns all the character sets associated to this extension.
|
java.util.List<java.lang.String> |
getAllEncodingExtensionNames()
Return the ordered list of extension names mapped to encodings.
|
java.util.List<java.lang.String> |
getAllExtensionNames()
Return the ordered list of extension names.
|
java.util.List<java.lang.String> |
getAllLanguageExtensionNames()
Return the ordered list of extension names mapped to languages.
|
java.util.List<Language> |
getAllLanguages(java.lang.String extension)
Returns all the languages associated to this extension.
|
java.util.List<java.lang.String> |
getAllMediaTypeExtensionNames()
Return the ordered list of extension names mapped to media types.
|
java.util.List<MediaType> |
getAllMediaTypes(java.lang.String extension)
Returns all the media types associated to this extension.
|
java.util.List<Metadata> |
getAllMetadata(java.lang.String extension)
Returns all the metadata associated to this extension.
|
CharacterSet |
getCharacterSet(java.lang.String extension)
Returns the character set associated to this extension.
|
CharacterSet |
getDefaultCharacterSet()
Returns the default character set for textual representations.
|
Encoding |
getDefaultEncoding()
Returns the default encoding for representations.
|
Language |
getDefaultLanguage()
Returns the default language for representations.
|
MediaType |
getDefaultMediaType()
Returns the default media type for representations.
|
Encoding |
getEncoding(java.lang.String extension)
Returns the encoding associated to this extension.
|
java.lang.String |
getExtension(Metadata metadata)
Returns the first extension mapping to this metadata.
|
Language |
getLanguage(java.lang.String extension)
Returns the language associated to this extension.
|
MediaType |
getMediaType(java.lang.String extension)
Returns the mediatype associated to this extension.
|
Metadata |
getMetadata(java.lang.String extension)
Returns the metadata associated to this extension.
|
void |
setDefaultCharacterSet(CharacterSet defaultCharacterSet)
Sets the default character set for local representations.
|
void |
setDefaultEncoding(Encoding defaultEncoding)
Sets the default encoding for local representations.
|
void |
setDefaultLanguage(Language defaultLanguage)
Sets the default language for local representations.
|
void |
setDefaultMediaType(MediaType defaultMediaType)
Sets the default media type for local representations.
|
getContext, isEnabled, isStarted, isStopped, setContext, setEnabled, start, stop
public MetadataService()
Language.ENGLISH_US
,
the default encoding to Encoding.IDENTITY
(no encoding) and the
default media type to MediaType#APPLICATION_OCTET_STREAM
. It also
calls the addCommonExtensions()
method.public void addCommonExtensions()
public void addExtension(java.lang.String extension, Metadata metadata)
extension
- The extension name.metadata
- The metadata to map.public void addExtension(java.lang.String extension, Metadata metadata, boolean preferred)
extension
- The extension name.metadata
- The metadata to map.preferred
- indicates if this mapping is the preferred one.public void clearExtensions()
public java.util.List<java.lang.String> getAllCharacterSetExtensionNames()
public java.util.List<CharacterSet> getAllCharacterSets(java.lang.String extension)
extension
- The extension name without any delimiter.public java.util.List<java.lang.String> getAllEncodingExtensionNames()
public java.util.List<java.lang.String> getAllExtensionNames()
public java.util.List<java.lang.String> getAllLanguageExtensionNames()
public java.util.List<Language> getAllLanguages(java.lang.String extension)
extension
- The extension name without any delimiter.public java.util.List<java.lang.String> getAllMediaTypeExtensionNames()
public java.util.List<MediaType> getAllMediaTypes(java.lang.String extension)
extension
- The extension name without any delimiter.public java.util.List<Metadata> getAllMetadata(java.lang.String extension)
extension
- The extension name without any delimiter.public CharacterSet getCharacterSet(java.lang.String extension)
extension
- The extension name without any delimiter.public CharacterSet getDefaultCharacterSet()
public Encoding getDefaultEncoding()
public Language getDefaultLanguage()
public MediaType getDefaultMediaType()
public Encoding getEncoding(java.lang.String extension)
extension
- The extension name without any delimiter.public java.lang.String getExtension(Metadata metadata)
metadata
- The metadata to find.public Language getLanguage(java.lang.String extension)
extension
- The extension name without any delimiter.public MediaType getMediaType(java.lang.String extension)
extension
- The extension name without any delimiter.public Metadata getMetadata(java.lang.String extension)
extension
- The extension name without any delimiter.public void setDefaultCharacterSet(CharacterSet defaultCharacterSet)
defaultCharacterSet
- The default character set for local representations.public void setDefaultEncoding(Encoding defaultEncoding)
defaultEncoding
- The default encoding for local representations.public void setDefaultLanguage(Language defaultLanguage)
defaultLanguage
- The default language for local representations.public void setDefaultMediaType(MediaType defaultMediaType)
defaultMediaType
- The default media type for local representations.Copyright © 2005-2024 Restlet.