There are currently two variants of URL.openConnection:
URLConnection openConnection()
URLConnection openConnection(Proxy proxy)
There should be a third variant:
URLConnection openConnection(Proxy proxy, CookieHandler cookieHandler)
At the moment is is only possible to set the CookieHandler globally via CookieHandler.setDefault(), which means that if you want to have multiple cookie containers (e.g. if you want to simulate multiple browsers for the purposes of load testing), you need to do all the cookie management yourself. Most of the code needed
is already in URLConnection and its associated classes, all that is required is the ability to set a per-URLConnection CookieHandler.
URLConnection openConnection()
URLConnection openConnection(Proxy proxy)
There should be a third variant:
URLConnection openConnection(Proxy proxy, CookieHandler cookieHandler)
At the moment is is only possible to set the CookieHandler globally via CookieHandler.setDefault(), which means that if you want to have multiple cookie containers (e.g. if you want to simulate multiple browsers for the purposes of load testing), you need to do all the cookie management yourself. Most of the code needed
is already in URLConnection and its associated classes, all that is required is the ability to set a per-URLConnection CookieHandler.
- relates to
-
JDK-6973668 Add the ability to associate specific CookieHandler to HttpURLConnection
-
- Closed
-