HttpClientAdapter
, HttpServerAdapter
public abstract class HttpAdapter<Req,Resp>
extends java.lang.Object
Modifier and Type | Method | Description |
---|---|---|
abstract java.lang.String |
method(Req request) |
The HTTP method, or verb, such as "GET" or "POST" or null if unreadable.
|
java.lang.String |
methodFromResponse(Resp resp) |
Like
method(Object) except used in response parsing. |
java.lang.String |
path(Req request) |
The absolute http path, without any query parameters or null if unreadable.
|
abstract java.lang.String |
requestHeader(Req request,
java.lang.String name) |
Returns one value corresponding to the specified header, or null.
|
java.lang.String |
route(Resp response) |
Returns an expression such as "/items/:itemId" representing an application endpoint,
conventionally associated with the tag key "http.route".
|
abstract java.lang.Integer |
statusCode(Resp response) |
The HTTP status code or null if unreadable.
|
int |
statusCodeAsInt(Resp response) |
Like
statusCode(Object) except returns a primitive where zero implies absent. |
abstract java.lang.String |
url(Req request) |
The entire URL, including the scheme, host and query parameters if available or null if
unreadable.
|
@Nullable public abstract java.lang.String method(Req request)
Conventionally associated with the key "http.method"
@Nullable public java.lang.String path(Req request)
Conventionally associated with the key "http.path"
route(Object)
@Nullable public abstract java.lang.String url(Req request)
Conventionally associated with the key "http.url"
@Nullable public abstract java.lang.String requestHeader(Req request, java.lang.String name)
@Nullable public java.lang.String methodFromResponse(Resp resp)
method(Object)
except used in response parsing.
Notably, this is used to create a route-based span name.
@Nullable public java.lang.String route(Resp response)
Eventhough the route is associated with the request, not the response, this is present on the response object. The reasons is that many server implementations process the request before they can identify the route route.
@Nullable public abstract java.lang.Integer statusCode(Resp response)
Conventionally associated with the key "http.status_code"
statusCodeAsInt(Object)
public int statusCodeAsInt(Resp response)
statusCode(Object)
except returns a primitive where zero implies absent.
Using this method usually avoids allocation, so is encouraged when parsing data.
Copyright © 2018 OpenZipkin. All rights reserved.