public final class WebSocketUtils extends Object
Modifier and Type | Field and Description |
---|---|
static String |
FLUSHED_KEY |
static String |
METHOD_KEY |
static String |
SC_KEY |
static String |
URI_KEY |
Modifier and Type | Method and Description |
---|---|
static byte[] |
buildHeaderLine(String name,
String value) |
static byte[] |
buildRequest(String method,
String url,
Map<String,String> headers,
byte[] data,
int offset,
int length)
Build request bytes with the specified method, url, headers, and content entity.
|
static byte[] |
buildResponse(byte[] headers,
byte[] data,
int offset,
int length)
Build response bytes with some generated headers.
|
static byte[] |
buildResponse(byte[] data,
int offset,
int length)
Build response bytes without status and type information.
|
static byte[] |
buildResponse(Map<String,String> headers,
byte[] data,
int offset,
int length)
Build response bytes with the status and type information specified in the headers.
|
static boolean |
isContainingCRLF(String value) |
static byte[] |
readBody(InputStream in) |
static Map<String,String> |
readHeaders(InputStream in) |
static Map<String,String> |
readHeaders(InputStream in,
boolean req)
Read header properties from the specified input stream.
|
static String |
readLine(InputStream in)
Read a line terminated by '\n' optionally preceded by '\r' from the
specified input stream.
|
public static final String URI_KEY
public static final String METHOD_KEY
public static final String SC_KEY
public static final String FLUSHED_KEY
public static Map<String,String> readHeaders(InputStream in, boolean req) throws IOException
in
- the input streamreq
- true if the input stream includes the request lineIOException
public static Map<String,String> readHeaders(InputStream in) throws IOException
IOException
public static String readLine(InputStream in) throws IOException
in
- the input streamIOException
public static byte[] readBody(InputStream in) throws IOException
IOException
public static byte[] buildResponse(Map<String,String> headers, byte[] data, int offset, int length)
headers
- data
- offset
- length
- public static byte[] buildResponse(byte[] headers, byte[] data, int offset, int length)
headers
- data
- offset
- length
- public static byte[] buildResponse(byte[] data, int offset, int length)
data
- offset
- length
- public static byte[] buildRequest(String method, String url, Map<String,String> headers, byte[] data, int offset, int length)
method
- url
- headers
- data
- offset
- length
- public static boolean isContainingCRLF(String value)
Apache CXF