|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--org.apache.tools.ant.ProjectComponent | +--org.apache.tools.ant.Task | +--org.apache.anteater.test.BaseTask | +--org.apache.anteater.test.ActionTask | +--org.apache.anteater.test.HttpRequest
Defines an HTTP request.
Field Summary | |
protected String |
contentURL
The URL from which we retrieve contents to send with the request, eg a SOAP body. |
Fields inherited from class org.apache.anteater.test.ActionTask |
haltonerror, logger, matcherSet, reqFeatures, result, session, successProp, successVal |
Fields inherited from class org.apache.anteater.test.BaseTask |
debug, debugWasSet |
Fields inherited from class org.apache.tools.ant.Task |
description, location, target, taskName, taskType, wrapper |
Fields inherited from class org.apache.tools.ant.ProjectComponent |
project |
Constructor Summary | |
HttpRequest()
|
Method Summary | |
void |
addConfiguredContentEquals(ContentEquals ce)
Specify the HTTP body to post. |
void |
addConfiguredHeader(Header rh)
Add a header to the request |
void |
addConfiguredMethod(Method m)
Add a parameter to the request |
void |
addConfiguredParameter(Parameter rp)
Add a parameter to the request |
protected Object |
createMatchObject()
Create and return a HttpMessage containing the server's response,
which the caller will then let the tester tasks loose on. |
String |
getId()
Return a String identification of this HTTP action suitable for reporting. |
String |
getURL()
Return the URL associated with this task (that it implements or tests). |
void |
setContent(String href)
Assumes the value of the content attribute is an href whose content is to be POSTed. |
void |
setFollowRedirects(Boolean yn)
Whether to follow HTTP 302 redirects or not. |
void |
setHeaders(String s)
Add headers - string representation, will be parsed The value is a "|" separated list of headers to expect. |
void |
setHost(String h)
Server that will receive the request |
void |
setHref(String href)
Set the full URL to test. |
void |
setMethod(String method)
Set HTTP method, eg GET or POST . |
void |
setPassword(String password)
|
void |
setPath(String path)
Set the 'path' in the HTTP request (part after the host and port). |
void |
setPort(int port)
|
void |
setProtocol(String protocol)
Set HTTP protocol, typically HTTP/1.0 or
HTTP/1.1 . |
void |
setTimeout(String time)
Set the HTTP request's socket timeout. |
void |
setUser(String user)
|
void |
setUseTidy(Boolean yn)
Set whether to clean up the HTTP response body before applying tests. |
Methods inherited from class org.apache.anteater.test.ActionTask |
addConfiguredLogger, addConfiguredSession, addConfiguredUses, addMatch, addNamespace, execute, getObjectModel, getProperties, getProperty, getPropertyAsInt, getResult, setAssign, setDebug, setHaltonerror, setValue |
Methods inherited from class org.apache.anteater.test.BaseTask |
debug, getDebug, getGroup, print, println, resolveContentURL, setGroup, setGroup |
Methods inherited from class org.apache.tools.ant.Task |
getDescription, getLocation, getOwningTarget, getRuntimeConfigurableWrapper, getTaskName, handleErrorOutput, handleOutput, init, isInvalid, log, log, maybeConfigure, perform, setDescription, setLocation, setOwningTarget, setRuntimeConfigurableWrapper, setTaskName |
Methods inherited from class org.apache.tools.ant.ProjectComponent |
getProject, setProject |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected String contentURL
createMatchObject()
, not in setContent(java.lang.String)
,
in order to catch and report errors.
Constructor Detail |
public HttpRequest()
Method Detail |
public void setHost(String h)
public void setMethod(String method)
GET
or POST
.
public void setProtocol(String protocol)
HTTP/1.0
or
HTTP/1.1
.
public void setPath(String path)
public void setPort(int port)
public void setUser(String user)
public void setPassword(String password)
public void setTimeout(String time)
1000ms
, 10s
, 1.5m
. If a prefix
(ms
=milliseconds, s
=seconds,
m
=minutes) is not specified, milliseconds will be assumed.
public void setHref(String href)
href
- URL to test, eg http://whatever/blah?foo=bar
.
The query string (foo=bar
) part provides an alternative to
nested <parameter>
elements.public void setUseTidy(Boolean yn)
public void setFollowRedirects(Boolean yn)
public void setHeaders(String s)
public void setContent(String href)
public void addConfiguredHeader(Header rh)
public void addConfiguredParameter(Parameter rp)
public void addConfiguredMethod(Method m)
public void addConfiguredContentEquals(ContentEquals ce)
public String getId()
ActionTask
getId
in class ActionTask
public String getURL()
ActionTask
getURL
in class ActionTask
protected Object createMatchObject() throws Exception
HttpMessage
containing the server's response,
which the caller will then let the tester tasks loose on.
createMatchObject
in class ActionTask
org.apache.tools.ant.BuildException
- some failure related to the Ant interface (eg a required property not set)
Exception
- if the HTTP operation fails.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |