public class JettyHttpClient
extends java.lang.Object
implements java.util.concurrent.Callable<java.lang.Integer>
This is a very simple wrapper around Jetty's HTTPClient. Only PUT and GET requests are supported. Basic Authentication is supported, and so are SSL connections.
<oddjob> <job> <sequential> <jobs> <properties> <values> <value key="some.url" value="http://www.google.com/search"/> </values> </properties> <web:client id="request" url="${some.url}" xmlns:web="oddjob:web"> <parameters> <map> <values> <value key="q" value="gold fish"/> </values> </map> </parameters> </web:client> <echo>${request.content}</echo> </jobs> </sequential> </job> </oddjob>
<oddjob id="oddjob"> <job> <web:client id="client" url="http://localhost:${server.port}" xmlns:web="oddjob:web"> <basicAuthentication> <is username="alice" password="secret"/> </basicAuthentication> </web:client> </job> </oddjob>
<oddjob> <job> <sequential> <jobs> <properties> <values> <value key="some.url" value="http://ipv4.download.thinkbroadband.com/1GB.zip"/> <value key="some.file" value="download.zip"/> </values> </properties> <web:client id="request" name="Download Example" url="${some.url}" xmlns:web="oddjob:web"> <output> <file file="${some.file}"/> </output> </web:client> </jobs> </sequential> </job> </oddjob>
Modifier and Type | Class and Description |
---|---|
static class |
JettyHttpClient.RequestMethod |
static class |
JettyHttpClient.UsernamePassword |
Modifier and Type | Field and Description |
---|---|
static int |
DEFAULT_TIMEOUT_SECONDS |
Constructor and Description |
---|
JettyHttpClient() |
Modifier and Type | Method and Description |
---|---|
java.lang.Integer |
call() |
JettyHttpClient.UsernamePassword |
getBasicAuthentication() |
java.lang.String |
getContent() |
long |
getContentLength() |
java.lang.String |
getContentType() |
long |
getDownloadCount() |
JettyHttpClient.RequestMethod |
getMethod() |
java.lang.String |
getName() |
java.io.OutputStream |
getOutput() |
java.util.Map<java.lang.String,java.lang.String> |
getParameters() |
Progress |
getProgress() |
java.lang.String |
getRequestBody() |
java.lang.String |
getResponseBody() |
ClientSslProvider |
getSsl() |
int |
getStatus() |
long |
getTimeout() |
java.lang.String |
getUrl() |
void |
setBasicAuthentication(JettyHttpClient.UsernamePassword basicAuthentication) |
void |
setContent(java.lang.String content) |
void |
setContentType(java.lang.String contentType) |
void |
setMethod(JettyHttpClient.RequestMethod method) |
void |
setName(java.lang.String name) |
void |
setOutput(java.io.OutputStream output) |
void |
setParameters(java.util.Map<java.lang.String,java.lang.String> properties) |
void |
setRequestBody(java.lang.String requestBody) |
void |
setSsl(ClientSslProvider ssl) |
void |
setTimeout(long timeout) |
void |
setUrl(java.lang.String url) |
java.lang.String |
toString() |
public static final int DEFAULT_TIMEOUT_SECONDS
public java.lang.Integer call() throws java.lang.Exception
call
in interface java.util.concurrent.Callable<java.lang.Integer>
java.lang.Exception
public java.lang.String getName()
public void setName(java.lang.String name)
public void setUrl(java.lang.String url)
public java.lang.String getUrl()
public int getStatus()
public java.lang.String getContent()
Property: content
Description: The request body to send or the response body received. This maps to
responseBody
as a convenience but is confusing
so should probably be deprecated.
Required: No.
public void setContent(java.lang.String content)
public java.lang.String getRequestBody()
public void setRequestBody(java.lang.String requestBody)
public java.lang.String getResponseBody()
public JettyHttpClient.RequestMethod getMethod()
public void setMethod(JettyHttpClient.RequestMethod method)
public java.util.Map<java.lang.String,java.lang.String> getParameters()
public void setParameters(java.util.Map<java.lang.String,java.lang.String> properties)
public java.lang.String getContentType()
public void setContentType(java.lang.String contentType)
public JettyHttpClient.UsernamePassword getBasicAuthentication()
public void setBasicAuthentication(JettyHttpClient.UsernamePassword basicAuthentication)
public ClientSslProvider getSsl()
public void setSsl(ClientSslProvider ssl)
public Progress getProgress()
public long getContentLength()
public long getDownloadCount()
public java.io.OutputStream getOutput()
public void setOutput(java.io.OutputStream output)
public long getTimeout()
public void setTimeout(long timeout)
public java.lang.String toString()
toString
in class java.lang.Object