Class WebSocketUtils
java.lang.Object
org.apache.cxf.transport.websocket.WebSocketUtils
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic 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 booleanisContainingCRLF(String value) static byte[]readBody(InputStream in) readHeaders(InputStream in, boolean req) Read header properties from the specified input stream.static StringreadLine(InputStream in) Read a line terminated by '\n' optionally preceded by '\r' from the specified input stream.
-
Field Details
-
URI_KEY
- See Also:
-
METHOD_KEY
- See Also:
-
SC_KEY
- See Also:
-
FLUSHED_KEY
- See Also:
-
-
Method Details
-
readHeaders
Read header properties from the specified input stream. Only a restricted syntax is allowed as the syntax is in our control. Not allowed are: - multiline or line-wrapped headers are not not - charset other than utf-8. (although i would have preferred iso-8859-1 ;-)- Parameters:
in- the input streamreq- true if the input stream includes the request line- Returns:
- a map of name value pairs.
- Throws:
IOException
-
readHeaders
- Throws:
IOException
-
readLine
Read a line terminated by '\n' optionally preceded by '\r' from the specified input stream.- Parameters:
in- the input stream- Returns:
- Throws:
IOException
-
readBody
- Throws:
IOException
-
buildResponse
Build response bytes with the status and type information specified in the headers.- Parameters:
headers-data-offset-length-- Returns:
-
buildResponse
public static byte[] buildResponse(byte[] headers, byte[] data, int offset, int length) Build response bytes with some generated headers.- Parameters:
headers-data-offset-length-- Returns:
-
buildResponse
public static byte[] buildResponse(byte[] data, int offset, int length) Build response bytes without status and type information.- Parameters:
data-offset-length-- Returns:
-
buildHeaderLine
-
buildRequest
public 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.- Parameters:
method-url-headers-data-offset-length-- Returns:
-
isContainingCRLF
-