Class Forwarded.Builder
- Enclosing class:
- Forwarded
Composes the forwarding information defined by
RFC 7239 into the
param(String, String) is a generic escape
hatch. Values are emitted as bare tokens when possible and quoted automatically when they are not valid tokens
(e.g. IPv6 node identifiers such as next() to start a new hop.
Example:
String
See Also:
- Since:
- 10.0.0
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds the renderedForwarded header value.Sets theby parameter (the interface where the request came in to the proxy) on the current element.Sets thefor parameter (the client that initiated the request) on the current element.Sets thehost parameter (the originalHost request header) on the current element.next()Commits the current forwarded element and begins a new one (the next proxy hop).Generic escape hatch for setting any forwarded parameter by name on the current element.Sets theproto parameter (the protocol used to make the request) on the current element.toHeader()Builds aForwardedheader bean directly from this builder.toString()
-
Constructor Details
-
Builder
public Builder()Constructor.
-
-
Method Details
-
by
Sets theby parameter (the interface where the request came in to the proxy) on the current element.- Parameters:
value- The node identifier. Must not benull .- Returns:
- This object.
-
forValue
Sets thefor parameter (the client that initiated the request) on the current element.- Parameters:
value- The node identifier. Must not benull .- Returns:
- This object.
-
host
Sets thehost parameter (the originalHost request header) on the current element.- Parameters:
value- The host. Must not benull .- Returns:
- This object.
-
proto
Sets theproto parameter (the protocol used to make the request) on the current element.- Parameters:
value- The protocol (e.g."http" ,"https" ). Must not benull .- Returns:
- This object.
-
param
Generic escape hatch for setting any forwarded parameter by name on the current element.Replaces any previously-registered value for the same parameter while preserving its original position. The value is emitted as a bare token when valid, otherwise as an escaped quoted-string.
- Parameters:
name- The parameter name. Must not benull or blank.value- The parameter value. Must not benull .- Returns:
- This object.
- Throws:
IllegalArgumentException- Ifnameisnull or blank.
-
next
Commits the current forwarded element and begins a new one (the next proxy hop).- Returns:
- This object.
-
build
Builds the renderedForwarded header value.Empty elements (hops with no parameters) are omitted. Returns an empty string when nothing has been registered.
- Returns:
- The header value. Never
null .
-
toHeader
Builds aForwardedheader bean directly from this builder. -
toString
-