public final class HttpClientConverter extends Object
Modifier and Type | Method and Description |
---|---|
static void |
addMatching(Set<Cookie> cookies,
URL normalizedUrl,
BrowserVersion browserVersion,
Set<Cookie> matches)
Adds all matching cookies to the provided set.
|
static org.apache.http.cookie.CookieOrigin |
buildCookieOrigin(URL url)
Helper that builds a CookieOrigin.
|
static List<Cookie> |
fromHttpClient(List<org.apache.http.cookie.Cookie> cookies)
Converts the specified array of HttpClient cookies into a list of cookies.
|
static boolean |
isNoHttpResponseException(Exception e) |
static List<org.apache.http.NameValuePair> |
nameValuePairsToHttpClient(List<NameValuePair> pairs)
Converts the specified name/value pairs into HttpClient name/value pairs.
|
static List<Cookie> |
parseCookie(String cookieString,
URL pageUrl,
BrowserVersion browserVersion) |
static URL |
replaceForCookieIfNecessary(URL url)
CookieOrigin doesn't like empty hosts and negative ports,
but these things happen if we're dealing with a local file. |
static List<org.apache.http.cookie.Cookie> |
toHttpClient(Collection<Cookie> cookies)
Converts the specified collection of cookies into a collection of HttpClient cookies.
|
public static List<org.apache.http.NameValuePair> nameValuePairsToHttpClient(List<NameValuePair> pairs)
pairs
- the name/value pairs to convertpublic static boolean isNoHttpResponseException(Exception e)
e
- the exception to checkNoHttpResponseException
public static org.apache.http.cookie.CookieOrigin buildCookieOrigin(URL url)
url
- the url to be usedpublic static URL replaceForCookieIfNecessary(URL url)
CookieOrigin
doesn't like empty hosts and negative ports,
but these things happen if we're dealing with a local file.
This method allows us to work around this limitation in HttpClient by feeding it a bogus host and port.url
- the URL to replace if necessarypublic static List<Cookie> parseCookie(String cookieString, URL pageUrl, BrowserVersion browserVersion) throws org.apache.http.cookie.MalformedCookieException
cookieString
- the string to parsepageUrl
- the page url as rootbrowserVersion
- the BrowserVersion
Cookie
'sorg.apache.http.cookie.MalformedCookieException
- in case the cookie does not conform to the specpublic static List<org.apache.http.cookie.Cookie> toHttpClient(Collection<Cookie> cookies)
cookies
- the cookies to be convertedpublic static List<Cookie> fromHttpClient(List<org.apache.http.cookie.Cookie> cookies)
cookies
- the cookies to be convertedpublic static void addMatching(Set<Cookie> cookies, URL normalizedUrl, BrowserVersion browserVersion, Set<Cookie> matches)
cookies
- the cookies to select fromnormalizedUrl
- the url to match againstbrowserVersion
- the BrowserVersion
matches
- the set to addCopyright © 2002–2025 Gargoyle Software Inc.. All rights reserved.