Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Clean up websocket hard coded ports and servlet URLs #311

Merged
merged 6 commits into from
Jun 24, 2015
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 25 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -872,8 +872,32 @@
<groupId>org.jboss.arquillian.container</groupId>
<artifactId>arquillian-wlp-managed-8.5</artifactId>
<version>1.0.0.Beta2</version>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-client</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish</groupId>
<artifactId>javax.json</artifactId>
<version>1.0.4</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.glassfish.tyrus</groupId>
<artifactId>tyrus-container-grizzly-client</artifactId>
<version>1.3</version>
<scope>test</scope>
</dependency>
</dependencies>
<dependency>
<groupId>org.glassfish.jersey.core</groupId>
<artifactId>jersey-client</artifactId>
<version>2.4</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,13 @@ public void setup() {

@Test
public void testGet() throws IOException, SAXException {
TextPage page = webClient.getPage(base + "/TestServlet");
TextPage page = webClient.getPage(base + "TestServlet");
assertEquals("my GET", page.getContent());
}

@Test
public void testPost() throws IOException, SAXException {
WebRequest request = new WebRequest(new URL(base + "/TestServlet"), HttpMethod.POST);
WebRequest request = new WebRequest(new URL(base + "TestServlet"), HttpMethod.POST);
TextPage page = webClient.getPage(request);
assertEquals("my POST", page.getContent());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ public void setup() {

@Test
public void testGet() throws IOException, SAXException {
TextPage page = webClient.getPage(base + "/SimpleServlet");
TextPage page = webClient.getPage(base + "SimpleServlet");
assertEquals("my GET", page.getContent());
}

@Test
public void testPost() throws IOException, SAXException {
WebRequest request = new WebRequest(new URL(base + "/SimpleServlet"), HttpMethod.POST);
WebRequest request = new WebRequest(new URL(base + "SimpleServlet"), HttpMethod.POST);
TextPage page = webClient.getPage(request);
assertEquals("my POST", page.getContent());
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
out.println("<h1>Servlet TestServlet at " + request.getContextPath() + "</h1>");

WebSocketContainer container = ContainerProvider.getWebSocketContainer();
String uri = "ws://localhost:8080" + request.getContextPath() + "/websocket";
String uri = "ws://localhost:" + request.getLocalPort() + request.getContextPath() + "/websocket";
out.println("Connecting to " + uri);
container.connectToServer(MyClient.class, URI.create(uri));
out.println("<br><br>Look in server.log for log messages from message exchange between client/server.");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
out.println("<h1>Servlet TestServlet at " + request.getContextPath() + "</h1>");

WebSocketContainer container = ContainerProvider.getWebSocketContainer();
String uri = "ws://localhost:8080" + request.getContextPath() + "/websocket";
String uri = "ws://localhost:" + request.getLocalPort() + request.getContextPath() + "/websocket";
out.println("Connecting to " + uri);
container.connectToServer(MyClient.class,
ClientEndpointConfig.Builder.create().configurator(new MyConfigurator()).build(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
decoders.add(MyMessageDecoder.class);

WebSocketContainer container = ContainerProvider.getWebSocketContainer();
String uri = "ws://localhost:8080" + request.getContextPath() + "/websocket";
String uri = "ws://localhost:" + request.getLocalPort() + request.getContextPath() + "/websocket";
out.println("Connecting to " + uri);
container.connectToServer(MyClient.class,
ClientEndpointConfig.Builder.create()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
out.println("<h1>Servlet TestServlet at " + request.getContextPath() + "</h1>");

WebSocketContainer container = ContainerProvider.getWebSocketContainer();
String uri = "ws://localhost:8080" + request.getContextPath() + "/websocket";
String uri = "ws://localhost:" + request.getLocalPort() + request.getContextPath() + "/websocket";
out.println("Connecting to " + uri);
container.connectToServer(MyClient.class,
null,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ protected void processRequest(HttpServletRequest request, HttpServletResponse re
out.println("<h1>Servlet TestServlet at " + request.getContextPath() + "</h1>");

WebSocketContainer container = ContainerProvider.getWebSocketContainer();
String uri = "ws://localhost:8080" + request.getContextPath() + "/websocket";
String uri = "ws://localhost:" + request.getLocalPort() + request.getContextPath() + "/websocket";
out.println("Connecting to " + uri);
container.connectToServer(MyClient.class, URI.create(uri));
out.println("<br><br>Look in server.log for log messages from message exchange between client/server.");
Expand Down