public class QContentType extends Object implements HeaderFieldElement, Qualified, Cloneable
The to string value is calculated when first accessed and cached subsequently. The value is
checked and set atomically. Concurrent access may cause different String objects to be cached and
returned but they will be equal. A happens before relationship is not established by calls to
toString()
.
Modifier and Type | Field and Description |
---|---|
static QContentType |
APP_RDF |
static QContentType |
APP_XHTML |
static QContentType |
TEXT_HTML |
Constructor and Description |
---|
QContentType(String type,
String subType,
Map<String,String> parameters,
double qualifier)
Constructor for qualified content types.
|
Modifier and Type | Method and Description |
---|---|
QContentType |
clone()
Deprecated.
There is not real value in cloning this object, the only mutable value is the.
cached toString value
|
boolean |
equals(Object object) |
double |
getQualifier() |
static List<QContentType> |
getRequestContentTypes(HttpServletRequest request)
Parser for HttpServletRequest to QContentType
|
int |
hashCode() |
boolean |
isAnySubType()
Test to see if the subtype is a wildcard.
|
boolean |
isAnyType()
Test to see if the type is a wildcard.
|
boolean |
sameType(QContentType qct)
Method that returns true if the two content types can be matched against one another.
|
String |
toString()
Returns a string representation of the object.
|
public static final QContentType TEXT_HTML
public static final QContentType APP_XHTML
public static final QContentType APP_RDF
public QContentType(String type, String subType, Map<String,String> parameters, double qualifier)
Creates an immutable object. The type and subtype may not be null. The value of the qualifier must be between 0.0 and 1.0.
type
- Type of the content typesubType
- Subtype of the content typeparameters
- Map of additional parametersqualifier
- The qualifier of the content typeIllegalArgumentException
- If type or subtype are null or if the qualifier is less than zero or greater than
onepublic static List<QContentType> getRequestContentTypes(HttpServletRequest request) throws UnParsableHeaderException
request
- The HTTP request to parseUnParsableHeaderException
public String toString()
The string representation of the object is constructed lazily, it may be initialised multiple times and may not be aware of other threads setting it. The objects returned will be equal regardless of the thread returning the value.
toString
in class Object
Object.toString()
public final double getQualifier()
getQualifier
in interface Qualified
public final boolean sameType(QContentType qct)
qct
- public final boolean isAnySubType()
public boolean isAnyType()
@Deprecated public QContentType clone()
clone
in class Object
Object.clone()
Copyright © 2016. All Rights Reserved.