When I have a websocket connection, say at \"/ws\"
Will a regular javax.servlet.Filter on the \"/ws\" path intercept each message as a regular http request? Will it
No, Servlet Filter won't catch WebSocket messages.
Servlet does not support WebSocket protocol at all. Only thing you can do is to register HttpUpgradeHandler (see HttpServletRequest#upgrade)and then implement WebSocket protocol on top of that.
Or.. if you want to save some time, take a look at JSR 356 and the implementations, they are working on top of this API. I personally work on Tyrus, which is the reference implementation of JSR 356. (It is part of Java EE 7, but you only need Servlet 3.1 API).
Will it intercept only the first request (as part of the handshake?)
Yes, only the first request, the one that initiates the WebSocket Handshake, is intercepted by the Servlet Filter.