com.hazelcast.ascii.rest
Class HttpCommand

java.lang.Object
  extended by com.hazelcast.ascii.AbstractTextCommand
      extended by com.hazelcast.ascii.rest.HttpCommand
All Implemented Interfaces:
TextCommand, SocketReadable, SocketWritable
Direct Known Subclasses:
HttpDeleteCommand, HttpGetCommand, HttpPostCommand

public abstract class HttpCommand
extends AbstractTextCommand


Field Summary
static byte[] CONTENT_LENGTH
           
static byte[] CONTENT_TYPE
           
static byte[] CONTENT_TYPE_BINARY
           
static byte[] CONTENT_TYPE_PLAIN_TEXT
           
static String HEADER_CHUNKED
           
static String HEADER_CONTENT_LENGTH
           
static String HEADER_CONTENT_TYPE
           
static String HEADER_EXPECT_100
           
static byte[] RES_100
           
static byte[] RES_200
           
static byte[] RES_204
           
static byte[] RES_400
           
static byte[] RES_403
           
static byte[] RES_404
           
static byte[] RES_500
           
static byte[] RES_503
           
protected  ByteBuffer response
           
protected  String uri
           
 
Fields inherited from class com.hazelcast.ascii.AbstractTextCommand
type
 
Constructor Summary
HttpCommand(TextCommandConstants.TextCommandType type, String uri)
           
 
Method Summary
 String getURI()
           
 void send200()
           
 void send204()
           
 void send400()
           
 void setResponse(byte[] value)
           
 void setResponse(byte[] contentType, byte[] value)
          HTTP/1.0 200 OK Date: Fri, 31 Dec 1999 23:59:59 GMT Content-TextCommandType: text/html Content-Length: 1354
 boolean shouldReply()
           
 String toString()
           
 boolean writeTo(ByteBuffer bb)
          Asks the SocketWritable to write its content to the destination ByteBuffer.
 
Methods inherited from class com.hazelcast.ascii.AbstractTextCommand
getRequestId, getSocketTextReader, getSocketTextWriter, getType, init, isUrgent
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface com.hazelcast.nio.SocketReadable
readFrom
 

Field Detail

HEADER_CONTENT_TYPE

public static final String HEADER_CONTENT_TYPE
See Also:
Constant Field Values

HEADER_CONTENT_LENGTH

public static final String HEADER_CONTENT_LENGTH
See Also:
Constant Field Values

HEADER_CHUNKED

public static final String HEADER_CHUNKED
See Also:
Constant Field Values

HEADER_EXPECT_100

public static final String HEADER_EXPECT_100
See Also:
Constant Field Values

RES_200

public static final byte[] RES_200

RES_400

public static final byte[] RES_400

RES_403

public static final byte[] RES_403

RES_404

public static final byte[] RES_404

RES_100

public static final byte[] RES_100

RES_204

public static final byte[] RES_204

RES_503

public static final byte[] RES_503

RES_500

public static final byte[] RES_500

CONTENT_TYPE

public static final byte[] CONTENT_TYPE

CONTENT_LENGTH

public static final byte[] CONTENT_LENGTH

CONTENT_TYPE_PLAIN_TEXT

public static final byte[] CONTENT_TYPE_PLAIN_TEXT

CONTENT_TYPE_BINARY

public static final byte[] CONTENT_TYPE_BINARY

uri

protected final String uri

response

protected ByteBuffer response
Constructor Detail

HttpCommand

public HttpCommand(TextCommandConstants.TextCommandType type,
                   String uri)
Method Detail

shouldReply

public boolean shouldReply()
Specified by:
shouldReply in interface TextCommand
Overrides:
shouldReply in class AbstractTextCommand

getURI

public String getURI()

send204

public void send204()

send400

public void send400()

setResponse

public void setResponse(byte[] value)

send200

public void send200()

setResponse

public void setResponse(byte[] contentType,
                        byte[] value)
HTTP/1.0 200 OK Date: Fri, 31 Dec 1999 23:59:59 GMT Content-TextCommandType: text/html Content-Length: 1354

Parameters:
contentType -
value -

writeTo

public boolean writeTo(ByteBuffer bb)
Description copied from interface: SocketWritable
Asks the SocketWritable to write its content to the destination ByteBuffer.

Parameters:
bb - the ByteBuffer to write to.
Returns:
todo: unclear what return value means.

toString

public String toString()
Overrides:
toString in class AbstractTextCommand


Copyright © 2015 Hazelcast, Inc.. All Rights Reserved.