org.apache.clerezza.triaxrs.util
Class AcceptCharset

java.lang.Object
  extended by org.apache.clerezza.triaxrs.util.AcceptCharset

public class AcceptCharset
extends Object

Represent HTTP Accept-Charset header.

This version of the API does not support construction.

See Also:
RFC 2616 14.4

Nested Class Summary
static class AcceptCharset.ValuedCharset
           
 
Constructor Summary
AcceptCharset(String acceptCharset, List<String> acceptableCharsets, List<String> bannedCharsets, boolean anyCharsetAllowed, List<AcceptCharset.ValuedCharset> valuedCharsets)
           
 
Method Summary
 List<String> getAcceptableCharsets()
          Provide a list of character sets which are acceptable for the client.
 String getAcceptCharsetHeader()
           
 List<String> getBannedCharsets()
          A list of non-acceptable (q-value 0) character sets, i.e.
 List<AcceptCharset.ValuedCharset> getValuedCharsets()
           
 boolean isAnyCharsetAllowed()
          Is any character set acceptable? Note that expressions are listed by getBannedCharsets().
 String toString()
           
static AcceptCharset valueOf(String value)
          Creates a new instance of AcceptCharset by parsing the supplied string.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AcceptCharset

public AcceptCharset(String acceptCharset,
                     List<String> acceptableCharsets,
                     List<String> bannedCharsets,
                     boolean anyCharsetAllowed,
                     List<AcceptCharset.ValuedCharset> valuedCharsets)
Method Detail

getAcceptableCharsets

public List<String> getAcceptableCharsets()
Provide a list of character sets which are acceptable for the client. If any charset is acceptable with some non-zero priority (see isAnyCharsetAllowed()), only character sets more preferable than wildcard are listed.

Returns:
unmodifiable list, never null; the list is sorted starting with the most preferable charset

isAnyCharsetAllowed

public boolean isAnyCharsetAllowed()
Is any character set acceptable? Note that expressions are listed by getBannedCharsets(). This means that the value contains wildcard (with non-zero priority) of the header is not present at all.

Returns:
true if any character set is acceptable

getBannedCharsets

public List<String> getBannedCharsets()
A list of non-acceptable (q-value 0) character sets, i.e. exception of isAnyCharsetAllowed().

Returns:
never null; always empty if wildcard is not included

valueOf

public static AcceptCharset valueOf(String value)
                             throws IllegalArgumentException
Creates a new instance of AcceptCharset by parsing the supplied string.

Parameters:
value - the Accept-Charset string
Returns:
the newly created AcceptCharset
Throws:
IllegalArgumentException - if the supplied string cannot be parsed

getAcceptCharsetHeader

public String getAcceptCharsetHeader()

getValuedCharsets

public List<AcceptCharset.ValuedCharset> getValuedCharsets()

toString

public String toString()
Overrides:
toString in class Object


Copyright © 2012 The Apache Software Foundation. All Rights Reserved.