com.meterware.httpunit.protocol
Class MessageBody

java.lang.Object
  extended by com.meterware.httpunit.protocol.MessageBody
Direct Known Subclasses:
MessageBodyWebRequest.InputStreamMessageBody

public abstract class MessageBody
extends java.lang.Object

An abstract class representing the body of a web request.


Constructor Summary
MessageBody(java.lang.String characterSet)
           
 
Method Summary
static MessageBody createPostMethodMessageBody(boolean mimeEncoded, java.lang.String characterSet)
          Creates a message body for a POST request, selecting an appropriate encoding.
 java.lang.String getCharacterSet()
          Returns the character set associated with this message body.
abstract  java.lang.String getContentType()
          Returns the content type of this message body.
abstract  void writeTo(java.io.OutputStream outputStream, ParameterCollection parameters)
          Transmits the body of this request as a sequence of bytes.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MessageBody

public MessageBody(java.lang.String characterSet)
Method Detail

createPostMethodMessageBody

public static MessageBody createPostMethodMessageBody(boolean mimeEncoded,
                                                      java.lang.String characterSet)
Creates a message body for a POST request, selecting an appropriate encoding.

Parameters:
mimeEncoded - if true, indicates that the request is using mime encoding.
characterSet - the character set of the request.
Returns:
an appropriate message body.

getCharacterSet

public java.lang.String getCharacterSet()
Returns the character set associated with this message body.


getContentType

public abstract java.lang.String getContentType()
Returns the content type of this message body. For text messages, this should include the character set.


writeTo

public abstract void writeTo(java.io.OutputStream outputStream,
                             ParameterCollection parameters)
                      throws java.io.IOException
Transmits the body of this request as a sequence of bytes.

Throws:
java.io.IOException


Copyright © 2011. All Rights Reserved.