Package org.n52.janmayen.net
Class ProxyChain
java.lang.Object
org.n52.janmayen.net.ProxyChain
Representation of a proxy chain as found in HTTP
X-Forwarded-For header.-
Constructor Summary
ConstructorsConstructorDescriptionProxyChain(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
Modifier and TypeMethodDescriptionbooleanstatic Optional<ProxyChain> fromForwardedForHeader(String header) Creates a Proxy chain from theX-Forwarded-ForHTTP header.(package private) static IPAddressgetIPAddress(String address) Get the origin of the request (the clients address).Get a list of all intermediate proxy servers.inthashCode()toString()
-
Constructor Details
-
ProxyChain
Creates a new chain from a origin (the original client) and all intermediate proxies.- Parameters:
origin- the originproxies- the proxies
-
ProxyChain
Creates a new chain from a list of addresses as found in theX-Forwarded-Forheader. The list has to have at least one member.- Parameters:
chain- the chain
-
-
Method Details
-
getOrigin
Get the origin of the request (the clients address).- Returns:
- the origin
-
getProxies
Get a list of all intermediate proxy servers.- Returns:
- the proxies
-
hashCode
public int hashCode() -
equals
-
toString
-
fromForwardedForHeader
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.
-
getIPAddress
-