public class ProxyChain extends Object
X-Forwarded-For
header.Modifier and Type | Field and Description |
---|---|
private static org.slf4j.Logger |
LOG |
private IPAddress |
origin |
private com.google.common.collect.ImmutableList<IPAddress> |
proxies |
Constructor and Description |
---|
ProxyChain(IPAddress origin,
List<IPAddress> proxies)
Creates a new chain from a origin (the original client) and all
intermediate proxies.
|
ProxyChain(List<IPAddress> chain)
Creates a new chain from a list of addresses as found in the
X-Forwarded-For header. |
Modifier and Type | Method and Description |
---|---|
boolean |
equals(Object obj) |
static com.google.common.base.Optional<ProxyChain> |
fromForwardedForHeader(String header)
Creates a Proxy chain from the
X-Forwarded-For HTTP header. |
(package private) static IPAddress |
getIPAddress(String address) |
IPAddress |
getOrigin()
Get the origin of the request (the clients address).
|
com.google.common.collect.ImmutableList<IPAddress> |
getProxies()
Get a list of all intermediate proxy servers.
|
int |
hashCode() |
String |
toString() |
private static final org.slf4j.Logger LOG
private final com.google.common.collect.ImmutableList<IPAddress> proxies
private final IPAddress origin
public ProxyChain(IPAddress origin, List<IPAddress> proxies)
origin
- the originproxies
- the proxiespublic IPAddress getOrigin()
public com.google.common.collect.ImmutableList<IPAddress> getProxies()
public static com.google.common.base.Optional<ProxyChain> fromForwardedForHeader(String header)
X-Forwarded-For
HTTP header.header
- the X-Forwarded-For
headerProxyChain
if the header is present, non empty and well
formed.Copyright © 2012-2015 52north.org. All Rights Reserved.