Package org.apache.nifi.cluster.manager
Class NodeResponse
java.lang.Object
org.apache.nifi.cluster.manager.NodeResponse
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 Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionNodeResponse
(NodeResponse example, Entity updatedEntity) NodeResponse
(NodeIdentifier nodeId, String httpMethod, URI requestUri, Throwable throwable) NodeResponse
(NodeIdentifier nodeId, String httpMethod, URI requestUri, javax.ws.rs.core.Response response, long requestDurationNanos, String requestId) -
Method Summary
-
Field Details
-
logger
private static final org.slf4j.Logger logger -
httpMethod
-
requestUri
-
response
private final javax.ws.rs.core.Response response -
nodeId
-
throwable
-
hasCreatedResponse
private boolean hasCreatedResponse -
updatedEntity
-
requestDurationNanos
private final long requestDurationNanos -
requestId
-
-
Constructor Details
-
NodeResponse
public NodeResponse(NodeIdentifier nodeId, String httpMethod, URI requestUri, javax.ws.rs.core.Response response, long requestDurationNanos, String requestId) -
NodeResponse
-
NodeResponse
-
-
Method Details
-
getNodeId
-
getHttpMethod
-
getRequestUri
-
getStatus
public int getStatus() -
is2xx
public boolean is2xx() -
is5xx
public boolean is5xx() -
bufferResponse
public void bufferResponse() -
getInputStream
-
getClientResponse
public javax.ws.rs.core.Response getClientResponse() -
getUpdatedEntity
-
getResponse
public javax.ws.rs.core.Response getResponse() -
getThrowable
-
hasThrowable
public boolean hasThrowable() -
equals
-
hashCode
public int hashCode() -
getRequestDuration
-
getRequestId
-
createResponse
private javax.ws.rs.core.Response createResponse() -
toString
-