|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.apache.mina.proxy.utils.StringUtilities
public class StringUtilities
StringUtilities.java - Various methods to handle strings.
Constructor Summary | |
---|---|
StringUtilities()
|
Method Summary | |
---|---|
static void |
addValueToHeader(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers,
java.lang.String key,
java.lang.String value,
boolean singleValued)
Adds an header to the provided map of headers. |
static java.lang.String |
copyDirective(java.util.HashMap<java.lang.String,java.lang.String> src,
java.util.HashMap<java.lang.String,java.lang.String> dst,
java.lang.String directive)
Copy the directive from the source map to the destination map, if it's value isn't null. |
static void |
copyDirective(java.util.HashMap<java.lang.String,java.lang.String> directives,
java.lang.StringBuilder sb,
java.lang.String directive)
Copy the directive to the StringBuilder if not null. |
static java.lang.String |
getDirectiveValue(java.util.HashMap<java.lang.String,java.lang.String> directivesMap,
java.lang.String directive,
boolean mandatory)
A directive is a parameter of the digest authentication process. |
static java.lang.String |
getSingleValuedHeader(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers,
java.lang.String key)
Returns the value of the named header. |
static boolean |
isLws(byte b)
Is character a linear white space ? LWS = [CRLF] 1*( SP | HT ) Note that we're checking individual bytes instead of CRLF |
static java.util.HashMap<java.lang.String,java.lang.String> |
parseDirectives(byte[] buf)
Parses digest-challenge string, extracting each token and value(s). |
static java.lang.String |
stringTo8859_1(java.lang.String str)
Used to convert username-value, passwd or realm to 8859_1 encoding if all chars in string are within the 8859_1 (Latin 1) encoding range. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public StringUtilities()
Method Detail |
---|
public static java.lang.String getDirectiveValue(java.util.HashMap<java.lang.String,java.lang.String> directivesMap, java.lang.String directive, boolean mandatory) throws javax.security.sasl.AuthenticationException
AuthenticationException
.
directivesMap
- the directive's mapdirective
- the name of the directive we want to retrievemandatory
- is the directive mandatory
javax.security.sasl.AuthenticationException
- if mandatory is true and if
directivesMap.get(directive) == nullpublic static void copyDirective(java.util.HashMap<java.lang.String,java.lang.String> directives, java.lang.StringBuilder sb, java.lang.String directive)
StringBuilder
if not null.
(A directive is a parameter of the digest authentication process.)
directives
- the directives mapsb
- the output bufferdirective
- the directive name to look forpublic static java.lang.String copyDirective(java.util.HashMap<java.lang.String,java.lang.String> src, java.util.HashMap<java.lang.String,java.lang.String> dst, java.lang.String directive)
src
- the source mapdst
- the destination mapdirective
- the directive name
public static java.util.HashMap<java.lang.String,java.lang.String> parseDirectives(byte[] buf) throws javax.security.sasl.SaslException
buf
- A non-null digest-challenge string.
java.io.UnsupportedEncodingException
javax.security.sasl.SaslException
- if the String cannot be parsed according to RFC 2831public static boolean isLws(byte b)
b
- the byte to check
true
if it's a linear white spacepublic static java.lang.String stringTo8859_1(java.lang.String str) throws java.io.UnsupportedEncodingException
str
- a non-null String
javax.security.sasl.AuthenticationException
java.io.UnsupportedEncodingException
public static java.lang.String getSingleValuedHeader(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, java.lang.String key)
IllegalArgumentException
is thrown
headers
- the http headers mapkey
- the key of the header
public static void addValueToHeader(java.util.Map<java.lang.String,java.util.List<java.lang.String>> headers, java.lang.String key, java.lang.String value, boolean singleValued)
headers
- the http headers mapkey
- the name of the new header to addvalue
- the value of the added headersingleValued
- if true and the map already contains one value
then it is replaced by the new value. Otherwise it simply adds a new
value to this multi-valued header.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |