2

私はグラスフィッシュ 4.0 で websockets アプリケーションを開発しています。SSL を使用していない場合はすべて正常に動作していますが、SSL を使用している場合は動作しません。


注釈付きの Java オブジェクトをサーバーとして使用しています。

@ServerEndpoint("/websocket/{sessionID}")
public class WebSocketServerEndPoint {...}

クライアント側では、次の JavaScript を使用します。

var webSocket = new WebSocket('wss://domain.com:8181/websocketserver/websocket/sessionXXX');

展開記述子 web.xml には、ssl 以外の方法でアプリケーションにアクセスできないようにするための何かがあります。

<security-constraint>
        <web-resource-collection>
            <web-resource-name>Protected resource</web-resource-name>
            <url-pattern>/*</url-pattern>
            <http-method>GET</http-method>
        </web-resource-collection>
        <user-data-constraint>
            <transport-guarantee>CONFIDENTIAL</transport-guarantee>
        </user-data-constraint>
    </security-constraint>

    <!-- deny all methods other than GET in all url -->
    <security-constraint>
        <web-resource-collection>
            <web-resource-name>protected</web-resource-name>
            <url-pattern>/*</url-pattern>
            <http-method-omission>GET</http-method-omission>
        </web-resource-collection>
        <auth-constraint/>
    </security-constraint>

index.html テスト ページにアクセスして https をテストしましたが、正しく表示されます。

https://domain.com:8181/websocketserver/index.html

websockets を使用すると ssl が機能しないのに、https を使用すると正常に機能する理由について何か考えはありますか?

4

0 に答える 0