public class ForwardedHeader extends Object
Represents a Forwarded
header as described by RFC-7239.
Constructor and Description |
---|
ForwardedHeader(String by,
String forValue,
String host,
String proto,
Map<String,String> extensions)
Creates a new Forwarded Header.
|
Modifier and Type | Method and Description |
---|---|
String |
by() |
boolean |
equals(Object o) |
Map<String,String> |
extensions() |
String |
forValue() |
static List<ForwardedHeader> |
fromString(String input)
Parses the value of a
Forwarded header into an object. |
int |
hashCode() |
String |
host() |
String |
proto() |
String |
toString()
Converts the HeaderValue into a string, suitable for printing in an HTTP header.
|
static String |
toString(List<ForwardedHeader> headers)
Converts a list of headers into a single string that can be put into a Forwarded header field.
|
public ForwardedHeader(String by, String forValue, String host, String proto, Map<String,String> extensions)
by
- The address of the node proxying the request, or nullforValue
- The address of the client that initiated the request, or nullhost
- The host that the client used, or nullproto
- The protocol the client used, or nullextensions
- Any extensions, or nullpublic String by()
null
if not specified.public String forValue()
null
if not specified.public String host()
null
if not specified.public String proto()
null
if not specified.public Map<String,String> extensions()
public static List<ForwardedHeader> fromString(String input)
Parses the value of a Forwarded
header into an object.
Where multiple reverse proxies have resulted in multiple Forwarded headers, the first value in the list should contain the information of the original request.
Null or blank strings return an empty list.
input
- The value to parseIllegalArgumentException
- The value cannot be parsedpublic String toString()
public static String toString(List<ForwardedHeader> headers)
headers
- The headers to serialiseCopyright © 2017–2019. All rights reserved.