org.idoox.transport
Class InputMessage

java.lang.Object
  extended byjava.io.InputStream
      extended byorg.idoox.transport.InputMessage
All Implemented Interfaces:
Message
Direct Known Subclasses:
RawInputMessage

public abstract class InputMessage
extends java.io.InputStream
implements Message

Input message with no multipart implementation.

Component:
Core

Field Summary
 
Fields inherited from interface org.idoox.transport.Message
CT_APPLICATION_DIME, CT_MULTIPART_ALTERNATIVE, CT_MULTIPART_MIXED, CT_MULTIPART_RELATED, CT_MUTLIPART_FORMDATA, SC_ACCEPTED, SC_BAD_MESSAGE, SC_CREATED, SC_FORBIDDEN, SC_INTERNAL_ERROR, SC_METHOD_NOT_ALLOWED, SC_NO_CONTENT, SC_NOT_FOUND, SC_OK, SC_PROTOCOL_NOT_SUPPORTED, SC_REQUEST_TIMEOUT, SC_SERVICE_UNAVAILABLE, SC_SOAP_ACTION_REQUIRED, SC_UNAUTHORIZED, SC_UNSUPPORTED_MEDIA_TYPE
 
Constructor Summary
InputMessage()
           
 
Method Summary
 java.lang.String getContentType()
          Returns the MIME type of the body of the message, or null if the type is not known.
 long getDateHeader(java.lang.String name)
          Returns the value of the specified message header as a longvalue.
abstract  java.util.Set getHeaderNames()
          Returns a set of header names.
 int getIntHeader(java.lang.String name)
          Returns the value of the specified message header as an int.
 java.lang.String getMultipartType()
          Gets multipart type.
abstract  int getStatusCode()
          Gets a status code.
abstract  java.lang.String getStringHeader(java.lang.String name)
          Returns a value of the specified message header as a string.
 boolean nextPart()
          Next part.
 
Methods inherited from class java.io.InputStream
available, close, mark, markSupported, read, read, read, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputMessage

public InputMessage()
Method Detail

getStatusCode

public abstract int getStatusCode()
                           throws java.io.IOException
Gets a status code. A status code greater or equal to 400 is an error. If the transport have no other choice the status code is transported like x-wasp-sc header.

Returns:
the status code
Throws:
java.io.IOException - if an I/O error occurs

getHeaderNames

public abstract java.util.Set getHeaderNames()
                                      throws java.io.IOException
Returns a set of header names.

Returns:
the header names
Throws:
java.io.IOException - if an I/O error occurs

getContentType

public java.lang.String getContentType()
                                throws java.io.IOException
Returns the MIME type of the body of the message, or null if the type is not known.

Returns:
the MIME type
Throws:
java.io.IOException - if an I/O error occurs

getStringHeader

public abstract java.lang.String getStringHeader(java.lang.String name)
                                          throws java.io.IOException
Returns a value of the specified message header as a string. If the message did not include a header of the specified name, this method returns null.

Parameters:
name - the header name (this is case insensitive string)
Returns:
the value of the message header, or null if the given header doesn't exist
Throws:
java.io.IOException - if an I/O error occurs

getIntHeader

public int getIntHeader(java.lang.String name)
                 throws java.io.IOException
Returns the value of the specified message header as an int. If the message does not have a header of the specified name, this method returns -1.

Parameters:
name - the header name (this is case insensitive string)
Returns:
the value of the message header, or -1 if the given header doesn't exist
Throws:
java.io.IOException - if an I/O error occurs

getDateHeader

public long getDateHeader(java.lang.String name)
                   throws java.io.IOException
Returns the value of the specified message header as a longvalue. This is a number of milliseconds since January 1, 1970 GMT. If the message does not have a header of the specified name, this method returns -1.

Parameters:
name - the name of the header (this is case insensitive string)
Returns:
the number of milliseconds since January 1, 1970 GMT, or -1 if the given header doesn't exist
Throws:
java.io.IOException - if an I/O error occurs

getMultipartType

public java.lang.String getMultipartType()
                                  throws java.io.IOException
Gets multipart type.

Returns:
mutlipart type or null if this message isn't multiparted
Throws:
java.io.IOException - if an I/O error occurs

nextPart

public boolean nextPart()
                 throws java.io.IOException
Next part. This method sets message headers to header fields of next part and moves message stream at the beginning of the next message part body.

Returns:
if there is the next part then true otherwise false
Throws:
java.io.IOException - if an I/O error occurs