Package com.yahoo.container.jdisc
Class VespaHeaders
- java.lang.Object
-
- com.yahoo.container.jdisc.VespaHeaders
-
public final class VespaHeaders extends java.lang.Object
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 Constructor Description VespaHeaders()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static boolean
benchmarkCoverage(boolean benchmarkOutput, com.yahoo.jdisc.HeaderFields headers)
static boolean
benchmarkOutput(HttpRequest request)
Returns true if this is a benchmarking request, according to headersstatic void
benchmarkOutput(com.yahoo.jdisc.HeaderFields responseHeaders, boolean benchmarkCoverage, Timing t, com.yahoo.container.logging.HitCounts c, int errorCount, Coverage coverage)
Add search benchmark output to the HTTP getHeaders.static int
getEagerErrorStatus(com.yahoo.processing.request.ErrorMessage mainError, java.util.Iterator<? extends com.yahoo.processing.request.ErrorMessage> allErrors)
Returns 5xx or 4xx if there is any error present in the result, 200 otherwisestatic int
getStatus(boolean isSuccess, com.yahoo.processing.request.ErrorMessage mainError, java.util.Iterator<? extends com.yahoo.processing.request.ErrorMessage> allErrors)
(during normal execution) return 200 unless this is not a success or a 4xx error is requested.
-
-
-
Method Detail
-
benchmarkCoverage
public static boolean benchmarkCoverage(boolean benchmarkOutput, com.yahoo.jdisc.HeaderFields headers)
-
benchmarkOutput
public static boolean benchmarkOutput(HttpRequest request)
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, com.yahoo.container.logging.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, com.yahoo.processing.request.ErrorMessage mainError, java.util.Iterator<? extends com.yahoo.processing.request.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(com.yahoo.processing.request.ErrorMessage mainError, java.util.Iterator<? extends com.yahoo.processing.request.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.
-
-