Package com.meterware.httpunit
Class MessageBodyWebRequest
- java.lang.Object
-
- com.meterware.httpunit.WebRequest
-
- com.meterware.httpunit.MessageBodyWebRequest
-
- Direct Known Subclasses:
PostMethodWebRequest
,PutMethodWebRequest
public abstract class MessageBodyWebRequest extends WebRequest
A web request which contains a non-empty message body. Note that such requests must use thehttp
orhttps
protocols.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
MessageBodyWebRequest.InputStreamMessageBody
A method request message body read directly from an input stream.
-
Field Summary
Fields Modifier and Type Field Description protected com.meterware.httpunit.protocol.MessageBody
_body
-
Fields inherited from class com.meterware.httpunit.WebRequest
method
-
-
Constructor Summary
Constructors Modifier Constructor Description protected
MessageBodyWebRequest(WebForm sourceForm)
Constructs a web request for a form submitted via script.protected
MessageBodyWebRequest(WebForm sourceForm, com.meterware.httpunit.ParameterHolder parameterHolder, SubmitButton button, int x, int y)
Constructs a web request for a form submitted via a button.protected
MessageBodyWebRequest(java.lang.String urlString, boolean mimeEncoded)
Constructs a web request using a specific absolute url string.protected
MessageBodyWebRequest(java.lang.String urlString, com.meterware.httpunit.protocol.MessageBody messageBody)
Constructs a web request using a specific absolute url string.protected
MessageBodyWebRequest(java.net.URL urlBase, java.lang.String urlString, java.lang.String target, boolean mimeEncoded)
Constructs a web request with a specific target.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected void
completeRequest(java.net.URLConnection connection)
Performs any additional processing necessary to complete the request.protected java.lang.String
getContentType()
Returns the content type of this request.protected com.meterware.httpunit.protocol.MessageBody
getMessageBody()
Subclasses may override this method to provide a message body for the request.boolean
isMimeEncoded()
Returns true if this request is to be MIME-encoded.protected void
writeMessageBody(java.io.OutputStream stream)
Writes the contents of the message body to the specified stream.-
Methods inherited from class com.meterware.httpunit.WebRequest
getCharacterSet, getHeaders, getMethod, getParameter, getParameterHolder, getParameterValues, getQueryString, getRequestParameterNames, getTarget, getURL, getURLBase, getURLString, isFileParameter, maySelectFile, removeParameter, selectFile, selectFile, selectFile, setHeaderField, setImageButtonClickPosition, setParameter, setParameter, setParameter, toString
-
-
-
-
Constructor Detail
-
MessageBodyWebRequest
protected MessageBodyWebRequest(java.lang.String urlString, boolean mimeEncoded)
Constructs a web request using a specific absolute url string.
-
MessageBodyWebRequest
protected MessageBodyWebRequest(java.lang.String urlString, com.meterware.httpunit.protocol.MessageBody messageBody)
Constructs a web request using a specific absolute url string.
-
MessageBodyWebRequest
protected MessageBodyWebRequest(java.net.URL urlBase, java.lang.String urlString, java.lang.String target, boolean mimeEncoded)
Constructs a web request with a specific target.
-
MessageBodyWebRequest
protected MessageBodyWebRequest(WebForm sourceForm, com.meterware.httpunit.ParameterHolder parameterHolder, SubmitButton button, int x, int y)
Constructs a web request for a form submitted via a button.- Since:
- 1.6
-
MessageBodyWebRequest
protected MessageBodyWebRequest(WebForm sourceForm)
Constructs a web request for a form submitted via script.
-
-
Method Detail
-
getMessageBody
protected com.meterware.httpunit.protocol.MessageBody getMessageBody()
Subclasses may override this method to provide a message body for the request.
-
writeMessageBody
protected void writeMessageBody(java.io.OutputStream stream) throws java.io.IOException
Description copied from class:WebRequest
Writes the contents of the message body to the specified stream.- Overrides:
writeMessageBody
in classWebRequest
- Throws:
java.io.IOException
-
completeRequest
protected void completeRequest(java.net.URLConnection connection) throws java.io.IOException
Performs any additional processing necessary to complete the request.- Overrides:
completeRequest
in classWebRequest
- Throws:
java.io.IOException
-
getContentType
protected java.lang.String getContentType()
Description copied from class:WebRequest
Returns the content type of this request. If null, no content is specified.- Overrides:
getContentType
in classWebRequest
-
isMimeEncoded
public boolean isMimeEncoded()
Description copied from class:WebRequest
Returns true if this request is to be MIME-encoded.- Overrides:
isMimeEncoded
in classWebRequest
-
-