org.apache.synapse.transport.passthru

## Class TargetRequest

- java.lang.Object
- - org.apache.synapse.transport.passthru.TargetRequest

-     public class TargetRequest
      extends java.lang.Object

  This is a class for representing a request to be sent to a target.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `TargetRequest(TargetConfiguration targetConfiguration, org.apache.http.conn.routing.HttpRoute route, java.lang.String method, java.net.URL url, boolean hasEntityBody)`
    `TargetRequest(TargetConfiguration targetConfiguration, org.apache.http.conn.routing.HttpRoute route, java.net.URL url, java.lang.String method, boolean hasEntityBody)` Create a target request.

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `addHeader(java.lang.String name, java.lang.String value)`
    `void` | `connect(Pipe pipe)`
    `java.nio.ByteBuffer` | `copyAndWrite(org.apache.http.nio.NHttpClientConnection conn, org.apache.http.nio.ContentEncoder encoder)` Same as `write(org.apache.http.nio.NHttpClientConnection, org.apache.http.nio.ContentEncoder)` but gives out the data consumed from the pipe.
    `java.util.Map<java.lang.String,java.util.LinkedHashSet<java.lang.String>>` | `getHeaders()`
    `java.lang.String` | `getMethod()`
    `Pipe` | `getPipe()`
    `org.apache.http.HttpRequest` | `getRequest()`
    `org.apache.http.conn.routing.HttpRoute` | `getRoute()`
    `java.net.URL` | `getUrl()`
    `boolean` | `hasEntityBody()`
    `void` | `setChunk(boolean chunk)`
    `void` | `setFullUrl(boolean fullUrl)`
    `void` | `setHasEntityBody(boolean hasEntityBody)`
    `void` | `setKeepAlive(boolean keepAlive)`
    `void` | `setPort(int port)`
    `void` | `setVersion(org.apache.http.ProtocolVersion version)`
    `void` | `start(org.apache.http.nio.NHttpClientConnection conn)`
    `int` | `write(org.apache.http.nio.NHttpClientConnection conn, org.apache.http.nio.ContentEncoder encoder)` Consume the data from the pipe and write it to the wire.

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### TargetRequest

          public TargetRequest(TargetConfiguration targetConfiguration,
                               org.apache.http.conn.routing.HttpRoute route,
                               java.net.URL url,
                               java.lang.String method,
                               boolean hasEntityBody)

      Create a target request.
      Parameters:
        `targetConfiguration` - the configuration of the sender
        `url` - the url to be used
        `method` - the HTTP method
        `hasEntityBody` - weather request has an entity body

    - #### TargetRequest

          public TargetRequest(TargetConfiguration targetConfiguration,
                               org.apache.http.conn.routing.HttpRoute route,
                               java.lang.String method,
                               java.net.URL url,
                               boolean hasEntityBody)

  - ### Method Detail

    - #### connect

          public void connect(Pipe pipe)

    - #### start

          public void start(org.apache.http.nio.NHttpClientConnection conn)
                     throws java.io.IOException,
                            org.apache.http.HttpException

      Throws:
        `java.io.IOException`
        `org.apache.http.HttpException`

    - #### write

          public int write(org.apache.http.nio.NHttpClientConnection conn,
                           org.apache.http.nio.ContentEncoder encoder)
                    throws java.io.IOException

      Consume the data from the pipe and write it to the wire.
      Parameters:
        `conn` - the connection to the target
        `encoder` - encoder for writing the message through
      Returns:
        number of bytes written
      Throws:
        `java.io.IOException` - if an error occurs

    - #### copyAndWrite

          public java.nio.ByteBuffer copyAndWrite(org.apache.http.nio.NHttpClientConnection conn,
                                                  org.apache.http.nio.ContentEncoder encoder)
                                           throws java.io.IOException

      Same as `write(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 target
        `encoder` - encoder for writing the message through
      Returns:
        data consumed
      Throws:
        `java.io.IOException` - if an error occurs

    - #### hasEntityBody

          public boolean hasEntityBody()

    - #### getUrl

          public java.net.URL getUrl()

    - #### setHasEntityBody

          public void setHasEntityBody(boolean hasEntityBody)

    - #### getHeaders

          public java.util.Map<java.lang.String,java.util.LinkedHashSet<java.lang.String>> getHeaders()

    - #### addHeader

          public void addHeader(java.lang.String name,
                                java.lang.String value)

    - #### getMethod

          public java.lang.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()

Copyright © 2005-2022 Apache Software Foundation. All Rights Reserved.