org.jboss.portal.common.net.media
Class MediaType

java.lang.Object
  extended by org.jboss.portal.common.net.media.MediaType

public final class MediaType
extends java.lang.Object

An immutable media type class.

Version:
$Revision: 630 $
Author:
Julien Viet

Field Summary
static MediaType APPLICATION_X_WWW_FORM_URLENCODED
          .
static MediaType MULTIPART_FORM_DATA_MEDIA_TYPE
          .
static MediaType TEXT_CSS
          .
static MediaType TEXT_HTML
          .
static MediaType TEXT_JAVASCRIPT
          .
 
Method Summary
static MediaType create(java.lang.String mediaTypeName)
          Create a media type object by parsing a media type name.
static MediaType create(java.lang.String typeName, java.lang.String subtypeName)
          Create a media type object by using the provided type name and subtype name.
static MediaType create(TypeDef type, SubtypeDef subtype)
          Create a media type object using the provided type and subtype objects.
 boolean equals(java.lang.Object obj)
           
 SubtypeDef getSubtype()
           
 TypeDef getType()
           
 java.lang.String getValue()
          Returns the value which is a concatenation ofthe type name, a slash char and the subtype name.
 int hashCode()
           
 java.lang.String toString()
           
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

TEXT_HTML

public static final MediaType TEXT_HTML
.


TEXT_JAVASCRIPT

public static final MediaType TEXT_JAVASCRIPT
.


TEXT_CSS

public static final MediaType TEXT_CSS
.


APPLICATION_X_WWW_FORM_URLENCODED

public static final MediaType APPLICATION_X_WWW_FORM_URLENCODED
.


MULTIPART_FORM_DATA_MEDIA_TYPE

public static final MediaType MULTIPART_FORM_DATA_MEDIA_TYPE
.

Method Detail

create

public static MediaType create(java.lang.String mediaTypeName)
                        throws java.lang.IllegalArgumentException
Create a media type object by parsing a media type name. The media type name format is defined by the section 5.1 of the RFC2045 but is limited to a subset of the grammar, the starting production rule being: media-type: type "/" subtype

Parameters:
mediaTypeName - the media type name value
Returns:
the media type object
Throws:
java.lang.IllegalArgumentException - if the argument is null or is not valid

create

public static MediaType create(java.lang.String typeName,
                               java.lang.String subtypeName)
                        throws java.lang.IllegalArgumentException
Create a media type object by using the provided type name and subtype name.

Parameters:
typeName - the type name
subtypeName - the subtype name
Returns:
the media type object
Throws:
java.lang.IllegalArgumentException - if any argument is null or not valid

create

public static MediaType create(TypeDef type,
                               SubtypeDef subtype)
                        throws java.lang.IllegalArgumentException
Create a media type object using the provided type and subtype objects.

Parameters:
type - the type
subtype - the subtype
Returns:
the media type object
Throws:
java.lang.IllegalArgumentException - if any argument is null

getType

public TypeDef getType()

getSubtype

public SubtypeDef getSubtype()

getValue

public java.lang.String getValue()
Returns the value which is a concatenation ofthe type name, a slash char and the subtype name.

Returns:
the value

hashCode

public int hashCode()
Overrides:
hashCode in class java.lang.Object

equals

public boolean equals(java.lang.Object obj)
Overrides:
equals in class java.lang.Object

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object


Copyright © 2008. All Rights Reserved.