jrun.servlet
Class AcceptCharset

java.lang.Object
  |
  +--jrun.servlet.AcceptCharset

public class AcceptCharset
extends java.lang.Object

The AcceptCharset class parses the "Accept-Charset" request header and returns a list of charsets preferred by the client.

Author:
Clement Wong

Constructor Summary
AcceptCharset(java.util.Enumeration headers)
          Constructs an AcceptCharset object from an Enumeration.
AcceptCharset(java.lang.String header)
          Constructs a AcceptCharset object from a comma-separated string.
AcceptCharset(java.lang.String[] headers)
          Constructs an AcceptCharset object from a string array.
 
Method Summary
 boolean exists()
           
 java.util.Enumeration getCharsets()
          Returns an enumeration of charsets in the preferred order.
 java.lang.String getFirstCharset()
           
 java.lang.String getFirstCharsetExclude(java.lang.String exclude)
           
 double getSpecialRangeValue()
          Returns the q-value if "*;q=" is present.
 boolean isSpecialRangePresent()
          Returns true if * is present in the header.
static void main(java.lang.String[] args)
          Main method.
 void reset(java.util.Enumeration headers)
          Resets this object with a new header.
 void reset(java.lang.String header)
          Resets this object with a new header.
 void reset(java.lang.String[] headers)
          Resets this object with a new header.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AcceptCharset

public AcceptCharset(java.lang.String header)
Constructs a AcceptCharset object from a comma-separated string.
Parameters:
header - a comma-separated string.

AcceptCharset

public AcceptCharset(java.lang.String[] headers)
Constructs an AcceptCharset object from a string array.
Parameters:
headers - a string array.

AcceptCharset

public AcceptCharset(java.util.Enumeration headers)
Constructs an AcceptCharset object from an Enumeration.
Method Detail

reset

public void reset(java.lang.String header)
Resets this object with a new header.
Parameters:
a - comma-separated string.

reset

public void reset(java.lang.String[] headers)
Resets this object with a new header.
Parameters:
a - string array.

reset

public void reset(java.util.Enumeration headers)
Resets this object with a new header.
Parameters:
an - enumeration.

isSpecialRangePresent

public boolean isSpecialRangePresent()
Returns true if * is present in the header.
Returns:
true if * is present, otherwise false.

getSpecialRangeValue

public double getSpecialRangeValue()
Returns the q-value if "*;q=" is present.
Returns:
q-value (quality factor)

getCharsets

public java.util.Enumeration getCharsets()
Returns an enumeration of charsets in the preferred order.

exists

public boolean exists()

getFirstCharset

public java.lang.String getFirstCharset()

getFirstCharsetExclude

public java.lang.String getFirstCharsetExclude(java.lang.String exclude)

main

public static void main(java.lang.String[] args)
Main method. It's used to test the class from command-line.


Copyright � 2002 Macromedia Corporation. All Rights Reserved.