Class NodeResponse

java.lang.Object
org.apache.nifi.cluster.manager.NodeResponse

public class NodeResponse extends Object
Encapsulates a node's response in regards to receiving a external API request. Both the ClientResponse and (server) Response may be obtained from this instance. The ClientResponse is stored as it is received from the node. This includes the entity input stream. The Response is constructed on demand when mapping a ClientResponse to the Response. The ClientResponse to Response mapping includes copying the ClientResponse's input stream to the Response. Therefore, the getResponse() method should not be called more than once. Furthermore, the method should not be called if the caller has already read the ClientResponse's input stream. If a ClientResponse was unable to be created, then a NodeResponse will store the Throwable, which may be obtained by calling getThrowable(). This class overrides hashCode and equals and considers two instances to be equal if they have the equal NodeIdentifiers.
  • Field Details

    • logger

      private static final org.slf4j.Logger logger
    • httpMethod

      private final String httpMethod
    • requestUri

      private final URI requestUri
    • response

      private final jakarta.ws.rs.core.Response response
    • nodeId

      private final NodeIdentifier nodeId
    • throwable

      private Throwable throwable
    • hasCreatedResponse

      private boolean hasCreatedResponse
    • updatedEntity

      private final Entity updatedEntity
    • requestDurationNanos

      private final long requestDurationNanos
    • requestId

      private final String requestId
  • Constructor Details

  • Method Details

    • getNodeId

      public NodeIdentifier getNodeId()
    • getHttpMethod

      public String getHttpMethod()
    • getRequestUri

      public URI getRequestUri()
    • getStatus

      public int getStatus()
    • is2xx

      public boolean is2xx()
    • is5xx

      public boolean is5xx()
    • bufferResponse

      public void bufferResponse()
    • getInputStream

      public InputStream getInputStream()
    • getClientResponse

      public jakarta.ws.rs.core.Response getClientResponse()
    • getUpdatedEntity

      public Entity getUpdatedEntity()
    • getResponse

      public jakarta.ws.rs.core.Response getResponse()
    • getThrowable

      public Throwable getThrowable()
    • hasThrowable

      public boolean hasThrowable()
    • equals

      public boolean equals(Object obj)
      Overrides:
      equals in class Object
    • hashCode

      public int hashCode()
      Overrides:
      hashCode in class Object
    • getRequestDuration

      public long getRequestDuration(TimeUnit timeUnit)
    • getRequestId

      public String getRequestId()
    • createResponse

      private jakarta.ws.rs.core.Response createResponse()
    • toString

      public String toString()
      Overrides:
      toString in class Object