How to expose WSS 'secure websocket' with JavaIs Java “pass-by-reference” or “pass-by-value”?How do I efficiently iterate over each entry in a Java Map?What is the difference between public, protected, package-private and private in Java?How do I call one constructor from another in Java?How do I read / convert an InputStream into a String in Java?When to use LinkedList over ArrayList in Java?How do I generate random integers within a specific range in Java?How do I determine whether an array contains a particular value in Java?How do I convert a String to an int in Java?Creating a memory leak with Java

Time war story - soldier name lengthens as he travels further from the battle front

What is the minimum wait before I may I re-enter the USA after a 90 day visit on the Visa B-2 Program?

What is the simplest instruction set that has a C++/C compiler to write an emulator for?

What would be an ideal fidelity measure to determine the closeness between two non unitary matrices?

Why would word of Princess Leia's capture generate sympathy for the Rebellion in the Senate?

What could make large expeditions ineffective for exploring territory full of dangers and valuable resources?

Why should fork() have been designed to return a file descriptor?

What does a Nintendo Game Boy do when turned on without a game cartridge inserted?

Discretisation of region intersection in 3D

Conditional statement in a function for PS1 are not re-evalutated

How does the Gameboy's memory bank switching work?

How far off did Apollo 11 land?

Do I care if the housing market has gone up or down, if I'm moving from one house to another?

Aren't all schwa sounds literally /ø/?

Could a US citizen born through "birth tourism" become President?

How was Luke's prosthetic hand in Episode V filmed?

TCP connections hang during handshake

Why do we need an estimator to be consistent?

Found old paper shares of Motorola Inc that has since been broken up

"move up the school" meaning

What does Windows' "Tuning up Application Start" do?

Satellite in orbit in front of and behind the Moon

Book in which the "mountain" in the distance was a hole in the flat world

Project Euler # 25 The 1000 digit Fibonacci index



How to expose WSS 'secure websocket' with Java


Is Java “pass-by-reference” or “pass-by-value”?How do I efficiently iterate over each entry in a Java Map?What is the difference between public, protected, package-private and private in Java?How do I call one constructor from another in Java?How do I read / convert an InputStream into a String in Java?When to use LinkedList over ArrayList in Java?How do I generate random integers within a specific range in Java?How do I determine whether an array contains a particular value in Java?How do I convert a String to an int in Java?Creating a memory leak with Java






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








2















I'm setting up a new webSocket server using Java, and want to expose it in WSS because my client side app is in HTTPS. Could you help me please



I've tried to modify my web.xml but dosen't work



<web-app>
<display-name>Archetype Created Web Application</display-name>
<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>
<!-- https -->
<user-data-constraint>
<transport-guarantee>CONFIDENTIAL</transport-guarantee>
</user-data-constraint>
</security-constraint>
</web-app>


This is my EndPoint Class



@ServerEndpoint(value = "/signalisation/username", decoders = MessageDecoder.class, encoders = MessageEncoder.class)
public class ChatEndpoint
private Session session;
private static final Set<ChatEndpoint> chatEndpoints = new CopyOnWriteArraySet<>();
private static HashMap<String, String> users = new HashMap<>();

@OnOpen
public void onOpen(Session session, @PathParam("username") String username) throws IOException, EncodeException
System.out.println("connected");
this.session = session;
chatEndpoints.add(this);
users.put(session.getId(), username);

Message message = new Message();
message.setFrom(username);
message.setContent("Connected!");
broadcast(message, message.getTo());


@OnMessage
public void onMessage(Session session, Message message) throws IOException, EncodeException
message.setFrom(users.get(session.getId()));
System.out.println("messaged");



@OnClose
public void onClose(Session session) throws IOException, EncodeException
System.out.println("out");


@OnError
public void onError(Session session, Throwable throwable)
// Do error handling here


private static void broadcast(Message message, String id) throws IOException, EncodeException
chatEndpoints.forEach(endpoint ->
if (endpoint.session.getId().equals(id))
synchronized (endpoint) EncodeException e)
e.printStackTrace();



);


public String getKeyFromMap(HashMap map, String value)

for (Object o : map.keySet())
if (map.get(o).equals(value))
return o.toString();

return null;





My Client Side app



var conn = new WebSocket('ws://<IP_ADRESSE>:8080/<PATH>/signalisation/'+c);
conn.onopen = function ()
console.log("Connected to the server");
;


My actual result is :



client.js:11 Mixed Content: The page at 'https://IP_ADRESSE:PORT/?user=blabla' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://IP_ADRESSE:8080/PATH/signalisation/blabla'. This request has been blocked; this endpoint must be available over WSS.










share|improve this question




























    2















    I'm setting up a new webSocket server using Java, and want to expose it in WSS because my client side app is in HTTPS. Could you help me please



    I've tried to modify my web.xml but dosen't work



    <web-app>
    <display-name>Archetype Created Web Application</display-name>
    <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>
    <!-- https -->
    <user-data-constraint>
    <transport-guarantee>CONFIDENTIAL</transport-guarantee>
    </user-data-constraint>
    </security-constraint>
    </web-app>


    This is my EndPoint Class



    @ServerEndpoint(value = "/signalisation/username", decoders = MessageDecoder.class, encoders = MessageEncoder.class)
    public class ChatEndpoint
    private Session session;
    private static final Set<ChatEndpoint> chatEndpoints = new CopyOnWriteArraySet<>();
    private static HashMap<String, String> users = new HashMap<>();

    @OnOpen
    public void onOpen(Session session, @PathParam("username") String username) throws IOException, EncodeException
    System.out.println("connected");
    this.session = session;
    chatEndpoints.add(this);
    users.put(session.getId(), username);

    Message message = new Message();
    message.setFrom(username);
    message.setContent("Connected!");
    broadcast(message, message.getTo());


    @OnMessage
    public void onMessage(Session session, Message message) throws IOException, EncodeException
    message.setFrom(users.get(session.getId()));
    System.out.println("messaged");



    @OnClose
    public void onClose(Session session) throws IOException, EncodeException
    System.out.println("out");


    @OnError
    public void onError(Session session, Throwable throwable)
    // Do error handling here


    private static void broadcast(Message message, String id) throws IOException, EncodeException
    chatEndpoints.forEach(endpoint ->
    if (endpoint.session.getId().equals(id))
    synchronized (endpoint) EncodeException e)
    e.printStackTrace();



    );


    public String getKeyFromMap(HashMap map, String value)

    for (Object o : map.keySet())
    if (map.get(o).equals(value))
    return o.toString();

    return null;





    My Client Side app



    var conn = new WebSocket('ws://<IP_ADRESSE>:8080/<PATH>/signalisation/'+c);
    conn.onopen = function ()
    console.log("Connected to the server");
    ;


    My actual result is :



    client.js:11 Mixed Content: The page at 'https://IP_ADRESSE:PORT/?user=blabla' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://IP_ADRESSE:8080/PATH/signalisation/blabla'. This request has been blocked; this endpoint must be available over WSS.










    share|improve this question
























      2












      2








      2








      I'm setting up a new webSocket server using Java, and want to expose it in WSS because my client side app is in HTTPS. Could you help me please



      I've tried to modify my web.xml but dosen't work



      <web-app>
      <display-name>Archetype Created Web Application</display-name>
      <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>
      <!-- https -->
      <user-data-constraint>
      <transport-guarantee>CONFIDENTIAL</transport-guarantee>
      </user-data-constraint>
      </security-constraint>
      </web-app>


      This is my EndPoint Class



      @ServerEndpoint(value = "/signalisation/username", decoders = MessageDecoder.class, encoders = MessageEncoder.class)
      public class ChatEndpoint
      private Session session;
      private static final Set<ChatEndpoint> chatEndpoints = new CopyOnWriteArraySet<>();
      private static HashMap<String, String> users = new HashMap<>();

      @OnOpen
      public void onOpen(Session session, @PathParam("username") String username) throws IOException, EncodeException
      System.out.println("connected");
      this.session = session;
      chatEndpoints.add(this);
      users.put(session.getId(), username);

      Message message = new Message();
      message.setFrom(username);
      message.setContent("Connected!");
      broadcast(message, message.getTo());


      @OnMessage
      public void onMessage(Session session, Message message) throws IOException, EncodeException
      message.setFrom(users.get(session.getId()));
      System.out.println("messaged");



      @OnClose
      public void onClose(Session session) throws IOException, EncodeException
      System.out.println("out");


      @OnError
      public void onError(Session session, Throwable throwable)
      // Do error handling here


      private static void broadcast(Message message, String id) throws IOException, EncodeException
      chatEndpoints.forEach(endpoint ->
      if (endpoint.session.getId().equals(id))
      synchronized (endpoint) EncodeException e)
      e.printStackTrace();



      );


      public String getKeyFromMap(HashMap map, String value)

      for (Object o : map.keySet())
      if (map.get(o).equals(value))
      return o.toString();

      return null;





      My Client Side app



      var conn = new WebSocket('ws://<IP_ADRESSE>:8080/<PATH>/signalisation/'+c);
      conn.onopen = function ()
      console.log("Connected to the server");
      ;


      My actual result is :



      client.js:11 Mixed Content: The page at 'https://IP_ADRESSE:PORT/?user=blabla' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://IP_ADRESSE:8080/PATH/signalisation/blabla'. This request has been blocked; this endpoint must be available over WSS.










      share|improve this question














      I'm setting up a new webSocket server using Java, and want to expose it in WSS because my client side app is in HTTPS. Could you help me please



      I've tried to modify my web.xml but dosen't work



      <web-app>
      <display-name>Archetype Created Web Application</display-name>
      <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>
      <!-- https -->
      <user-data-constraint>
      <transport-guarantee>CONFIDENTIAL</transport-guarantee>
      </user-data-constraint>
      </security-constraint>
      </web-app>


      This is my EndPoint Class



      @ServerEndpoint(value = "/signalisation/username", decoders = MessageDecoder.class, encoders = MessageEncoder.class)
      public class ChatEndpoint
      private Session session;
      private static final Set<ChatEndpoint> chatEndpoints = new CopyOnWriteArraySet<>();
      private static HashMap<String, String> users = new HashMap<>();

      @OnOpen
      public void onOpen(Session session, @PathParam("username") String username) throws IOException, EncodeException
      System.out.println("connected");
      this.session = session;
      chatEndpoints.add(this);
      users.put(session.getId(), username);

      Message message = new Message();
      message.setFrom(username);
      message.setContent("Connected!");
      broadcast(message, message.getTo());


      @OnMessage
      public void onMessage(Session session, Message message) throws IOException, EncodeException
      message.setFrom(users.get(session.getId()));
      System.out.println("messaged");



      @OnClose
      public void onClose(Session session) throws IOException, EncodeException
      System.out.println("out");


      @OnError
      public void onError(Session session, Throwable throwable)
      // Do error handling here


      private static void broadcast(Message message, String id) throws IOException, EncodeException
      chatEndpoints.forEach(endpoint ->
      if (endpoint.session.getId().equals(id))
      synchronized (endpoint) EncodeException e)
      e.printStackTrace();



      );


      public String getKeyFromMap(HashMap map, String value)

      for (Object o : map.keySet())
      if (map.get(o).equals(value))
      return o.toString();

      return null;





      My Client Side app



      var conn = new WebSocket('ws://<IP_ADRESSE>:8080/<PATH>/signalisation/'+c);
      conn.onopen = function ()
      console.log("Connected to the server");
      ;


      My actual result is :



      client.js:11 Mixed Content: The page at 'https://IP_ADRESSE:PORT/?user=blabla' was loaded over HTTPS, but attempted to connect to the insecure WebSocket endpoint 'ws://IP_ADRESSE:8080/PATH/signalisation/blabla'. This request has been blocked; this endpoint must be available over WSS.







      java websocket jboss java-websocket






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Mar 26 at 11:48









      Hello EarthHello Earth

      623 bronze badges




      623 bronze badges






















          0






          active

          oldest

          votes










          Your Answer






          StackExchange.ifUsing("editor", function ()
          StackExchange.using("externalEditor", function ()
          StackExchange.using("snippets", function ()
          StackExchange.snippets.init();
          );
          );
          , "code-snippets");

          StackExchange.ready(function()
          var channelOptions =
          tags: "".split(" "),
          id: "1"
          ;
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function()
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled)
          StackExchange.using("snippets", function()
          createEditor();
          );

          else
          createEditor();

          );

          function createEditor()
          StackExchange.prepareEditor(
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader:
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          ,
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          );



          );













          draft saved

          draft discarded


















          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55356412%2fhow-to-expose-wss-secure-websocket-with-java%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown

























          0






          active

          oldest

          votes








          0






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes




          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.







          Is this question similar to what you get asked at work? Learn more about asking and sharing private information with your coworkers using Stack Overflow for Teams.



















          draft saved

          draft discarded
















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid


          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.

          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function ()
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55356412%2fhow-to-expose-wss-secure-websocket-with-java%23new-answer', 'question_page');

          );

          Post as a guest















          Required, but never shown





















































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown

































          Required, but never shown














          Required, but never shown












          Required, but never shown







          Required, but never shown







          Popular posts from this blog

          SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

          용인 삼성생명 블루밍스 목차 통계 역대 감독 선수단 응원단 경기장 같이 보기 외부 링크 둘러보기 메뉴samsungblueminx.comeh선수 명단용인 삼성생명 블루밍스용인 삼성생명 블루밍스ehsamsungblueminx.comeheheheh

          155 수학 과학 기타 둘러보기 메뉴eh추가해eh문서를 완성해