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;
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
add a comment |
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
add a comment |
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
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
java websocket jboss java-websocket
asked Mar 26 at 11:48
Hello EarthHello Earth
623 bronze badges
623 bronze badges
add a comment |
add a comment |
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
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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.
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.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
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
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
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