I have been reading up on the WebSocket api and have been playing around with it a little bit but I can not get my head wrapped around a few things. Right now I have a servlet TestServlet
which is defined in web.xml
to trigger the doGet
method every time the URL localhost:TestServlet is put into the URL of a browser.
I want to wait for a connection from a mobile device, the guy building the phone app says they can load my servlet, in which case the doGet
method would trigger and I would do my business with the data received. Only issue is that in the doGet
method I have the request and the response, can I get the data sting sent from the phone from the request?
I also have my @ServerEndpoint
set to /*
which I think means the servlet will be active when a url containing /TestServlet
is loaded. Problem here is I do not see any output from print lines or see any breakpoints hit.
I am just wondering (if this makes any sense) having the @ServerEndpoint
set as @ServerEndpoint(value = "/*") will the method annotated @OnMessage
trigger if a message is there to receive?
If not how can I make it trigger, and if I can not how can I get a data string from an HttpServletRequest?