|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectjavax.ws.rs.core.MediaType
public class MediaType
An abstraction for a media type. Instances are immutable.
Field Summary | |
---|---|
static java.lang.String |
MEDIA_TYPE_WILDCARD
The value of a type or subtype wildcard. |
Constructor Summary | |
---|---|
MediaType()
Creates a new instance of MediaType, both type and subtype are wildcards. |
|
MediaType(java.lang.String type,
java.lang.String subtype)
Creates a new instance of MediaType with the supplied type and subtype. |
|
MediaType(java.lang.String type,
java.lang.String subtype,
java.util.Map<java.lang.String,java.lang.String> parameters)
Creates a new instance of MediaType with the supplied type, subtype and parameters. |
Method Summary | |
---|---|
boolean |
equals(java.lang.Object obj)
Compares obj to this media type to see if they are the same by comparing type and subtype only - parameters are ignored. |
java.util.Map<java.lang.String,java.lang.String> |
getParameters()
Getter for parameter map. |
java.lang.String |
getSubtype()
Getter for subtype. |
java.lang.String |
getType()
Getter for primary type. |
int |
hashCode()
Generate a hashcode from the type and subtype. |
boolean |
isCompatible(MediaType other)
Check if this media type is compatible with another media type. |
boolean |
isWildcardSubtype()
Checks if the subtype is a wildcard |
boolean |
isWildcardType()
Checks if the primary type is a wildcard. |
static MediaType |
parse(java.lang.String type)
Creates a new instance of MediaType by parsing the supplied string. |
java.lang.String |
toString()
Convert the media type to a string suitable for use as the value of a corresponding HTTP header. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
---|
public static final java.lang.String MEDIA_TYPE_WILDCARD
Constructor Detail |
---|
public MediaType(java.lang.String type, java.lang.String subtype, java.util.Map<java.lang.String,java.lang.String> parameters)
type
- the primary typesubtype
- the subtypeparameters
- a map of media type parameterspublic MediaType(java.lang.String type, java.lang.String subtype)
type
- the primary typesubtype
- the subtypepublic MediaType()
Method Detail |
---|
public static MediaType parse(java.lang.String type) throws java.lang.IllegalArgumentException
type
- the media type string
java.lang.IllegalArgumentException
- if the supplied string cannot be parsedpublic java.lang.String getType()
public boolean isWildcardType()
public java.lang.String getSubtype()
public boolean isWildcardSubtype()
public java.util.Map<java.lang.String,java.lang.String> getParameters()
public boolean isCompatible(MediaType other)
other
- the media type to compare with
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object
obj
- the object to compare to
public int hashCode()
hashCode
in class java.lang.Object
public java.lang.String toString()
toString
in class java.lang.Object
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |