|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.melati.util.HttpHeader
org.melati.util.AcceptCharset
public class AcceptCharset
Representation of the Accept-Charset header fields.
Provides features for choosing a charset according to client or server preferences.
| Nested Class Summary | |
|---|---|
static class |
AcceptCharset.CharsetAndQValue
A charset and associated qvalue. |
class |
AcceptCharset.CharsetAndQValueIterator
Enumeration of AcceptCharset.CharsetAndQValue. |
protected static class |
AcceptCharset.Comparator
Comparator for comparing AcceptCharset.CharsetAndQValue objects. |
| Nested classes/interfaces inherited from class org.melati.util.HttpHeader |
|---|
HttpHeader.FieldIterator, HttpHeader.HttpHeaderException, HttpHeader.TokenAndQValue, HttpHeader.TokenAndQValueIterator, HttpHeader.Tokenizer, HttpHeader.WordIterator |
| Field Summary | |
|---|---|
protected java.util.HashMap |
supportedAcceptedOrPreferred
Charsets supported by the jvm and accepted by the client or preferred by the server. |
| Fields inherited from class org.melati.util.HttpHeader |
|---|
tokenizer |
| Constructor Summary | |
|---|---|
AcceptCharset(java.lang.String values,
java.util.List serverPreference)
Create an instance from the Accept-Charset header field values and a set of server preferred charset names. |
|
| Method Summary | |
|---|---|
AcceptCharset.CharsetAndQValueIterator |
charsetAndQValueIterator()
Factory method to create and return the next HttpHeader.TokenAndQValue. |
java.lang.String |
choice(AcceptCharset.Comparator comparator)
If there is none, return null, and the caller can either use an unacceptable character set or generate a 406 error. |
java.lang.String |
clientChoice()
|
HttpHeader.TokenAndQValue |
nextTokenAndQValue()
Factory method to create and return the next HttpHeader.TokenAndQValue. |
java.lang.String |
serverChoice()
|
| Methods inherited from class org.melati.util.HttpHeader |
|---|
tokenAndQValueIterator, wordIterator |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected java.util.HashMap supportedAcceptedOrPreferred
| Constructor Detail |
|---|
public AcceptCharset(java.lang.String values,
java.util.List serverPreference)
throws HttpHeader.HttpHeaderException
The field values might have appeared in a single Accept-Charset header or in several that were concatenated with comma separator in order. This concatenation is often done for the caller, by a servlet container or something, but it must be done.
null is taken to mean there were no Accept-Charset header
fields.
If a client supported charset is unsupported by the JVM it is ignored. If the caller wants to ensure that there are none then it must check for itself.
If the same charset is specified more than once (perhaps under different names or aliases) then the first occurrence is significant.
The server preferences provides a list of charsets used if there is a wildcard specification. This class does not currently try other available charsets so to avoid 406 errors to reasonable clients, enough reasonable charsets must be listed in serverPreferences.
HttpHeader.HttpHeaderException| Method Detail |
|---|
public HttpHeader.TokenAndQValue nextTokenAndQValue()
throws HttpHeader.HttpHeaderException
HttpHeader.TokenAndQValue.
nextTokenAndQValue in class HttpHeaderHttpHeader.HttpHeaderExceptionHttpHeader.nextTokenAndQValue()public AcceptCharset.CharsetAndQValueIterator charsetAndQValueIterator()
HttpHeader.TokenAndQValue.
public java.lang.String clientChoice()
public java.lang.String serverChoice()
public java.lang.String choice(AcceptCharset.Comparator comparator)
AcceptCharset.Comparator
|
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||