Uploaded image for project: 'HttpComponents HttpClient'
  1. HttpComponents HttpClient
  2. HTTPCLIENT-1434

TrustSelfSignedStrategy should be a singleton

    XMLWordPrintableJSON

Details

    • Improvement
    • Status: Closed
    • Trivial
    • Resolution: Fixed
    • 4.3.1
    • 4.4 Alpha1
    • HttpClient (classic)
    • None

    Description

      TrustSelfSignedStrategy should be a singleton, as it happens for several other strategies in HTTP Client. For example,

      public class TrustSelfSignedStrategy implements TrustStrategy {

      public static final TrustSelfSignedStrategy INSTANCE = new TrustSelfSignedStrategy();

      private TrustSelfSignedStrategy() {}

      public boolean isTrusted(
      final X509Certificate[] chain, final String authType) throws CertificateException

      { return chain.length == 1; }

      }

      Incidentally, I noted that other strategies (e.g., NoConnectionReuseStrategy) have a public constructor, which violates the Singleton design pattern.

      Attachments

        Activity

          People

            Unassigned Unassigned
            vigna Sebastiano Vigna
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: