users@grizzly.java.net

Re: Am I crazy? Yes...

From: Paul.M <paul.mattheis_at_gmail.com>
Date: Tue, 2 Feb 2010 15:19:31 -0800 (PST)

I have this working now... I am not sure about the context, rootPath, etc.
But it works :) I get my static content from /var/www, and cometd from
/cometd/* (Which I think let's the servlet be cometd). It also looks like
the important thing is to get setHandleStaticResources correct on both.

    public static void main(String args[]) {
        try {
            GrizzlyWebServer ws = new GrizzlyWebServer(8080, "/var/www");

            ws.addAsyncFilter(new CometAsyncFilter());
            CometdAdapter cometdAdapter = new CometdAdapter();
            cometdAdapter.setHandleStaticResources(false);
            ws.addGrizzlyAdapter(cometdAdapter, new String [] { "/cometd/*"
});

            GrizzlyAdapter ga = new GrizzlyAdapter() {
                @Override
                public void service(GrizzlyRequest request, GrizzlyResponse
response) {
                    System.out.println(request.getMethod() + " " +
request.getQueryString());
                }
            };
            ga.addRootFolder("/var/www");
            ga.setHandleStaticResources(true);
            ws.addGrizzlyAdapter(ga, new String[]{"/*"});

            ws.start();
        } catch (IOException ex) {
        }
    }

-- 
View this message in context: http://old.nabble.com/Am-I-crazy--Yes...-tp27316206p27429124.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.