Package org.n52.janmayen.net
Class ProxyChain
- java.lang.Object
-
- org.n52.janmayen.net.ProxyChain
-
public class ProxyChain extends Object
Representation of a proxy chain as found in HTTPX-Forwarded-Forheader.
-
-
Constructor Summary
Constructors Constructor Description ProxyChain(List<IPAddress> chain)Creates a new chain from a list of addresses as found in theX-Forwarded-Forheader.ProxyChain(IPAddress origin, List<IPAddress> proxies)Creates a new chain from a origin (the original client) and all intermediate proxies.
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description booleanequals(Object obj)static Optional<ProxyChain>fromForwardedForHeader(String header)Creates a Proxy chain from theX-Forwarded-ForHTTP header.(package private) static IPAddressgetIPAddress(String address)IPAddressgetOrigin()Get the origin of the request (the clients address).List<IPAddress>getProxies()Get a list of all intermediate proxy servers.inthashCode()StringtoString()
-
-
-
Method Detail
-
getOrigin
public IPAddress getOrigin()
Get the origin of the request (the clients address).- Returns:
- the origin
-
getProxies
public List<IPAddress> getProxies()
Get a list of all intermediate proxy servers.- Returns:
- the proxies
-
fromForwardedForHeader
public static Optional<ProxyChain> fromForwardedForHeader(String header)
Creates a Proxy chain from theX-Forwarded-ForHTTP header.- Parameters:
header- theX-Forwarded-Forheader- Returns:
- a
ProxyChainif the header is present, non empty and well formed.
-
-