View | Details | Raw Unified | Return to bug 60597
Collapse All | Expand All

(-)java/org/apache/tomcat/websocket/WsWebSocketContainer.java (-4 / +32 lines)
Lines 76-97 Link Here
76
        implements WebSocketContainer, BackgroundProcess {
76
        implements WebSocketContainer, BackgroundProcess {
77
77
78
    /**
78
    /**
79
     * Property name to set to configure the SSLEngine that will be used.  The
80
     * value should be an instance of SSLEngine.  If this property is present,
81
     * the SSL_PROTOCOLS, SSL_TRUSTSTORE*, and SSL_CONTEXT properies will be
82
     * ignored.
83
     */
84
    public static final String SSL_ENGINE_PROPERTY =
85
            "org.apache.tomcat.websocket.SSL_ENGINE";    
86
    /**
79
     * Property name to set to configure the value that is passed to
87
     * Property name to set to configure the value that is passed to
80
     * {@link SSLEngine#setEnabledProtocols(String[])}. The value should be a
88
     * {@link SSLEngine#setEnabledProtocols(String[])}. The value should be a
81
     * comma separated string.
89
     * comma separated string.
90
     *
91
     * @deprecated Use SSL_ENGINE_PROPERTY instead.
82
     */
92
     */
93
    @Deprecated
83
    public static final String SSL_PROTOCOLS_PROPERTY =
94
    public static final String SSL_PROTOCOLS_PROPERTY =
84
            "org.apache.tomcat.websocket.SSL_PROTOCOLS";
95
            "org.apache.tomcat.websocket.SSL_PROTOCOLS";
96
    @Deprecated
85
    public static final String SSL_TRUSTSTORE_PROPERTY =
97
    public static final String SSL_TRUSTSTORE_PROPERTY =
86
            "org.apache.tomcat.websocket.SSL_TRUSTSTORE";
98
            "org.apache.tomcat.websocket.SSL_TRUSTSTORE";
99
    @Deprecated
87
    public static final String SSL_TRUSTSTORE_PWD_PROPERTY =
100
    public static final String SSL_TRUSTSTORE_PWD_PROPERTY =
88
            "org.apache.tomcat.websocket.SSL_TRUSTSTORE_PWD";
101
            "org.apache.tomcat.websocket.SSL_TRUSTSTORE_PWD";
89
    public static final String SSL_TRUSTSTORE_PWD_DEFAULT = "changeit";
102
    @Deprecated
103
    public static final String SSL_TRUSTSTORE_PWD_DEFAULT = "changeit";        
90
    /**
104
    /**
91
     * Property name to set to configure used SSLContext. The value should be an
105
     * Property name to set to configure used SSLContext. The value should be an
92
     * instance of SSLContext. If this property is present, the SSL_TRUSTSTORE*
106
     * instance of SSLContext. If this property is present, the SSL_TRUSTSTORE*
93
     * properties are ignored.
107
     * properties are ignored.
108
     *
109
     * @deprecated Use SSL_ENGINE_PROPERTY instead.
94
     */
110
     */
111
    @Deprecated
95
    public static final String SSL_CONTEXT_PROPERTY =
112
    public static final String SSL_CONTEXT_PROPERTY =
96
            "org.apache.tomcat.websocket.SSL_CONTEXT";
113
            "org.apache.tomcat.websocket.SSL_CONTEXT";
97
114
Lines 935-941 Link Here
935
            throws DeploymentException {
952
            throws DeploymentException {
936
953
937
        try {
954
        try {
938
            // See if a custom SSLContext has been provided
955
            // See if a custom SSLEngine has been provided.  This is the
956
            // preferred way to configure the container.
957
            SSLEngine engine = (SSLEngine) userProperties.get(
958
                    SSL_ENGINE_PROPERTY);
959
                    
960
            if (null != engine)
961
            {
962
                return engine;
963
            }
964
            
965
            // As a fallback, see if a custom SSLContext has been provided;
966
            // the SSLContext can be used to create an SSLEngine.
939
            SSLContext sslContext =
967
            SSLContext sslContext =
940
                    (SSLContext) userProperties.get(SSL_CONTEXT_PROPERTY);
968
                    (SSLContext) userProperties.get(SSL_CONTEXT_PROPERTY);
941
969
Lines 978-986 Link Here
978
                    sslContext.init(null, null, null);
1006
                    sslContext.init(null, null, null);
979
                }
1007
                }
980
            }
1008
            }
1009
            
1010
            engine = sslContext.createSSLEngine();
981
1011
982
            SSLEngine engine = sslContext.createSSLEngine();
983
984
            String sslProtocolsValue =
1012
            String sslProtocolsValue =
985
                    (String) userProperties.get(SSL_PROTOCOLS_PROPERTY);
1013
                    (String) userProperties.get(SSL_PROTOCOLS_PROPERTY);
986
            if (sslProtocolsValue != null) {
1014
            if (sslProtocolsValue != null) {

Return to bug 60597