Package org.glassfish.grizzly.http.util
Class HttpUtils
- java.lang.Object
-
- org.glassfish.grizzly.http.util.HttpUtils
-
public class HttpUtils extends Object
Utility class.- Author:
- Alexey Stashok
-
-
Constructor Summary
Constructors Constructor Description HttpUtils()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static StringcomposeContentType(String contentType, String characterEncoding)static floatconvertQValueToFloat(char[] chars, int startIdx, int stopIdx)static floatconvertQValueToFloat(String string, int startIdx, int stopIdx)static floatconvertQValueToFloat(org.glassfish.grizzly.Buffer buffer, int startIdx, int stopIdx)static floatconvertQValueToFloat(DataChunk dc, int startIdx, int stopIdx)static Stringfilter(String message)Filter the specified message string for characters that are sensitive in HTML.static DataChunkfilter(DataChunk message)Filter the specified message string for characters that are sensitive in HTML.static DataChunkfilterNonPrintableCharacters(DataChunk message)Filter non-printable ASCII characters.static intlongToBuffer(long value, byte[] buffer)Converts the specified long as a string representation to the provided byte buffer.static voidlongToBuffer(long value, org.glassfish.grizzly.Buffer buffer)Converts the specified long as a string representation to the provided buffer.
-
-
-
Method Detail
-
composeContentType
public static String composeContentType(String contentType, String characterEncoding)
-
convertQValueToFloat
public static float convertQValueToFloat(DataChunk dc, int startIdx, int stopIdx)
-
convertQValueToFloat
public static float convertQValueToFloat(org.glassfish.grizzly.Buffer buffer, int startIdx, int stopIdx)
-
convertQValueToFloat
public static float convertQValueToFloat(String string, int startIdx, int stopIdx)
-
convertQValueToFloat
public static float convertQValueToFloat(char[] chars, int startIdx, int stopIdx)
-
longToBuffer
public static int longToBuffer(long value, byte[] buffer)Converts the specified long as a string representation to the provided byte buffer. This code is based offLong.toString()- Parameters:
value- the long to convert.buffer- the buffer to write the conversion result to.
-
longToBuffer
public static void longToBuffer(long value, org.glassfish.grizzly.Buffer buffer)Converts the specified long as a string representation to the provided buffer. This code is based offLong.toString()- Parameters:
value- the long to convert.buffer- the buffer to write the conversion result to.
-
filterNonPrintableCharacters
public static DataChunk filterNonPrintableCharacters(DataChunk message)
Filter non-printable ASCII characters.- Parameters:
message-
-
filter
public static DataChunk filter(DataChunk message)
Filter the specified message string for characters that are sensitive in HTML. This avoids potential attacks caused by including JavaScript codes in the request URL that is often reported in error messages.- Parameters:
message- The message string to be filtered
-
filter
public static String filter(String message)
Filter the specified message string for characters that are sensitive in HTML. This avoids potential attacks caused by including JavaScript codes in the request URL that is often reported in error messages.- Parameters:
message- The message string to be filtered
-
-