Apache CXF API

org.apache.cxf.transport.websocket
Class WebSocketUtils

java.lang.Object
  extended by org.apache.cxf.transport.websocket.WebSocketUtils

public final class WebSocketUtils
extends Object


Method Summary
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[] 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 Map<String,String> readHeaders(InputStream in)
          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.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

readHeaders

public static Map<String,String> readHeaders(InputStream in)
                                      throws IOException
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 stream
Returns:
a map of name value pairs.
Throws:
IOException

readLine

public static String readLine(InputStream in)
                       throws IOException
Read a line terminated by '\n' optionally preceded by '\r' from the specified input stream.

Parameters:
in - the input stream
Returns:
Throws:
IOException

buildResponse

public 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.

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:

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:

Apache CXF API

Apache CXF