Hey, i’m literally 3 weeks in Java community transitioning from PHP. I 
experience problem with configuring Jetty server to run WebAppContext with 
WebSocketHandler. I tried to add WebSocketHandler to WebAppContext as parent 
handler, bind two handlers via HandlerCollection, but i clearly do something 
wrong. Here is my default WebAppContext configuration:

public static void main(String[] args) throws Exception
{
        ServerConnector connector = new ServerConnector(server);
        connector.setPort(8080);
        server.addConnector(connector);

        WebAppContext context = new WebAppContext("webapp", "/");

        // Setting up browser caching. Binds params for 
org.eclipse.jetty.servlet.DefaultServlet.init()
        context.getInitParams().put("org.eclipse.jetty.servlet.Default.etags", 
"true");
        
context.getInitParams().put("org.eclipse.jetty.servlet.Default.cacheControl", 
"public, max-age=0");

        // Will throw an exception when will be unable to start server for some 
reason
        context.setThrowUnavailableOnStartupException(true);

        server.setHandler(context);

        server.start();
        server.join();
}

My goal is to add web socket support. May be to some /ws address, but on same 
port as main instance. Which options do I have? 
_______________________________________________
jetty-users mailing list
[email protected]
To change your delivery options, retrieve your password, or unsubscribe from 
this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to