Class TargetRequest
- java.lang.Object
-
- org.apache.synapse.transport.passthru.TargetRequest
-
public class TargetRequest extends Object
This is a class for representing a request to be sent to a target.
-
-
Constructor Summary
Constructors Constructor Description TargetRequest(TargetConfiguration targetConfiguration, org.apache.http.conn.routing.HttpRoute route, String method, URL url, boolean hasEntityBody)TargetRequest(TargetConfiguration targetConfiguration, org.apache.http.conn.routing.HttpRoute route, URL url, String method, boolean hasEntityBody)Create a target request.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddHeader(String name, String value)voidconnect(Pipe pipe)ByteBuffercopyAndWrite(org.apache.http.nio.NHttpClientConnection conn, org.apache.http.nio.ContentEncoder encoder)Same aswrite(org.apache.http.nio.NHttpClientConnection, org.apache.http.nio.ContentEncoder)but gives out the data consumed from the pipe.Map<String,LinkedHashSet<String>>getHeaders()StringgetMethod()PipegetPipe()org.apache.http.HttpRequestgetRequest()org.apache.http.conn.routing.HttpRoutegetRoute()URLgetUrl()booleanhasEntityBody()voidsetChunk(boolean chunk)voidsetFullUrl(boolean fullUrl)voidsetHasEntityBody(boolean hasEntityBody)voidsetKeepAlive(boolean keepAlive)voidsetPort(int port)voidsetVersion(org.apache.http.ProtocolVersion version)voidstart(org.apache.http.nio.NHttpClientConnection conn)intwrite(org.apache.http.nio.NHttpClientConnection conn, org.apache.http.nio.ContentEncoder encoder)Consume the data from the pipe and write it to the wire.
-
-
-
Constructor Detail
-
TargetRequest
public TargetRequest(TargetConfiguration targetConfiguration, org.apache.http.conn.routing.HttpRoute route, URL url, String method, boolean hasEntityBody)
Create a target request.- Parameters:
targetConfiguration- the configuration of the senderurl- the url to be usedmethod- the HTTP methodhasEntityBody- weather request has an entity body
-
TargetRequest
public TargetRequest(TargetConfiguration targetConfiguration, org.apache.http.conn.routing.HttpRoute route, String method, URL url, boolean hasEntityBody)
-
-
Method Detail
-
connect
public void connect(Pipe pipe)
-
start
public void start(org.apache.http.nio.NHttpClientConnection conn) throws IOException, org.apache.http.HttpException- Throws:
IOExceptionorg.apache.http.HttpException
-
write
public int write(org.apache.http.nio.NHttpClientConnection conn, org.apache.http.nio.ContentEncoder encoder) throws IOExceptionConsume the data from the pipe and write it to the wire.- Parameters:
conn- the connection to the targetencoder- encoder for writing the message through- Returns:
- number of bytes written
- Throws:
IOException- if an error occurs
-
copyAndWrite
public ByteBuffer copyAndWrite(org.apache.http.nio.NHttpClientConnection conn, org.apache.http.nio.ContentEncoder encoder) throws IOException
Same aswrite(org.apache.http.nio.NHttpClientConnection, org.apache.http.nio.ContentEncoder)but gives out the data consumed from the pipe.- Parameters:
conn- the connection to the targetencoder- encoder for writing the message through- Returns:
- data consumed
- Throws:
IOException- if an error occurs
-
hasEntityBody
public boolean hasEntityBody()
-
getUrl
public URL getUrl()
-
setHasEntityBody
public void setHasEntityBody(boolean hasEntityBody)
-
getHeaders
public Map<String,LinkedHashSet<String>> getHeaders()
-
getMethod
public String getMethod()
-
setChunk
public void setChunk(boolean chunk)
-
setPort
public void setPort(int port)
-
setFullUrl
public void setFullUrl(boolean fullUrl)
-
setVersion
public void setVersion(org.apache.http.ProtocolVersion version)
-
setKeepAlive
public void setKeepAlive(boolean keepAlive)
-
getRequest
public org.apache.http.HttpRequest getRequest()
-
getRoute
public org.apache.http.conn.routing.HttpRoute getRoute()
-
getPipe
public Pipe getPipe()
-
-