Package com.yahoo.container.jdisc
Class VespaHeaders
java.lang.Object
com.yahoo.container.jdisc.VespaHeaders
Static helper methods which implement the mapping between the ErrorMessage
API and HTTP headers and return codes.
- Author:
- Einar M R Rosenvinge, Steinar Knutsen, Simon Thoresen Hult, bratseth
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic booleanbenchmarkCoverage(boolean benchmarkOutput, com.yahoo.jdisc.HeaderFields headers) static booleanbenchmarkOutput(HttpRequest request) Returns true if this is a benchmarking request, according to headersstatic voidbenchmarkOutput(com.yahoo.jdisc.HeaderFields responseHeaders, boolean benchmarkCoverage, Timing t, HitCounts c, int errorCount, Coverage coverage) Add search benchmark output to the HTTP getHeaders.static intgetEagerErrorStatus(ErrorMessage mainError, Iterator<? extends ErrorMessage> allErrors) Returns 5xx or 4xx if there is any error present in the result, 200 otherwisestatic intgetStatus(boolean isSuccess, ErrorMessage mainError, Iterator<? extends ErrorMessage> allErrors) (during normal execution) return 200 unless this is not a success or a 4xx error is requested.
-
Constructor Details
-
VespaHeaders
public VespaHeaders()
-
-
Method Details
-
benchmarkCoverage
public static boolean benchmarkCoverage(boolean benchmarkOutput, com.yahoo.jdisc.HeaderFields headers) -
benchmarkOutput
Returns true if this is a benchmarking request, according to headers -
benchmarkOutput
public static void benchmarkOutput(com.yahoo.jdisc.HeaderFields responseHeaders, boolean benchmarkCoverage, Timing t, HitCounts c, int errorCount, Coverage coverage) Add search benchmark output to the HTTP getHeaders.- Parameters:
responseHeaders- the response to write the headers tobenchmarkCoverage- true to include coverage headerst- the Timing to read data fromc- the Counts to read data fromerrorCount- the error countcoverage- the Coverage to read data from
-
getStatus
public static int getStatus(boolean isSuccess, ErrorMessage mainError, Iterator<? extends ErrorMessage> allErrors) (during normal execution) return 200 unless this is not a success or a 4xx error is requested.- Parameters:
isSuccess- whether or not the response represents a successmainError- the main error of the response, if anyallErrors- all the errors of the response, if any- Returns:
- the status code of the given response
-
getEagerErrorStatus
public static int getEagerErrorStatus(ErrorMessage mainError, Iterator<? extends ErrorMessage> allErrors) Returns 5xx or 4xx if there is any error present in the result, 200 otherwise- Parameters:
mainError- The main error of the response.allErrors- All the errors of the response, if any.- Returns:
- The error status code of the given response.
-