Package brave.http
Class HttpServerRequest
java.lang.Object
brave.Request
brave.http.HttpRequest
brave.http.HttpServerRequest
public abstract class HttpServerRequest extends HttpRequest
Marks an interface for use in
HttpServerHandler.handleReceive(HttpServerRequest). This
gives a standard type to consider when parsing an incoming context.- Since:
- 5.7
- See Also:
HttpServerResponse
-
Constructor Summary
Constructors Constructor Description HttpServerRequest() -
Method Summary
Modifier and Type Method Description booleanparseClientIpAndPort(Span span)Used byHttpServerHandler.handleReceive(HttpServerRequest)to add remote socket information about the client from the delegate.protected booleanparseClientIpFromXForwardedFor(Span span)Uses the first value in the "X-Forwarded-For" header, or returns false if not present.Span.KindspanKind()Methods inherited from class brave.http.HttpRequest
header, method, path, route, startTimestamp, url
-
Constructor Details
-
HttpServerRequest
public HttpServerRequest()
-
-
Method Details
-
spanKind
-
parseClientIpAndPort
Used byHttpServerHandler.handleReceive(HttpServerRequest)to add remote socket information about the client from the delegate.By default, this tries to parse the forwarded IP. Override to add client socket information when forwarded info is not available.
Aside: It is more likely a server request object will be able to parse socket information as opposed to a client object. This is because client requests are often parsed before a network route is chosen, whereas server requests are parsed after the network layer.
- Returns:
- true if parsing was successful.
- Since:
- 5.7
-
parseClientIpFromXForwardedFor
Uses the first value in the "X-Forwarded-For" header, or returns false if not present.- Since:
- 5.10
-