users@grizzly.java.net

getting started

From: Mark Volkmann <mark_at_ociweb.com>
Date: Fri, 13 Nov 2009 07:50:39 -0800 (PST)

I'm having a little trouble getting started. I want a server that serves up
static content from the directory "docroot" AND supports a servlet. In the
code below, if I don't register the servlet then static content works fine.
http://localhost:8080/ will bring up index.html from the docroot directory.
However, if I register the servlet, that no longer works. The servlet does
though. http://localhost:8080/mine will display output from the servlet.
What am I doing wrong?

Also, it says that addGrizzlyAdapter is deprecated, but I can't figure out
what to replace that with.

package com.ociweb.grizzly;

import com.sun.grizzly.http.embed.GrizzlyWebServer;
import com.sun.grizzly.http.servlet.ServletAdapter;
import java.io.IOException;

public class Main {

    public static void main(String[] args) {
        GrizzlyWebServer ws = new GrizzlyWebServer("docroot");
        try {
            ServletAdapter sa = new ServletAdapter();
            sa.setServletInstance(new MyServlet());
            sa.setContextPath("/mine");
            ws.addGrizzlyAdapter(sa);
            ws.start();
        } catch (IOException e){
            System.err.println(e);
        }
    }
}
-- 
View this message in context: http://old.nabble.com/getting-started-tp26338722p26338722.html
Sent from the Grizzly - Users mailing list archive at Nabble.com.