org.idoox.transport
Class InputMessageWrapper

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

public class InputMessageWrapper
extends RawInputMessage

Input message wrapper. This class is useful for interceptor implementation which needs wrap another input message.

Component:
Core

Field Summary
 
Fields inherited from class org.idoox.transport.RawInputMessage
isInited
 
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
InputMessageWrapper(InputMessage message)
          Creates new input message wrapper.
 
Method Summary
 java.lang.String getContentType()
          Gets a content type from the wrapped message.
 long getDateHeader(java.lang.String name)
          Gets a date hader from the wrapped message.
 java.util.Set getHeaderNames()
          Gets hader names from the wrapped message.
 int getIntHeader(java.lang.String name)
          Gets a int header from the wrapped message.
 java.lang.String getMultipartType()
          Gets a multipart type from the wrapped message.
 int getStatusCode()
          Gets a status code from the wrapped message.
 java.lang.String getStringHeader(java.lang.String name)
          Gets a string header from the wrapped message.
 InputMessage getWrappedMessage()
          Gets a wrapped input message.
 boolean nextPart()
          Gets a next part from the wrapped message.
 void setWrappedMessage(InputMessage message)
          Sets new wrapped input message.
 
Methods inherited from class org.idoox.transport.RawInputMessage
available, close, getWrappedStream, initStream, mark, markSupported, read, read, read, reset, setWrappedStream, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

InputMessageWrapper

public InputMessageWrapper(InputMessage message)
Creates new input message wrapper.

Parameters:
message - wrapped message
Method Detail

setWrappedMessage

public void setWrappedMessage(InputMessage message)
Sets new wrapped input message.

Parameters:
message - wrapped message

getWrappedMessage

public InputMessage getWrappedMessage()
Gets a wrapped input message.

Returns:
wrapped message

getStatusCode

public int getStatusCode()
                  throws java.io.IOException
Gets a status code from the wrapped message.

Specified by:
getStatusCode in class InputMessage
Returns:
the status code
Throws:
java.io.IOException - if an I/O error occurs

getHeaderNames

public java.util.Set getHeaderNames()
                             throws java.io.IOException
Gets hader names from the wrapped message.

Specified by:
getHeaderNames in class InputMessage
Returns:
the header names
Throws:
java.io.IOException - if an I/O error occurs

getContentType

public java.lang.String getContentType()
                                throws java.io.IOException
Gets a content type from the wrapped message.

Overrides:
getContentType in class InputMessage
Returns:
the MIME type
Throws:
java.io.IOException - if an I/O error occurs

getStringHeader

public java.lang.String getStringHeader(java.lang.String name)
                                 throws java.io.IOException
Gets a string header from the wrapped message.

Specified by:
getStringHeader in class InputMessage
Parameters:
name - the header name
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
Gets a int header from the wrapped message.

Overrides:
getIntHeader in class InputMessage
Parameters:
name - the header name
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
Gets a date hader from the wrapped message.

Overrides:
getDateHeader in class InputMessage
Parameters:
name - the name of the header
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 a multipart type from the wrapped message.

Overrides:
getMultipartType in class InputMessage
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
Gets a next part from the wrapped message.

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