org.apache.hc.client5.http.impl.routing

## Class BasicRouteDirector

- java.lang.Object
- - org.apache.hc.client5.http.impl.routing.BasicRouteDirector

- All Implemented Interfaces:
    HttpRouteDirector

      @Contract(threading=STATELESS)
      public class BasicRouteDirector
      extends Object
      implements HttpRouteDirector

  Basic `HttpRouteDirector` implementation.
  Since:
    4.0

- - ### Field Summary

    Fields
    Modifier and Type | Field and Description
    --- | ---
    `static BasicRouteDirector` | `INSTANCE` Singleton instance.

    - ### Fields inherited from interface org.apache.hc.client5.http.routing.HttpRouteDirector

      `COMPLETE, CONNECT_PROXY, CONNECT_TARGET, LAYER_PROTOCOL, TUNNEL_PROXY, TUNNEL_TARGET, UNREACHABLE`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `BasicRouteDirector()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected int` | `directStep(RouteInfo plan, RouteInfo fact)` Determines the next step to establish a direct connection.
    `protected int` | `firstStep(RouteInfo plan)` Determines the first step to establish a route.
    `int` | `nextStep(RouteInfo plan, RouteInfo fact)` Provides the next step.
    `protected int` | `proxiedStep(RouteInfo plan, RouteInfo fact)` Determines the next step to establish a connection via proxy.

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

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

- - ### Field Detail

    - #### INSTANCE

          public static final BasicRouteDirector INSTANCE

      Singleton instance.
      Since:
        5.2

  - ### Constructor Detail

    - #### BasicRouteDirector

          public BasicRouteDirector()

  - ### Method Detail

    - #### nextStep

          public int nextStep(RouteInfo plan,
                              RouteInfo fact)

      Provides the next step.
      Specified by:
        `nextStep` in interface `HttpRouteDirector`
      Parameters:
        `plan` - the planned route
        `fact` - the currently established route, or `null` if nothing is established
      Returns:
        one of the constants defined in this class, indicating either the next step to perform, or success, or failure. 0 is for success, a negative value for failure.

    - #### firstStep

          protected int firstStep(RouteInfo plan)

      Determines the first step to establish a route.
      Parameters:
        `plan` - the planned route
      Returns:
        the first step

    - #### directStep

          protected int directStep(RouteInfo plan,
                                   RouteInfo fact)

      Determines the next step to establish a direct connection.
      Parameters:
        `plan` - the planned route
        `fact` - the currently established route
      Returns:
        one of the constants defined in this class, indicating either the next step to perform, or success, or failure

    - #### proxiedStep

          protected int proxiedStep(RouteInfo plan,
                                    RouteInfo fact)

      Determines the next step to establish a connection via proxy.
      Parameters:
        `plan` - the planned route
        `fact` - the currently established route
      Returns:
        one of the constants defined in this class, indicating either the next step to perform, or success, or failure

Copyright © 1999–2021 The Apache Software Foundation. All rights reserved.