@Override protected URLConnection openConnection(URL url, Proxy proxy) throws IOException { HttpURLConnection connection = (HttpURLConnection) super.openConnection(url, proxy); connection.setRequestMethod(this.httpMethod); if (resourceDetails.isAcceptsAuthorizationHeader()) { String authHeader = support.getAuthorizationHeader(resourceDetails, accessToken, url, httpMethod, additionalParameters); connection.setRequestProperty("Authorization", authHeader); } return connection; }
URLStreamHandler handler = new sun.net.www.protocol.http.Handler(); //standard http handler URL url = null; try { url = new URL(null, wsdlUrl, handler); //forced this http handler here ws = ServiceUtilityWS.create(url, qName); } catch (MalformedURLException e) { }
final URL url = new URL(null, urlString, new sun.net.www.protocol.http.Handler());
private URLConnection defaultConnection(URL url) throws IOException { return super.openConnection(url); } }
new URL(null, "http://...", new sun.net.www.protocol.http.Handler());
@Override protected URLConnection openConnection(URL url, Proxy proxy) throws IOException { HttpURLConnection connection = (HttpURLConnection) super.openConnection(url, proxy); connection.setRequestMethod(this.httpMethod); if (resourceDetails.isAcceptsAuthorizationHeader()) { String authHeader = support.getAuthorizationHeader(resourceDetails, accessToken, url, httpMethod, additionalParameters); connection.setRequestProperty("Authorization", authHeader); } return connection; }
URL url = new URL(null, urlstr, new sun.net.www.protocol.http.Handler());
URL url = new URL(null, "http://...", new sun.net.www.protocol.http.Handler()); HttpURLConnection cxn = (HttpURLConnection) url.openConnection();
sun.net.www.protocol.http.Handler handler = new sun.net.www.protocol.http.Handler(); URL url = new URL(null, "http://" + host + ":" + port + "/", handler);
url = new URL(null, address, new sun.net.www.protocol.http.Handler()); // use Sun's handler
java.net.Proxy proxy = new java.net.Proxy(java.net.Proxy.Type.HTTP, new java.net.InetSocketAddress("WHQPROXYPOOL", 80)); java.net.HttpURLConnection con = (java.net.HttpURLConnection) new java.net.URL(null, "https://performancemanager8.successfactors.com/odata/v2/FOPayGroup?$format=json", new sun.net.www.protocol.http.Handler()).openConnection(proxy);
public class URLStreamHandlerFactory implements java.net.URLStreamHandlerFactory { public URLStreamHandlerFactory() {} public URLStreamHandler createURLStreamHandler(String protocol) { if(protocol.equals("http")) { return new sun.net.www.protocol.http.Handler(); } else if(protocol.equals("https")) { return new sun.net.www.protocol.https.Handler(); } return null; } }
return new URL(null, u.toString(), new sun.net.www.protocol.http.Handler()).openConnection();