Class StandardHttpResponseMapper

java.lang.Object
org.apache.nifi.cluster.coordination.http.StandardHttpResponseMapper
All Implemented Interfaces:
HttpResponseMapper

public class StandardHttpResponseMapper extends Object implements HttpResponseMapper
  • Field Details

  • Constructor Details

    • StandardHttpResponseMapper

      public StandardHttpResponseMapper(NiFiProperties nifiProperties)
  • Method Details

    • mapResponses

      public NodeResponse mapResponses(URI uri, String httpMethod, Set<NodeResponse> nodeResponses, boolean merge)
      Description copied from interface: HttpResponseMapper
      Maps the responses from all nodes in the cluster to a single NodeResponse object that is appropriate to respond with
      Specified by:
      mapResponses in interface HttpResponseMapper
      Parameters:
      uri - the URI of the web request that was made
      httpMethod - the HTTP Method that was used when making the request
      nodeResponses - the responses received from the individual nodes
      Returns:
      a single NodeResponse that represents the response that should be returned to the user/client
    • getProblematicNodeResponses

      public Set<NodeResponse> getProblematicNodeResponses(Set<NodeResponse> allResponses)
      Description copied from interface: HttpResponseMapper
      Returns a subset (or equal set) of the given Node Responses, such that all of those returned are the responses that indicate that the node was unable to fulfill the request
      Specified by:
      getProblematicNodeResponses in interface HttpResponseMapper
      Parameters:
      allResponses - the responses to filter
      Returns:
      a subset (or equal set) of the given Node Responses, such that all of those returned are the responses that indicate that the node was unable to fulfill the request
    • isResponseInterpreted

      public boolean isResponseInterpreted(URI uri, String httpMethod)
      Description copied from interface: HttpResponseMapper
      Indicates whether or not the responses from nodes for the given URI invalid input: '&' HTTP method must be interpreted in order to merge them
      Specified by:
      isResponseInterpreted in interface HttpResponseMapper
      Parameters:
      uri - the URI of the request
      httpMethod - the HTTP Method of the request
      Returns:
      true if the response must be interpreted, false otherwise
    • getEndpointResponseMerger

      private EndpointResponseMerger getEndpointResponseMerger(URI uri, String httpMethod)
    • hasSuccessfulResponse

      private boolean hasSuccessfulResponse(Set<NodeResponse> allResponses)
    • drainResponses

      private void drainResponses(Set<NodeResponse> responses, NodeResponse exclude)
    • drainResponse

      private void drainResponse(NodeResponse response)