-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Showing
6 changed files
with
93 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
38 changes: 38 additions & 0 deletions
38
integration-tests/main/src/main/java/io/quarkus/it/websocket/AddWebSocketHandler.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
package io.quarkus.it.websocket; | ||
|
||
import javax.enterprise.inject.spi.DeploymentException; | ||
import javax.servlet.ServletContextEvent; | ||
import javax.servlet.ServletContextListener; | ||
import javax.servlet.annotation.WebListener; | ||
import javax.websocket.Endpoint; | ||
import javax.websocket.EndpointConfig; | ||
import javax.websocket.Session; | ||
import javax.websocket.server.ServerContainer; | ||
import javax.websocket.server.ServerEndpointConfig; | ||
|
||
@WebListener | ||
public class AddWebSocketHandler implements ServletContextListener { | ||
@Override | ||
public void contextDestroyed(ServletContextEvent sce) { | ||
} | ||
|
||
@Override | ||
public void contextInitialized(ServletContextEvent sce) { | ||
try { | ||
((ServerContainer) sce.getServletContext().getAttribute(ServerContainer.class.getName())) | ||
.addEndpoint(ServerEndpointConfig.Builder.create(WebsockEndpoint.class, "/added-dynamic").build()); | ||
|
||
} catch (DeploymentException | javax.websocket.DeploymentException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
|
||
public static class WebsockEndpoint extends Endpoint { | ||
|
||
@Override | ||
public void onOpen(Session session, EndpointConfig config) { | ||
session.getAsyncRemote().sendText("DYNAMIC"); | ||
} | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters