|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectcom.sun.grizzly.util.http.HttpRequestURIDecoder
public class HttpRequestURIDecoder
Utility class that make sure an HTTP url defined inside a MessagesBytes
is normalized, converted and valid. It also makes sure there is no security
hole. Mainly, this class can be used by doing:
HttpRequestURIDecoder.decode(decodedURI, urlDecoder, encoding, b2cConverter);
| Field Summary | |
|---|---|
protected static boolean |
ALLOW_BACKSLASH
|
| Constructor Summary | |
|---|---|
HttpRequestURIDecoder()
|
|
| Method Summary | |
|---|---|
static boolean |
checkNormalize(MessageBytes uriMB)
Check that the URI is normalized following character decoding. |
protected void |
convertMB(MessageBytes mb)
Character conversion of the a US-ASCII MessageBytes. |
protected static void |
copyBytes(byte[] b,
int dest,
int src,
int len)
Copy an array of bytes to a different position. |
static void |
decode(MessageBytes decodedURI,
UDecoder urlDecoder)
Decode the http request represented by the bytes inside MessageBytes
using an UDecoder. |
static void |
decode(MessageBytes decodedURI,
UDecoder urlDecoder,
String encoding,
B2CConverter b2cConverter)
Decode the http request represented by the bytes inside MessageBytes
using an UDecoder, using the specified encoding, using the specified
[@link B2CConverter} to decode the request. |
protected void |
log(String message)
Log a message on the Logger associated with our Container (if any) |
protected void |
log(String message,
Throwable throwable)
Log a message on the Logger associated with our Container (if any) |
static boolean |
normalize(MessageBytes uriMB)
Normalize URI. |
static boolean |
normalizeBytes(MessageBytes mb)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static final boolean ALLOW_BACKSLASH
| Constructor Detail |
|---|
public HttpRequestURIDecoder()
| Method Detail |
|---|
public static final void decode(MessageBytes decodedURI,
UDecoder urlDecoder)
throws Exception
MessageBytes
using an UDecoder.
decodedURI - - The bytes to decodeurlDecoder - - The urlDecoder to use to decode.
Exception
public static final void decode(MessageBytes decodedURI,
UDecoder urlDecoder,
String encoding,
B2CConverter b2cConverter)
throws Exception
MessageBytes
using an UDecoder, using the specified encoding, using the specified
[@link B2CConverter} to decode the request.
decodedURI - - The bytes to decodeurlDecoder - - The urlDecoder to use to decode.encoding - the encoding value, default is utf-8.b2cConverter - the Bytes to Char Converter.
Exceptionpublic static boolean normalize(MessageBytes uriMB)
This method normalizes "\", "//", "/./" and "/../". This method will return false when trying to go above the root, or if the URI contains a null byte.
uriMB - URI to be normalizedpublic static boolean checkNormalize(MessageBytes uriMB)
This method checks for "\", 0, "//", "/./" and "/../". This method will return false if sequences that are supposed to be normalized are still present in the URI.
uriMB - URI to be checked (should be chars)
protected static void copyBytes(byte[] b,
int dest,
int src,
int len)
protected void log(String message)
message - Message to be logged
protected void log(String message,
Throwable throwable)
message - Message to be loggedthrowable - Associated exceptionprotected void convertMB(MessageBytes mb)
public static boolean normalizeBytes(MessageBytes mb)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||