org.apache.tapestry.util
Class ContentType
java.lang.Object
|
+--org.apache.tapestry.util.ContentType
- public class ContentType
- extends Object
Represents an HTTP content type. Allows to set various elements like
the mime type, the character set, and other parameters.
This is similar to a number of other implementations of the same concept in JAF, etc.
We have created this simple implementation to avoid including the whole libraries.
- Since:
- 3.0
- Version:
- $Id: ContentType.java,v 1.2 2003/07/01 18:49:49 mindbridge Exp $
- Author:
- mindbridge
Constructor Summary |
ContentType()
Creates a new empty content type |
ContentType(String contentType)
Creates a new content type from the argument. |
ContentType
public ContentType()
- Creates a new empty content type
ContentType
public ContentType(String contentType)
- Creates a new content type from the argument.
The format of the argument has to be basetype/subtype(;key=value)*
- Parameters:
contentType
- the content type that needs to be represented
getBaseType
public String getBaseType()
- Returns:
-
setBaseType
public void setBaseType(String baseType)
- Parameters:
string
-
getSubType
public String getSubType()
- Returns:
-
setSubType
public void setSubType(String subType)
- Parameters:
string
-
getMimeType
public String getMimeType()
- Returns:
- the MIME type of the content type
getParameterNames
public String[] getParameterNames()
- Returns:
- the list of names of parameters in this content type
getParameter
public String getParameter(String key)
- Parameters:
key
- the name of the content type parameter- Returns:
- the value of the content type parameter
setParameter
public void setParameter(String key,
String value)
- Parameters:
key
- the name of the content type parametervalue
- the value of the content type parameter
parse
public void parse(String contentType)
- Parses the argument and configures the content type accordingly.
The format of the argument has to be type/subtype(;key=value)*
- Parameters:
contentType
- the content type that needs to be represented
unparse
public String unparse()
- Returns:
- the string representation of this content type
toString
public String toString()
- Overrides:
toString
in class Object
- Returns:
- the string representation of this content type. Same as unparse().