Which version of Jetty 9.0.0? -- Joakim Erdfelt <[email protected]> webtide.com <http://www.webtide.com/> Developer advice, services and support from the Jetty & CometD experts eclipse.org/jetty - cometd.org
On Mon, Mar 4, 2013 at 1:07 PM, Alex <[email protected]> wrote: > Hi, > > I have a very basic question. > > I managed to write a HttpServer with Jetty8. Now I am trying to write a > WebSocket with Jetty 9. I followed the tutorial for creating a > WebSocket-Server using WebSocketServlet and WebSocketAdapter. But when I do > the echo-Test with websocket.org/echo.html, I don't get the response,only > CONNECTED and SENT: message. What do I need add to my classes, so that it > works? > > Thanks for your help > > Alex > > My classes are: > > public class MyWebSocketServlet extends WebSocketServlet { > public void configure(WebSocketServletFactory factory) { > factory.register(MyWebSocket.class); > } > } > > public class MyWebSocket extends WebSocketAdapter{ > public void onWebSocketText(String message) { > if (isNotConnected()) { > return; } > try{ > this.session.getRemote().sendString("You sent: "+message); > } > catch (IOException e) > { > e.printStackTrace(); > } > } > > } > > public class MyServer { > public static void main(String[] args) throws Exception { > Server server = new Server(8050); > ServletContextHandler context = new > ServletContextHandler(ServletContextHandler.SESSIONS); > server.setHandler(context); > context.addServlet(new ServletHolder(new > MyWebSocketServlet()),"/*"); > > server.start(); > server.join(); > } > } > > > > > _______________________________________________ > jetty-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/jetty-users > >
_______________________________________________ jetty-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/jetty-users
