|
BrokenEvent nanotests | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.brokenevent.nanotests.http.TestPostRequest
public class TestPostRequest
POST request for http server tests.
| Field Summary | |
|---|---|
protected HttpClient |
client
|
protected static HttpHost |
host
|
protected static java.lang.String |
hostUrl
|
protected HttpRequest |
request
|
protected HttpResponse |
response
|
| Constructor Summary | |
|---|---|
TestPostRequest(java.lang.String resource)
Initializes instance of the POST request for the given resource. |
|
| Method Summary | |
|---|---|
void |
execute()
Executes the http request. |
java.lang.String |
getRequestUrl()
Gets the fully qualified request URL. |
HttpResponse |
getResponse()
Gets the http response object. |
java.lang.String |
getStringContent()
Helper method to get content of the response for the http request. |
void |
removeHeader(java.lang.String name)
Remove the header from the http request |
void |
setContent(byte[] data)
Sets the content for the POST request from byte array. |
void |
setContent(java.io.InputStream stream)
Set the content for the POST request from stream. |
void |
setHeader(java.lang.String name,
java.lang.String value)
Set the header for the http request. |
static void |
setHostUrl(java.lang.String hostUrl)
Sets the server URL for all the requests. |
void |
setUserAgent(java.lang.String value)
Sets the User-Agent http header field to the given value |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected HttpClient client
protected HttpRequest request
protected HttpResponse response
protected static java.lang.String hostUrl
protected static HttpHost host
| Constructor Detail |
|---|
public TestPostRequest(java.lang.String resource)
resource - resource name| Method Detail |
|---|
public void setContent(java.io.InputStream stream)
stream - content source streampublic void setContent(byte[] data)
data - content source arraypublic static void setHostUrl(java.lang.String hostUrl)
http://localhost
hostUrl - server URL
public void setHeader(java.lang.String name,
java.lang.String value)
name - name of the header to setvalue - value for the headerpublic void removeHeader(java.lang.String name)
name - name of the header to removepublic void setUserAgent(java.lang.String value)
value - User-Agent new valuepublic void execute()
public java.lang.String getRequestUrl()
getRequestUrl in interface TestRequestpublic HttpResponse getResponse()
getResponse in interface TestRequestpublic java.lang.String getStringContent()
|
BrokenEvent nanotests | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||