Interface HttpResponseMapper

All Known Implementing Classes:
StandardHttpResponseMapper

public interface HttpResponseMapper

An HttpResponseMapper is responsible for taking the responses from all nodes in a cluster and distilling them down to a single response that would be appropriate to respond with, to the user/client who made the original web requests.

  • Method Summary

    Modifier and Type
    Method
    Description
    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
    boolean
    isResponseInterpreted(URI uri, String httpMethod)
    Indicates whether or not the responses from nodes for the given URI invalid input: '&' HTTP method must be interpreted in order to merge them
    mapResponses(URI uri, String httpMethod, Set<NodeResponse> nodeResponses, boolean merge)
    Maps the responses from all nodes in the cluster to a single NodeResponse object that is appropriate to respond with
  • Method Details

    • mapResponses

      NodeResponse mapResponses(URI uri, String httpMethod, Set<NodeResponse> nodeResponses, boolean merge)
      Maps the responses from all nodes in the cluster to a single NodeResponse object that is appropriate to respond with
      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

      Set<NodeResponse> getProblematicNodeResponses(Set<NodeResponse> allResponses)
      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
      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

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