This was answered on stackoverflow ...
http://stackoverflow.com/questions/15646213/how-do-i-access-instantiated-websockets-in-jetty-9/15649791#15649791
In short, look into the WebSocketCreator concept.
Note, the WebSocketCreator is a Jetty concept. This ability is not present
on the JSR-356 standard.
--
Joakim Erdfelt <joakim@xxxxxxxxxxx>
webtide.com <http://www.webtide.com/>
Developer advice, services and support
from the Jetty & CometD experts
eclipse.org/jetty - cometd.org
On Wed, Jun 5, 2013 at 9:56 AM, Max Kington <mkington@xxxxxxxxxxxxx> wrote:
Hi Folks,
I was reading the design thread with interest and look forward to
getting my mits onto 9.1. I have a couple of questions, the design
ethos behind them now start to make more obvious sense after reading the
design thread.
I have a Simple server:
Server server = new Server(serverPort);
ServletHandler sh = new ServletHandler();
server.setHandler(sh);
sh.addServletWithMapping(MyServlet.class, "/*");
server.start();
With a simple servlet in turn:
public class MyServlet extends WebSocketServlet{
@Override
public void configure(WebSocketServletFactory factory) {
factory.register(ConnectionHandler.class);
}
and a connection handler:
public class ConnectionHandler implements WebSocketListener {
etc
I understand the desire to ensure the thread safety of the servlet and
the connection handler however, it makes obtaining shared resources
inside the connection handler if not tricky, certainly inelegant. I
have a set of message processors which exist to handle the messages all
of which are threadsafe and consume a number of other components, to
actually do what the client needs me to. What I need to do is inject
them somehow into my ConnectionHandler. I can certainly use some
synchrnoized static factories to achieve this but that's pretty bone.
Is there another interface (configurable? context? Servers love a
"context" interface) that I can have connection handler implement to be
able to pass in some of the *stuff* it needs? Do I need to start
looking at creating my own WebSocketServletFactory or WebSocketServlet?
Trawling through the code that looks all closer to the knuckle than I
need to be. FWIW I am "sprung".
Cheers,
Max
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users
_______________________________________________
jetty-users mailing list
jetty-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/jetty-users