users@grizzly.java.net

Re: [ANN] Multiple GrizlzlyAdapter with efficient mapping now available.

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Tue, 04 Nov 2008 22:52:47 -0500

And BTW, this is not tied to the ServletAdapter. CometAdapter,
CometdAdapter, StaticResourceAdapter can all be added and mapped
properly :-) .. and GrizzlyAdapter will works :-)

-- Jeanfrancois

Jeanfrancois Arcand wrote:
> Salut,
>
> FYI I've added the Grizzly's Mapper support to the http module. The
> result is that you can now embed multiple GrizzlyAdapter, and the
> request will be directly delivered to the mapped Adapter. Before,
> GrizzlyAdapter were serially invoked and extra works where needed (for
> compatibility reason, the serial invokation are still supported bug
> deprecated). Now you can do something as simple as:
>
>> GrizzlyWebServer ws = new GrizzlyWebServer(path);
>> ServletAdapter sa = new ServletAdapter();
>> sa.setRootFolder(".");
>> sa.setServletInstance(new ServletTest("Adapter-1"));
>> ws.addGrizzlyAdapter(sa, new String[]{"/Adapter-1"});
>>
>> ServletAdapter sa2 = new ServletAdapter();
>> sa2.setRootFolder("/tmp");
>> sa2.setServletInstance(new ServletTest("Adapter-2"));
>> ws.addGrizzlyAdapter(sa2, new String[]{"/Adapter-2"});
>> ws.start();
>
> The new API can be browsed here:
>
> https://grizzly.dev.java.net/nonav/apidocs/com/sun/grizzly/http/embed/GrizzlyWebServer.html
>
>
> The example above just demonstrate how to programatically create a
> WebServer that support two Servlet. Request are mapped to the proper
> GrizzlyAdapter via the mapping String array. Hence request to:
>
> http://host:port/Adapter-1 will map Adapter "sa"
> http://host:port/Adapter-2 will map Adapter "sa2"
>
> More information about this mechanism can be found here (old blog but
> still works)
>
> http://weblogs.java.net/blog/jfarcand/archive/2008/07/extending_the_g.html
>
> Feedback appreciated :-)
>
> A+
>
> --Jeanfrancois
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>