From e96c48387b6a307fa2e1168aec695142717cb9ae Mon Sep 17 00:00:00 2001 From: Thomas Watson Date: Wed, 30 Apr 2014 10:56:41 -0500 Subject: Bug 429714 - Pre-initialize SSLSocketFactory.getDefault() in Bridge Servlet init --- .../org/eclipse/equinox/servletbridge/BridgeServlet.java | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/BridgeServlet.java b/bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/BridgeServlet.java index 43448e25d..025ea4a79 100644 --- a/bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/BridgeServlet.java +++ b/bundles/org.eclipse.equinox.servletbridge/src/org/eclipse/equinox/servletbridge/BridgeServlet.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2005, 2013 Cognos Incorporated, IBM Corporation and others. + * Copyright (c) 2005, 2014 Cognos Incorporated, IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -12,6 +12,7 @@ package org.eclipse.equinox.servletbridge; import java.io.IOException; +import java.lang.reflect.Method; import java.util.StringTokenizer; import javax.servlet.ServletException; import javax.servlet.http.*; @@ -63,6 +64,19 @@ public class BridgeServlet extends HttpServlet { } } + // Forces load of the SSLSocketFactory on the web-app context class loader + String initSSLSocketFactory = getServletConfig().getInitParameter("_initSSLSocketFactory"); //$NON-NLS-1$ + if (!"false".equals(initSSLSocketFactory)) { //$NON-NLS-1$ + try { + Class clazz = this.getClass().getClassLoader().loadClass("javax.net.ssl.SSLSocketFactory"); //$NON-NLS-1$ + Method getDefaultMethod = clazz.getMethod("getDefault", null); //$NON-NLS-1$ + getDefaultMethod.invoke(null, null); + } catch (Exception e) { + // best effort -- log problems + getServletContext().log("Bridge Servlet _initSSLSocketFactory - failed - " + e.getMessage()); //$NON-NLS-1$ + } + } + String frameworkLauncherClassParameter = getServletConfig().getInitParameter("frameworkLauncherClass"); //$NON-NLS-1$ if (frameworkLauncherClassParameter != null) { try { -- cgit v1.2.3