You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@commons.apache.org by Sgarlata Matt <sg...@bah.com> on 2003/09/28 23:28:56 UTC

[Chain] ChainServlet first draft

Attached is a first cut at creating a ChainServlet.  Committers, please feel
free to add this to CVS (you'll need to add the license, version #s, and
change the package declaration), to modify it, or to tell me what to do to
modify it (and I will do so).

Craig, you mentioned something about merging or inheriting catalog
definitions earlier.  I think this is a property that automatically emerges
from how you set up the ConfigRuleSet.  I take advantage of this behavior in
the ChainServlet.  The ChainServlet reads an XML file and stores a Catalog
in a servlet context attribute.  If there is already a catalog there, the
two catalogs are merged.  If the two catalogs have commands with the same
name, the command from the new catalog takes the place of the command that
was in the old catalog.

One note that is not in the javadoc is that you can set up multiple chain
servlets if you have multiple catalogs.  Perhaps this would be better in the
package documentation for whatever package the ChainServlet ends up in?

Finally, some code was copied from ConfigParser, so I put Craig in the
@author list.

Matt

Re: [Chain] ChainServlet first draft

Posted by "Craig R. McClanahan" <cr...@apache.org>.
Ted Husted wrote:

> Sgarlata Matt wrote:
> >>Attached is a first cut at creating a ChainServlet.  Committers,
> > please feel
> >>free to add this to CVS (you'll need to add the license, version #s,
> >>and change the package declaration), to modify it, or to tell me what
> >>to do to modify it (and I will do so).
>
> Can we change it to look for the catalog as a resource on the 
> classpath, instead of under the file root? Since the Catalog is a 
> business layer component, it may often be maintained as part of the 
> business classes, and may even be distributed in a JAR. [At least mine 
> is :)]

I think both options would be helpful -- enough Struts users are 
confused about where to put application resources files that we should 
probably support either.

>
> Other than that, I've it up and running now in my application now.
>
> I put it in a package under web/servlet/config. Does that sound 
> reasonable?
>
> I also added a static to the Catalog interface to provide a convenient 
> standard for the Catalog attribute name. This will help keep various 
> concrete implementations on the same page.


In addition to ChainServlet, I've also got a ChainListener (implements 
ServletContextListener, for Servlet 2.3 or later systems) that scans all 
the JAR files in WEB-INF/lib for "META-INF/chain-config.xml" files and 
processes them automatically -- pretty much the same way that a 
container automatically recognizes TLD files in JARs.  With this, you 
can just drop in a JAR with the appropriate config and all your commands 
get recognized.  It'll get committed as soon as I build a test case for 
it, but that's the reason for the "servlet23.present" flag in the 
build.xml I checked in last night.

If anyone needs motivation to step up to a Servlet 2.3 or later 
container, consider this a push in the right direction :-).

>
> -Ted.

Craig



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Chain] ChainServlet first draft

Posted by "Craig R. McClanahan" <cr...@apache.org>.
Ted Husted wrote:

> Sgarlata Matt wrote:
> >>Attached is a first cut at creating a ChainServlet.  Committers,
> > please feel
> >>free to add this to CVS (you'll need to add the license, version #s,
> >>and change the package declaration), to modify it, or to tell me what
> >>to do to modify it (and I will do so).
>
> Can we change it to look for the catalog as a resource on the 
> classpath, instead of under the file root? Since the Catalog is a 
> business layer component, it may often be maintained as part of the 
> business classes, and may even be distributed in a JAR. [At least mine 
> is :)]

I think both options would be helpful -- enough Struts users are 
confused about where to put application resources files that we should 
probably support either.

>
> Other than that, I've it up and running now in my application now.
>
> I put it in a package under web/servlet/config. Does that sound 
> reasonable?
>
> I also added a static to the Catalog interface to provide a convenient 
> standard for the Catalog attribute name. This will help keep various 
> concrete implementations on the same page.


In addition to ChainServlet, I've also got a ChainListener (implements 
ServletContextListener, for Servlet 2.3 or later systems) that scans all 
the JAR files in WEB-INF/lib for "META-INF/chain-config.xml" files and 
processes them automatically -- pretty much the same way that a 
container automatically recognizes TLD files in JARs.  With this, you 
can just drop in a JAR with the appropriate config and all your commands 
get recognized.  It'll get committed as soon as I build a test case for 
it, but that's the reason for the "servlet23.present" flag in the 
build.xml I checked in last night.

If anyone needs motivation to step up to a Servlet 2.3 or later 
container, consider this a push in the right direction :-).

>
> -Ted.

Craig



Re: [Chain] ChainServlet first draft

Posted by Ted Husted <hu...@apache.org>.
Sgarlata Matt wrote:
 >>Attached is a first cut at creating a ChainServlet.  Committers,
 > please feel
 >>free to add this to CVS (you'll need to add the license, version #s,
 >>and change the package declaration), to modify it, or to tell me what
 >>to do to modify it (and I will do so).

Can we change it to look for the catalog as a resource on the classpath, 
instead of under the file root? Since the Catalog is a business layer 
component, it may often be maintained as part of the business classes, 
and may even be distributed in a JAR. [At least mine is :)]

Other than that, I've it up and running now in my application now.

I put it in a package under web/servlet/config. Does that sound reasonable?

I also added a static to the Catalog interface to provide a convenient 
standard for the Catalog attribute name. This will help keep various 
concrete implementations on the same page.

-Ted.




Re: [Chain] ChainServlet first draft

Posted by Ted Husted <hu...@apache.org>.
Sgarlata Matt wrote:
 >>Attached is a first cut at creating a ChainServlet.  Committers,
 > please feel
 >>free to add this to CVS (you'll need to add the license, version #s,
 >>and change the package declaration), to modify it, or to tell me what
 >>to do to modify it (and I will do so).

Can we change it to look for the catalog as a resource on the classpath, 
instead of under the file root? Since the Catalog is a business layer 
component, it may often be maintained as part of the business classes, 
and may even be distributed in a JAR. [At least mine is :)]

Other than that, I've it up and running now in my application now.

I put it in a package under web/servlet/config. Does that sound reasonable?

I also added a static to the Catalog interface to provide a convenient 
standard for the Catalog attribute name. This will help keep various 
concrete implementations on the same page.

-Ted.




---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Chain] ChainServlet first draft

Posted by Ted Husted <hu...@apache.org>.
I can try this tomorrow, and look at the other patches as well.

In the future, the thing to do in the future is to attach the file to a 
Bugzilla ticket as an enhancement request. It's also helpful to include 
the license <http://apache.org/LICENSE> so that your intentions are 
crystal clear and so that your contribution is as ready to commit as you 
can possibly make it. If you don't have a Contributor's License 
Agreement on file with the ASF,

http://jakarta.apache.org/site/agreement.html

you should do that, and let us know.

-Ted.

Sgarlata Matt wrote:

> Hmm, looks like the list doesn't like .java.  Trying to attach as .zip...
> ----- Original Message ----- 
> From: "Sgarlata Matt" <sg...@bah.com>
> To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> Sent: Sunday, September 28, 2003 5:28 PM
> Subject: [Chain] ChainServlet first draft
> 
> 
> 
>>Attached is a first cut at creating a ChainServlet.  Committers, please
> 
> feel
> 
>>free to add this to CVS (you'll need to add the license, version #s, and
>>change the package declaration), to modify it, or to tell me what to do to
>>modify it (and I will do so).
>>
>>Craig, you mentioned something about merging or inheriting catalog
>>definitions earlier.  I think this is a property that automatically
> 
> emerges
> 
>>from how you set up the ConfigRuleSet.  I take advantage of this behavior
> 
> in
> 
>>the ChainServlet.  The ChainServlet reads an XML file and stores a Catalog
>>in a servlet context attribute.  If there is already a catalog there, the
>>two catalogs are merged.  If the two catalogs have commands with the same
>>name, the command from the new catalog takes the place of the command that
>>was in the old catalog.
>>
>>One note that is not in the javadoc is that you can set up multiple chain
>>servlets if you have multiple catalogs.  Perhaps this would be better in
> 
> the
> 
>>package documentation for whatever package the ChainServlet ends up in?
>>
>>Finally, some code was copied from ConfigParser, so I put Craig in the
>>@author list.
>>
>>Matt
>>
>>
> 
> 
> 
> ----------------------------------------------------------------------------
> ----
> 
> 
> 
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>>
>>------------------------------------------------------------------------
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-dev-help@jakarta.apache.org

-- 
Ted Husted,
   Junit in Action  - <http://www.manning.com/massol/>,
   Struts in Action - <http://husted.com/struts/book.html>,
   JSP Site Design  - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.

"Get Ready, We're Moving Out!!" - <http://www.clark04.com>



---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Re: [Chain] ChainServlet first draft

Posted by Ted Husted <hu...@apache.org>.
I can try this tomorrow, and look at the other patches as well.

In the future, the thing to do in the future is to attach the file to a 
Bugzilla ticket as an enhancement request. It's also helpful to include 
the license <http://apache.org/LICENSE> so that your intentions are 
crystal clear and so that your contribution is as ready to commit as you 
can possibly make it. If you don't have a Contributor's License 
Agreement on file with the ASF,

http://jakarta.apache.org/site/agreement.html

you should do that, and let us know.

-Ted.

Sgarlata Matt wrote:

> Hmm, looks like the list doesn't like .java.  Trying to attach as .zip...
> ----- Original Message ----- 
> From: "Sgarlata Matt" <sg...@bah.com>
> To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
> Sent: Sunday, September 28, 2003 5:28 PM
> Subject: [Chain] ChainServlet first draft
> 
> 
> 
>>Attached is a first cut at creating a ChainServlet.  Committers, please
> 
> feel
> 
>>free to add this to CVS (you'll need to add the license, version #s, and
>>change the package declaration), to modify it, or to tell me what to do to
>>modify it (and I will do so).
>>
>>Craig, you mentioned something about merging or inheriting catalog
>>definitions earlier.  I think this is a property that automatically
> 
> emerges
> 
>>from how you set up the ConfigRuleSet.  I take advantage of this behavior
> 
> in
> 
>>the ChainServlet.  The ChainServlet reads an XML file and stores a Catalog
>>in a servlet context attribute.  If there is already a catalog there, the
>>two catalogs are merged.  If the two catalogs have commands with the same
>>name, the command from the new catalog takes the place of the command that
>>was in the old catalog.
>>
>>One note that is not in the javadoc is that you can set up multiple chain
>>servlets if you have multiple catalogs.  Perhaps this would be better in
> 
> the
> 
>>package documentation for whatever package the ChainServlet ends up in?
>>
>>Finally, some code was copied from ConfigParser, so I put Craig in the
>>@author list.
>>
>>Matt
>>
>>
> 
> 
> 
> ----------------------------------------------------------------------------
> ----
> 
> 
> 
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-dev-help@jakarta.apache.org
>>
>>
>>------------------------------------------------------------------------
>>
>>---------------------------------------------------------------------
>>To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
>>For additional commands, e-mail: commons-dev-help@jakarta.apache.org

-- 
Ted Husted,
   Junit in Action  - <http://www.manning.com/massol/>,
   Struts in Action - <http://husted.com/struts/book.html>,
   JSP Site Design  - <http://www.amazon.com/exec/obidos/ISBN=1861005512>.

"Get Ready, We're Moving Out!!" - <http://www.clark04.com>



Re: [Chain] ChainServlet first draft

Posted by Sgarlata Matt <sg...@bah.com>.
Hmm, looks like the list doesn't like .java.  Trying to attach as .zip...
----- Original Message ----- 
From: "Sgarlata Matt" <sg...@bah.com>
To: "Jakarta Commons Developers List" <co...@jakarta.apache.org>
Sent: Sunday, September 28, 2003 5:28 PM
Subject: [Chain] ChainServlet first draft


> Attached is a first cut at creating a ChainServlet.  Committers, please
feel
> free to add this to CVS (you'll need to add the license, version #s, and
> change the package declaration), to modify it, or to tell me what to do to
> modify it (and I will do so).
>
> Craig, you mentioned something about merging or inheriting catalog
> definitions earlier.  I think this is a property that automatically
emerges
> from how you set up the ConfigRuleSet.  I take advantage of this behavior
in
> the ChainServlet.  The ChainServlet reads an XML file and stores a Catalog
> in a servlet context attribute.  If there is already a catalog there, the
> two catalogs are merged.  If the two catalogs have commands with the same
> name, the command from the new catalog takes the place of the command that
> was in the old catalog.
>
> One note that is not in the javadoc is that you can set up multiple chain
> servlets if you have multiple catalogs.  Perhaps this would be better in
the
> package documentation for whatever package the ChainServlet ends up in?
>
> Finally, some code was copied from ConfigParser, so I put Craig in the
> @author list.
>
> Matt
>
>


----------------------------------------------------------------------------
----


> ---------------------------------------------------------------------
> To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
> For additional commands, e-mail: commons-dev-help@jakarta.apache.org