users@grizzly.java.net

Re: Unified ports with Grizzly Servlet container/Glassfish?

From: Oleksiy Stashok <Oleksiy.Stashok_at_Sun.COM>
Date: Fri, 11 Dec 2009 15:30:03 +0100

Hi Greg,

> Will try the user list first since this is a getting started
> question and might be one of configuration.
>
> Using Tomcat right now to host several webapps with one webapp doing
> it's own NIO listener for a custom protocol.
>
> I would like to unify these with Grizzly.
>
> I would like to have just 8080/8081 (or other port pair for clear
> and TLS, but that's the only difference).
>
> 1. Can someone point me to a backgrounder on port unification in
> general -- I'm seeing stuff from years ago rather than more recent
> stuff. https://glassfish.dev.java.net/issues/show_bug.cgi?id=4322
> seems to have reduced this from the "One Port To Rule Them All"
> teaser.
Actually we have port unification implementation for v3, but we didn't
have time to create CLI commands to support it, so PU feature in GFv3
is not official, but still usable.

> 2. If I just want to do HTTP and a non-HTTP protocol with just
> Servlet container support (Tomcat replacement), what would I need to
> do?
You can start from implementing feature you want on Grizzly level,
then you might want to think about GFv3 migration.

> 3. Would #2 be portable to GlassFish v3 with all the clustering,
> load balancing, and other -ings that GF can do.
In future - yes, but so far, AFAIK, GFv3 doesn't have clustering
support.

> 4. I've seen a Jetty+Grizzly out there -- is this the preferred
> melding or should I use just Grizzly?
I think Grizzly is a good point to start, then it's up to you.

> I've looked at the Grizzly site and I don't see anything that matches.
If you're interested in perspective to deploy your app to GFv3 - I'd
recommend to use Grizzly config module, which will let you configure
PortUnification using description file, which is the same with GFv3.
Please take a look at the following sample [1] and configurations [2].
On mentioned sample you'll see how we configure port unification for
HTTP + XProtocol.


In order to use custom servlet - you have to create grizzly
ServletAdapter like:
ServletAdapter adapter = new ServletAdapter();
adapter.setRootFolder("/tmp/hudson");
adapter.setHandleStaticResources(true);
adapter.setContextPath("/hudson");
Servlet servlet = getServlet();
adapter.setServletInstance(servlet);

Then you need to set ServletAdapter:

1) List<GrizzlyServiceListeners> listeners =
grizzlyConfig.getListeners();
2) for each listener do listener.getEmbeddedHttp().setAdapter(...);

If you'll have any question or need more details - let me know.

WBR,
Alexey.

[1] https://grizzly.dev.java.net/source/browse/grizzly/trunk/code/modules/config/src/test/java/com/sun/grizzly/config/PUGrizzlyConfigTest.java?rev=3490&view=markup
[2] https://grizzly.dev.java.net/source/browse/grizzly/trunk/code/modules/config/src/test/resources/


>
> thanks,
> greg
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: users-help_at_grizzly.dev.java.net
>