Announcement Announcement Module
Collapse
No announcement yet.
Setting Default SSL Socket Factory on Startup Page Title Module
Move Remove Collapse
X
Conversation Detail Module
Collapse
  • Filter
  • Time
  • Show
Clear All
new posts

  • Setting Default SSL Socket Factory on Startup

    I am basically telling SSL to accept all SSL socket factory:

    HttpsURLConnection.setDefaultSSLSocketFactory((SSL SocketFactory) AcceptAllSslSocketFactory.getDefault());
    HostnameVerifier hv = new HostnameVerifier() {

    public boolean verify(String urlHostName, SSLSession session) {
    String msg = "Warning: URL Host: " + urlHostName + " vs. " + session.getPeerHost();
    logger.warn(msg);
    System.err.println(msg);
    return true;
    }
    };

    HttpsURLConnection.setDefaultHostnameVerifier(hv);


    I need to figure out where to add this code in the spring frame work, so it gets loaded only 1x when the server starts.

    Any idea?

  • #2
    Init method of a bean would be your best bet.

    Other less appealing options include, for example, listener in web.xml, code-triggering facilities in your container, etc.

    Comment

    Working...
    X