dev@grizzly.java.net

Re: Embedding WebAppAdapter was RFC Deployer refactoring

From: Jeanfrancois Arcand <Jeanfrancois.Arcand_at_Sun.COM>
Date: Wed, 16 Sep 2009 15:46:10 -0400

Salut,

Hubert Iwaniuk wrote:
> Hi *,
>
> Excerpt from RFC Deployer Refactoring http://bit.ly/UfgUK
>
>> can it be used embedded easily ?
>>
>> like
>>
>>
>> webAdapter.deploy("xxx/webapp.war"); ?
>
> Not that easy, we can create convenience method like WAA.deploy(...)
>
> So far we have:
> /**
> * Default constructor, takes care of setting up adapter.
> *
> * @param gws Grizzly Web Server to register {_at_link ServletAdapter}s.
> * @param root Root folder, for serving static resources
> * @param context Context to be deployed to.
> * @param webApp Web application to be run by this adapter.
> * @param webAppCL Web application class loader.
> * @param webdefault Default web application.
> */
> public WebAppAdapter(GrizzlyWebServer gws, String root, String
> context, final WebApp webApp, URLClassLoader webAppCL, WebApp
> webdefault)
>
> So what it takes now for embedding is GWS, parsed WebApp, Classloader
> to be used by this WebApp, optional webdefault.
>
> I think this embeddable entry method would have better place in
> GrizzlyWebServerDeployer
> We already have quite some deploy methods there.
>
> As I see WebAppAdapter is to serve welcome-file, hold information on
> what was deployed for particular WebApp (convenience for some
> management interface) and help in un/redeploying. Do you agree on
> that?
>
> Back to GWSD.deploy.
> /**
> * Deploy WAR file.
> *
> * TODO make {_at_link GrizzlyWebServer} a parameter here for easier
> embadability.
> *
> * @param location Location of WAR file.
> * @param context Context to deploy to.
> * @param serverLibLoader Server wide {_at_link ClassLoader}. Optional.
> * @param defaultWebApp webdefault application, get's merged with
> application to deploy. Optional.
> * @throws Exception Duh. TODO refactor Exception handling.
> */
> public void deployWar(
> String location, String context, URLClassLoader
> serverLibLoader, WebApp defaultWebApp) throws Exception {
>
> What do you think of it?

I would like to see WebAppAdapter.deploy(GWS,path_to_war/dir)> Mianly I
would like to be able to do something as simple as:

   WebAppAdapter w = new WebAppAdapter();
   w.deploy("/foo");
   gws.addGrizzlyAdapter(w);

without the needs of the GWSD class. The idea then would consist of
moving the WebAppAdapter under the http-servlet module so people can
really embed and deploy their application programmatically.

What do you think?

Great work BTW!

-- Jeanfrancois




>
> Cheers,
> Hubert.
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: dev-unsubscribe_at_grizzly.dev.java.net
> For additional commands, e-mail: dev-help_at_grizzly.dev.java.net
>