Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## org.apache.tapestry5
Class ContentType

    java.lang.Object
      org.apache.tapestry5.ContentType

    public final class ContentType

extends java.lang.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.

Constructor Summary
`ContentType()` Creates a new empty content type.
`ContentType(java.lang.String contentType)` Creates a new content type from the argument.
`ContentType(java.lang.String contentType, java.lang.String charset)` Creates a new content type with the given MIME type and charset

Method Summary
`boolean` | `equals(java.lang.Object o)` Returns true only if the other object is another instance of ContentType, and has the ssame baseType, subType and set of parameters.
`java.lang.String` | `getBaseType()`
`java.lang.String` | `getCharset()`
`java.lang.String` | `getMimeType()`
`java.lang.String` | `getParameter(java.lang.String key)`
`java.util.List<java.lang.String>` | `getParameterNames()`
`java.lang.String` | `getSubType()`
`void` | `parse(java.lang.String contentType)` Parses the argument and configures the content type accordingly.
`void` | `setBaseType(java.lang.String baseType)`
`void` | `setParameter(java.lang.String key, java.lang.String value)`
`void` | `setSubType(java.lang.String subType)`
`java.lang.String` | `toString()`
`java.lang.String` | `unparse()`

Methods inherited from class java.lang.Object
`clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

Constructor Detail

### ContentType

    public ContentType()

  Creates a new empty content type.

### ContentType

    public ContentType(java.lang.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

### ContentType

    public ContentType(java.lang.String contentType,
                       java.lang.String charset)

  Creates a new content type with the given MIME type and charset

Method Detail

### equals

    public boolean equals(java.lang.Object o)

  Returns true only if the other object is another instance of ContentType, and has the ssame baseType, subType and set of parameters.

  Overrides:
    `equals` in class `java.lang.Object`

### getBaseType

    public java.lang.String getBaseType()

  Returns:
    the base type of the content type

### setBaseType

    public void setBaseType(java.lang.String baseType)

  Parameters:
    `baseType` -

### getSubType

    public java.lang.String getSubType()

  Returns:
    the sub-type of the content type

### setSubType

    public void setSubType(java.lang.String subType)

  Parameters:
    `subType` -

### getMimeType

    public java.lang.String getMimeType()

  Returns:
    the MIME type of the content type

### getParameterNames

    public java.util.List<java.lang.String> getParameterNames()

  Returns:
    the list of names of parameters in this content type, in alphabetical order.

### getCharset

    public java.lang.String getCharset()

  Returns:
    the character set (the "charset" parameter) or null.

### getParameter

    public java.lang.String getParameter(java.lang.String key)

  Parameters:
    `key` - the name of the content type parameter
  Returns:
    the value of the content type parameter

### setParameter

    public void setParameter(java.lang.String key,
                             java.lang.String value)

  Parameters:
    `key` - the name of the content type parameter
    `value` - the value of the content type parameter

### parse

    public void parse(java.lang.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 java.lang.String unparse()

  Returns:
    the string representation of this content type

### toString

    public java.lang.String toString()

  Overrides:
    `toString` in class `java.lang.Object`
  Returns:
    the string representation of this content type. Same as unparse().

Overview | Package | Class | Use | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright © 2003-2012 The Apache Software Foundation.