I’ve implemented a small web-sockets server using jetty, embedded in a larger java application. The server is running on 8081 port, and everything works ok(tested with a small client , in google chrome). However if I try to access the http://localhost:8081 (yes with http) I receive an 404 error, powered by jetty.
Is there a way in jetty to detect if the received format is based on websockets format and if not(in our case http) to just close the socket connection and never return the 404 error?
Thanks
You can do this yourself, but I don’t think there’s anything packaged with Jetty to do it.
If you’re using the
WebSocketServlet, then you should override theservicemethod, to be something likeIf you’ve rolled your own handler, then you should be able to work out how to adapt that code to your needs.