Changeset 53219 in vbox for trunk/src/VBox/Main/glue
- Timestamp:
- Nov 4, 2014 7:02:36 PM (10 years ago)
- svn:sync-xref-src-repo-rev:
- 96767
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/VBox/Main/glue/glue-java.xsl
r51448 r53219 4242 4242 import java.util.Map; 4243 4243 import java.util.HashMap; 4244 import java.util.ArrayList; 4244 4245 import javax.xml.namespace.QName; 4245 4246 import javax.xml.ws.BindingProvider; 4246 4247 import javax.xml.ws.Holder; 4247 4248 import javax.xml.ws.WebServiceException; 4249 import java.io.IOException; 4250 import java.net.UnknownHostException; 4251 import java.net.Socket; 4252 import java.net.InetAddress; 4253 import javax.net.SocketFactory; 4254 import javax.net.ssl.SSLContext; 4255 import javax.net.ssl.SSLSocketFactory; 4256 import javax.net.ssl.SSLSocket; 4248 4257 4249 4258 class PortPool … … 4361 4370 4362 4371 4372 class VBoxTLSSocketFactory extends SSLSocketFactory 4373 { 4374 private final SSLSocketFactory sf; 4375 4376 private void setupSocket(SSLSocket s) 4377 { 4378 String[] oldproto = s.getEnabledProtocols(); 4379 List<String> protolist = new ArrayList<String>(); 4380 for (int i = 0; i < oldproto.length; i++) 4381 if (oldproto[i].toUpperCase().startsWith("TLS")) 4382 protolist.add(oldproto[i]); 4383 String[] newproto = protolist.toArray(new String[protolist.size()]); 4384 s.setEnabledProtocols(newproto); 4385 } 4386 4387 public VBoxTLSSocketFactory() 4388 { 4389 SSLSocketFactory tmp = null; 4390 try 4391 { 4392 SSLContext sc = SSLContext.getInstance("TLS"); 4393 sc.init(null, null, null); 4394 tmp = sc.getSocketFactory(); 4395 } 4396 catch (Exception e) 4397 { 4398 e.printStackTrace(); 4399 } 4400 sf = tmp; 4401 } 4402 4403 public static SocketFactory getDefault() 4404 { 4405 return new VBoxTLSSocketFactory(); 4406 } 4407 4408 public Socket createSocket(Socket socket, String host, int port, 4409 boolean autoClose) throws IOException, UnknownHostException 4410 { 4411 SSLSocket s = (SSLSocket)sf.createSocket(socket, host, port, autoClose); 4412 setupSocket(s); 4413 return s; 4414 } 4415 4416 public Socket createSocket() throws IOException 4417 { 4418 SSLSocket s = (SSLSocket)sf.createSocket(); 4419 setupSocket(s); 4420 return s; 4421 } 4422 4423 public Socket createSocket(InetAddress host, int port) throws IOException 4424 { 4425 SSLSocket s = (SSLSocket)sf.createSocket(host, port); 4426 setupSocket(s); 4427 return s; 4428 } 4429 4430 public Socket createSocket(InetAddress address, int port, 4431 InetAddress localAddress, int localPort) throws IOException 4432 { 4433 SSLSocket s = (SSLSocket)sf.createSocket(address, port, localAddress, localPort); 4434 setupSocket(s); 4435 return s; 4436 } 4437 4438 public Socket createSocket(String host, int port) throws IOException, UnknownHostException 4439 { 4440 SSLSocket s = (SSLSocket)sf.createSocket(host, port); 4441 setupSocket(s); 4442 return s; 4443 } 4444 4445 public Socket createSocket(String host, int port, 4446 InetAddress localHost, int localPort) throws IOException, UnknownHostException 4447 { 4448 SSLSocket s = (SSLSocket)sf.createSocket(host, port, localHost, localPort); 4449 setupSocket(s); 4450 return s; 4451 } 4452 4453 public String[] getDefaultCipherSuites() 4454 { 4455 return sf.getSupportedCipherSuites(); 4456 } 4457 4458 public String[] getSupportedCipherSuites() 4459 { 4460 return sf.getSupportedCipherSuites(); 4461 } 4462 } 4463 4464 4363 4465 public class VirtualBoxManager 4364 4466 { … … 4387 4489 ((BindingProvider)port).getRequestContext(). 4388 4490 put(BindingProvider.ENDPOINT_ADDRESS_PROPERTY, url); 4491 VBoxTLSSocketFactory sf = new VBoxTLSSocketFactory(); 4492 ((BindingProvider)port).getRequestContext(). 4493 put("com.sun.xml.internal.ws.transport.https.client.SSLSocketFactory", sf); 4494 4389 4495 String handle = port.iWebsessionManagerLogon(username, passwd); 4390 4496 this.vbox = new IVirtualBox(handle, port);
Note:
See TracChangeset
for help on using the changeset viewer.