webfunds.sox
Class RequestPacket

java.lang.Object
  |
  +--webfunds.sox.Encodable
        |
        +--webfunds.sox.RequestPacket

public class RequestPacket
extends Encodable

This class, RequestPacket, encapsulates Request objects, giving them a header etc., so that the payload can be identified. It is in this form that the requests are usually transmitted over networks.

See Also:
Serialized Form

Field Summary
protected  Request body
          The request body
static java.lang.String CHANGE_KEY
           
static java.lang.String DEPOSIT
           
protected  byte[] encoded
          The body in encoded form
static java.lang.String MAIL
           
static java.lang.String REGISTER
          The request codes (any non-SOX messages must not use the SOX prefix, but should instead use the java namespace convention of using the domains name (dropping the "com." part if desired), e.g.
static java.lang.String TIMESYNC
           
protected  java.lang.String type
          The request type - this defines what the request is
static int VERSION
           
 
Constructor Summary
RequestPacket(byte[] data)
           
RequestPacket(Request body)
           
 
Method Summary
 Request body()
           
 void decode(byte[] data)
           
 byte[] encode()
           
 java.lang.String toString()
           
 
Methods inherited from class webfunds.sox.Encodable
decode, encode, main, readByteArray, readCertificate, readProperties, readString, writeByteArray, writeCertificate, writeProperties, writeString
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

VERSION

public static final int VERSION

REGISTER

public static final java.lang.String REGISTER
The request codes (any non-SOX messages must not use the SOX prefix, but should instead use the java namespace convention of using the domains name (dropping the "com." part if desired), e.g. "Com.Hotlava.Reset" or "Systemics.Init" This is to avoid clashes when mixing messages.

TIMESYNC

public static final java.lang.String TIMESYNC

CHANGE_KEY

public static final java.lang.String CHANGE_KEY

DEPOSIT

public static final java.lang.String DEPOSIT

MAIL

public static final java.lang.String MAIL

type

protected java.lang.String type
The request type - this defines what the request is

body

protected Request body
The request body

encoded

protected transient byte[] encoded
The body in encoded form
Constructor Detail

RequestPacket

public RequestPacket(Request body)

RequestPacket

public RequestPacket(byte[] data)
              throws SOXPacketException,
                     UnknownRequestException
Method Detail

body

public Request body()

encode

public byte[] encode()
Overrides:
encode in class Encodable

decode

public void decode(byte[] data)
            throws SOXPacketException
Overrides:
decode in class Encodable
Tags copied from class: Encodable
Throws:
java.io.IOException - can be thrown if the data is longer than necessary. In situations where the data should be read from a larger chunk, it may be more convenient to create a ByteArrayInputStream from the data and use decode(InputStream).

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object