1 7 package org.jboss.remoting.transport.http.ssl; 8 9 import java.io.IOException ; 10 import java.net.HttpURLConnection ; 11 import java.util.Map ; 12 import javax.net.ssl.HostnameVerifier; 13 import javax.net.ssl.HttpsURLConnection; 14 import javax.net.ssl.SSLSession; 15 import org.jboss.remoting.InvokerLocator; 16 import org.jboss.remoting.transport.http.HTTPClientInvoker; 17 18 21 public class HTTPSClientInvoker extends HTTPClientInvoker 22 { 23 26 public static final String IGNORE_HTTPS_HOST = "org.jboss.security.ignoreHttpsHost"; 27 28 public HTTPSClientInvoker(InvokerLocator locator) 29 { 30 super(locator); 31 } 32 33 40 protected HttpURLConnection createURLConnection(String url, Map metadat) throws IOException 41 { 42 HttpURLConnection conn = super.createURLConnection(url, metadat); 43 44 if(conn instanceof HttpsURLConnection && Boolean.getBoolean(IGNORE_HTTPS_HOST) == true) 45 { 46 HttpsURLConnection sconn = (HttpsURLConnection) conn; 47 sconn.setHostnameVerifier(new AnyhostVerifier()); 48 } 49 return conn; 50 } 51 52 private class AnyhostVerifier implements HostnameVerifier 53 { 54 55 public boolean verify(String s, SSLSession sslSession) 56 { 57 return true; 58 } 59 } 60 } | Popular Tags |