users@grizzly.java.net

[ANN] http-servlet now support Servlet's Listener

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Fri, 21 Nov 2008 15:11:19 -0500

Salut,

FYI I've added long overdue support for all Servlet's Listener:

https://grizzly.dev.java.net/issues/show_bug.cgi?id=241

As an example, you can now embed the http-servlet's ServletAdapter by doing:

> GrizzlyWebServer ws = new GrizzlyWebServer("/var/www");
> try{
> ServletAdapter sa = new ServletAdapter();
> sa.setRootFolder("/Path/To/Exploded/War/File");
> sa.setServlet(new MyServlet());
>
> // Set the Servlet's Name
> // Any ServletConfig.getXXX method can be configured using this call.
> // The same apply for ServletContext.getXXX.
> sa.setProperty("display-name","myServlet");
> sa.addListener("foo.bar.myHttpSessionListener");
> sa.addContextParameter("databaseURI","jdbc://");
> sa.addInitParameter("password","hello");
> sa.setServletPath("/MyServletPath");
> sa.setContextPath("/myApp");
>
> ws.addGrizzlyAdapter(sa);
>
> ws.start();
> } catch (IOException ex){
> // Something when wrong.
> }

Simple command line usage:

java -jar grizzly-http-servlet-webserver.jar -p 8080 -a myServlet.war
foo.bar.MyServlet


Remaining features (for peoples interested to collaborate):

https://grizzly.dev.java.net/issues/show_bug.cgi?id=242

Of course there is still missing features but I would consider we have a
pretty good implementation for embedding applications.

Contribution are welcome!

-- Jeanfrancois