File tree Expand file tree Collapse file tree 7 files changed +79
-0
lines changed
websocket-vs-rest-payload
java/org/javaee7/websocket/websocket/vs/rest/payload Expand file tree Collapse file tree 7 files changed +79
-0
lines changed Original file line number Diff line number Diff line change 4444 <module >websocket-client-programmatic-encoders</module >
4545 <module >whiteboard</module >
4646 <module >endpoint-singleton</module >
47+ <module >websocket-vs-rest-payload</module >
4748 </modules >
4849</project >
Original file line number Diff line number Diff line change 1+ <project xmlns =" http://maven.apache.org/POM/4.0.0" xmlns : xsi =" http://www.w3.org/2001/XMLSchema-instance"
2+ xsi : schemaLocation =" http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd" >
3+ <modelVersion >4.0.0</modelVersion >
4+ <parent >
5+ <groupId >org.javaee7.websocket</groupId >
6+ <artifactId >websocket-samples</artifactId >
7+ <version >1.0-SNAPSHOT</version >
8+ <relativePath >../pom.xml</relativePath >
9+ </parent >
10+
11+ <artifactId >websocket-vs-rest-payload</artifactId >
12+ <packaging >war</packaging >
13+ </project >
Original file line number Diff line number Diff line change 1+ package org .javaee7 .websocket .websocket .vs .rest .payload ;
2+
3+ import javax .ws .rs .core .Application ;
4+
5+ /**
6+ * @author Arun Gupta
7+ */
8+ @ javax .ws .rs .ApplicationPath ("webresources" )
9+ public class ApplicationConfig extends Application {
10+ }
Original file line number Diff line number Diff line change 1+ package org .javaee7 .websocket .websocket .vs .rest .payload ;
2+
3+ import javax .ws .rs .Consumes ;
4+ import javax .ws .rs .POST ;
5+ import javax .ws .rs .Path ;
6+ import javax .ws .rs .Produces ;
7+
8+ /**
9+ * REST Web Service
10+ *
11+ * @author Arun Gupta
12+ */
13+ @ Path ("rest" )
14+ public class MyRestEndpoint {
15+
16+ @ POST
17+ @ Consumes ("text/plain" )
18+ @ Produces ("text/plain" )
19+ public String getXml (String payload ) {
20+ return payload ;
21+ }
22+ }
Original file line number Diff line number Diff line change 1+ package org .javaee7 .websocket .websocket .vs .rest .payload ;
2+
3+ import javax .websocket .OnMessage ;
4+ import javax .websocket .server .ServerEndpoint ;
5+
6+ /**
7+ * @author Arun Gupta
8+ */
9+ @ ServerEndpoint ("/websocket" )
10+ public class MyWebSocketEndpoint {
11+
12+ @ OnMessage
13+ public String echoText (String text ) {
14+ return text ;
15+ }
16+ }
Original file line number Diff line number Diff line change 1+ <%@page contentType =" text/html" pageEncoding =" UTF-8" %>
2+ <!DOCTYPE html>
3+ <html >
4+ <head >
5+ <meta http-equiv =" Content-Type" content =" text/html; charset=UTF-8" >
6+ <title >REST vs WebSocket - Payload</title >
7+
8+ </head >
9+ <body >
10+ <link rel =" stylesheet" href =" stylesheet.css" type =" text/css" >
11+ <h1 >REST vs WebSocket - Payload</h1 >
12+
13+ Use Adavanced REST Client extension to send requests.<br >
14+ Capture REST/HTTP headers using the extension.<br >
15+ Capture WebSocket headers using Wireshark.
16+ </body >
17+ </html >
You can’t perform that action at this time.
0 commit comments