You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@struts.apache.org by Peter Heller <st...@japache.org> on 2001/12/10 02:36:34 UTC

Struts & Filters (Servlets 2.3)

Will there be a subclass created in struts such as actionFilter ?  

Will the Struts filter be part of web.xml or struts-config.xml?

--
Posted via jApache.org

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Struts & Filters (Servlets 2.3)

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Sun, 9 Dec 2001, Peter Heller wrote:

> Date: Sun, 09 Dec 2001 20:36:34 -0500
> From: Peter Heller <st...@japache.org>
> Reply-To: Struts Developers List <st...@jakarta.apache.org>
> To: struts-dev@jakarta.apache.org
> Subject: Struts & Filters (Servlets 2.3)
>
> Will there be a subclass created in struts such as actionFilter ?
>

See the previous mail for discussion of this.

> Will the Struts filter be part of web.xml or struts-config.xml?
>

Guess I should answer this question as well.

You would certainly need to configure ActionFilter in web.xml, in the same
way that you configure ActionServlet there now.  However, the unique
Struts features that are configured in struts-config.xml don't really have
a place in web.xml right now, so I would assume we'd continue to configure
all of that stuff from struts-config.xml even if the controller was based
on a Filter instead of a Servlet.

You will be interested in the fact that one of the things we are looking
at for Servlet 2.4 (the *next* version of the Servlet API that is being
created under JSR 154) will be considering approaches to making the
web.xml deployment descriptor extensible for things like Struts, or any
other "extension" based on the servlet component model, directly in the
web.xml file.

Craig


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Struts & Filters (Servlets 2.3)

Posted by Arron <ar...@keyboardmonkey.com>.
"Whatever doesn't kill you makes you stronger".

"Whatever doesn't break my build, makes it stronger"... everything else 
in next ++ version.


Arron.


PS. In regards to populating multiple ActionForms.
This is not an issue with... err... nested beans
:p

Ted Husted wrote:

>I'd say that requiring Servlet 2.3 / 1.2 would justify a major version
>increase, and so maybe we should start whiteboarding Struts 2.0 to use a
>Filter instead of a Servlet for the controller. Among others, one thing
>that just came up under the "would've and "should've" heading was
>handling exceptions at the controller level.
>In the heat of development, a few of the attribute and class names ended
>up being a little confusing, like "validate" in the web.xml having
>nothing to do with the validate method ;-) 
>
>My suggestion would be that we put together a design and requirements
>document for Struts 2.0. Work on the Struts 1.x branch would continue,
>and would be used to concept-test any new functionality. For example, we
>can't change the signature to Action.perform in 1.x, but we can easily
>provide a base Action class to handle mapped exceptions.
>
>Where attribute names or class signatures change, we might start looking
>at a upgrade program from the beginning that would ease migration later.
>I strongly believe that the architecture and approach is sound, but with
>the benefit of 20/20 hindsight, there are a number of minor details that
>should be changed.
>
>So to start a Struts 2.0 list 
>
>+ Require Servlet 2.3 / JSP 1.2 
>+ Controller as Filter
>+ Tag extensions as add-ons to JSPTL
>+ PropertyEditor Support
>+ Declarative exceptions handled by Controller
>+ Multiple controllers, multiple configurations
>+ Direct support for Commons Workflow
>+ Direct support for chaining Actions without a forward or redirect
>+ More entry points in class methods for subclassing
>+ Reconsider all class and attribute names, to make the heirarchy more
>accessible to newcomers. 
>
>Another thing that people often up is populating multiple ActionForms.
>I'm not sure what the use case here is, but we should determine if
>that's something we should be doing, or if it is a documentation issue.
>
>Backing an ActionForm with a map to create "dynamic properties" finally
>seems to be addressed with the latest BeanUtils syntax, but we should
>probably visit that issue as well. Perhaps a standard base class so that
>we can better document the approach.
>
>Again, I would suggest that, where practical, we first retrofit Struts
>1.x with any new functionality proposed for Struts 2.x, as a proof of
>concept. In many cases, the Struts 2.x functionality would be superior
>(as in the case of declarative exceptions), but it's important that we
>leverage the existing code base, and get the features "out there" so
>developers can bring back their experiences back to the table. This will
>also help keep us from putting off to 2.0 things we could actually do
>today ;-)
>
>-Ted.
>
>
>"Craig R. McClanahan" wrote:
>
>>I think the question being asked here is "will the Struts controller
>>functionality (currently implemented in ActionServlet) be implemented as a
>>javax.servlet.Filter from the Servlet 2.3 API?"  It's a pretty interesting
>>question.
>>
>>Had the Servlet 2.3 API been available when Struts was originally
>>designed, it's a pretty sure bet that I would have implemented the
>>controller as a Filter instead of as a Servlet.  This would have made
>>possible some interesting approaches to using the Struts controller in
>>front of (or in front of part of) existing applications that are being
>>migrated to Struts, as well as the "multiple controllers per webapp"
>>paradigm that we are currently discussing.
>>
>>However, that's not what happened.  Struts is currently based on the
>>facilities of Servlet 2.2 and JSP 1.1, because that provides support on
>>the very broad range of application servers that support these APIs.  I
>>feel that we ultimately want to migrate to Servlet 2.3 / JSP 1.2 to take
>>advantage of the new facilities -- the quesion is, when?
>>
>>We certainly need to continue to support the ability to run Struts based
>>applications on a Servlet 2.2 / JSP 1.1 platform for the forseeable
>>future.  However, there are many compelling features of the next
>>generation APIs that are worth supporting.  I'd like to see us explore
>>taking advantage of those capabilities by offering enhanced (or
>>alternative) implementations of the basic Struts controller functionality
>>based on the new APIs.
>>
>>What do the other developers think?  Are there enough Servlet 2.3 / JSP
>>1.2 environments available (obviously, I will be using Tomcat 4 for this,
>>since I'm pretty intimiate with its internals :-) to make development
>>*and deployment* of Servlet 2.3 / JSP 1.2 based applications useful, or is
>>it still a little too early?
>>
>>Even if it's too early, we can start exploring those sorts of ideas so
>>that we're ready when the platforms are readily available.
>>
>>Craig
>>
>
>--
>To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
>For additional commands, e-mail: <ma...@jakarta.apache.org>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Struts & Filters (Servlets 2.3)

Posted by Paul Speed <ps...@progeeks.com>.

Ted Husted wrote:
> 
[ snip ]
> 
> So to start a Struts 2.0 list
> 
> + Require Servlet 2.3 / JSP 1.2
> + Controller as Filter
> + Tag extensions as add-ons to JSPTL
> + PropertyEditor Support

What do you envision using PropertyEditors for?

> + Declarative exceptions handled by Controller
> + Multiple controllers, multiple configurations
> + Direct support for Commons Workflow
> + Direct support for chaining Actions without a forward or redirect
> + More entry points in class methods for subclassing
> + Reconsider all class and attribute names, to make the heirarchy more
> accessible to newcomers.
> 
[ snip ]

I could add one:
+ use interfaces and abstract base classes instead of just base 
  classes.

The examples of that one are numerous and the change would make the
framework more flexible.  A standard set of base classes would be
what most people would use but since the framework itself would be
calling the interfaces it allows those of us living on the edge to
write our own base classes.  Living on the edge implies that we'll
just deal with the fact that our code may break with successive
versions.  The change is especially nice for experimenting with
new ideas.

For example, combine that idea with moving BeanUtils type of calls
into the formbean base class and all you'd have to do is create a
new formbean base class for dealing with Map objects.

Anyway, those are the things that popped into my head.
-Paul

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Struts & Filters (Servlets 2.3)

Posted by Ted Husted <hu...@apache.org>.
I'd say that requiring Servlet 2.3 / 1.2 would justify a major version
increase, and so maybe we should start whiteboarding Struts 2.0 to use a
Filter instead of a Servlet for the controller. Among others, one thing
that just came up under the "would've and "should've" heading was
handling exceptions at the controller level.
In the heat of development, a few of the attribute and class names ended
up being a little confusing, like "validate" in the web.xml having
nothing to do with the validate method ;-) 

My suggestion would be that we put together a design and requirements
document for Struts 2.0. Work on the Struts 1.x branch would continue,
and would be used to concept-test any new functionality. For example, we
can't change the signature to Action.perform in 1.x, but we can easily
provide a base Action class to handle mapped exceptions.

Where attribute names or class signatures change, we might start looking
at a upgrade program from the beginning that would ease migration later.
I strongly believe that the architecture and approach is sound, but with
the benefit of 20/20 hindsight, there are a number of minor details that
should be changed.

So to start a Struts 2.0 list 

+ Require Servlet 2.3 / JSP 1.2 
+ Controller as Filter
+ Tag extensions as add-ons to JSPTL
+ PropertyEditor Support
+ Declarative exceptions handled by Controller
+ Multiple controllers, multiple configurations
+ Direct support for Commons Workflow
+ Direct support for chaining Actions without a forward or redirect
+ More entry points in class methods for subclassing
+ Reconsider all class and attribute names, to make the heirarchy more
accessible to newcomers. 

Another thing that people often up is populating multiple ActionForms.
I'm not sure what the use case here is, but we should determine if
that's something we should be doing, or if it is a documentation issue.

Backing an ActionForm with a map to create "dynamic properties" finally
seems to be addressed with the latest BeanUtils syntax, but we should
probably visit that issue as well. Perhaps a standard base class so that
we can better document the approach.

Again, I would suggest that, where practical, we first retrofit Struts
1.x with any new functionality proposed for Struts 2.x, as a proof of
concept. In many cases, the Struts 2.x functionality would be superior
(as in the case of declarative exceptions), but it's important that we
leverage the existing code base, and get the features "out there" so
developers can bring back their experiences back to the table. This will
also help keep us from putting off to 2.0 things we could actually do
today ;-)

-Ted.


"Craig R. McClanahan" wrote:
> 
> I think the question being asked here is "will the Struts controller
> functionality (currently implemented in ActionServlet) be implemented as a
> javax.servlet.Filter from the Servlet 2.3 API?"  It's a pretty interesting
> question.
> 
> Had the Servlet 2.3 API been available when Struts was originally
> designed, it's a pretty sure bet that I would have implemented the
> controller as a Filter instead of as a Servlet.  This would have made
> possible some interesting approaches to using the Struts controller in
> front of (or in front of part of) existing applications that are being
> migrated to Struts, as well as the "multiple controllers per webapp"
> paradigm that we are currently discussing.
> 
> However, that's not what happened.  Struts is currently based on the
> facilities of Servlet 2.2 and JSP 1.1, because that provides support on
> the very broad range of application servers that support these APIs.  I
> feel that we ultimately want to migrate to Servlet 2.3 / JSP 1.2 to take
> advantage of the new facilities -- the quesion is, when?
> 
> We certainly need to continue to support the ability to run Struts based
> applications on a Servlet 2.2 / JSP 1.1 platform for the forseeable
> future.  However, there are many compelling features of the next
> generation APIs that are worth supporting.  I'd like to see us explore
> taking advantage of those capabilities by offering enhanced (or
> alternative) implementations of the basic Struts controller functionality
> based on the new APIs.
> 
> What do the other developers think?  Are there enough Servlet 2.3 / JSP
> 1.2 environments available (obviously, I will be using Tomcat 4 for this,
> since I'm pretty intimiate with its internals :-) to make development
> *and deployment* of Servlet 2.3 / JSP 1.2 based applications useful, or is
> it still a little too early?
> 
> Even if it's too early, we can start exploring those sorts of ideas so
> that we're ready when the platforms are readily available.
> 
> Craig

--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Struts & Filters (Servlets 2.3)

Posted by "Craig R. McClanahan" <cr...@apache.org>.

On Tue, 11 Dec 2001, Donnie Hale wrote:

> Date: Tue, 11 Dec 2001 20:40:41 -0500
> From: Donnie Hale <do...@haleonline.net>
> Reply-To: Struts Developers List <st...@jakarta.apache.org>
> To: Struts Developers List <st...@jakarta.apache.org>
> Subject: RE: Struts & Filters (Servlets 2.3)
>
> Craig,
>
> Could you briefly enumerate the advantages a filter would have over a
> servlet for what ActionServlet *currently* does? I can see how it would be
> useful for certain new features, and I can see how the context lifecycle
> events would be nice to monitor; but I'm not sure I see what a filter buys
> us for ActionServlet's current functionality.
>

The "application managed security" case is a good example.  And, you could
even do this one in front of the current controller servlet.  Consider the
requirement that you want to act just like container managed security does
(*every* request should be checked for requiring authentication).  In a
Servlet 2.2 environment, you can do this for requests through the
controller pretty easily, but you also need to protect each JSP page
individually (like the example app does with the "checkLogon" tag) in case
the user tries to access it directly.

More generally, a Filter would provide for the following features over and
above what the existing controller servlet does:

* You can cascade functionality in multiple Filters, without
  modifying the code in the rest of the app.  (For example,
  we could add an app-managed security Filter like the one
  described above in front of *any* servlet based application
  -- Struts or not -- with no changes to the rest of the app).
  This can vastly simplify the overall architecture of the
  controller, and/or let you compose the controller functionality
  out of a set of independent filters that just implement the
  things you want.

* Filters can wrap the request and response they hand on to
  the rest of the app.  In our security case, we could make
  the application think it was using container-managed security
  by making getRemoteUser() and isUserInRole() work as expected),
  but without having to use your container's notion of users.

* Filters could segment the URI space into different sub-applications
  by being mapped to different patterns (we could do that with
  a controller servlet too, of course).

* Filters could be used to perform pre-processing on the request,
  and/or post-processing on the response, to perform data transformations
  required by the application.  The canonical case would be to do
  XSLT transformations each way to make the SOAP messages sent by
  your trading partner conform to your requirements.  (This is similar
  to what Cocoon2 can do with a site map.)

* Filters can be used to enforce "users do not have direct access
  to a JSP page" if you wanted to be hard-nosed about this part
  of the MVC design paradigm.  Currently, the only way we can do that
  is put the JSP pages under /WEB-INF, which works only as a side effect
  of a rule that servlet containers enforce ("no direct access to any
  resource under /WEB-INF").

* Filters can let you use existing servlets be used as Actions,
  without giving up things like the form bean processing.

* Filters can, in effect, "remap" request URIs the same way you might
  use mod_rewrite in Apache.  This would be done by having the filter
  do a RequestDispatcher.forward() to the resource it thinks you really
  wanted, and never forward to the originally selected servlet.

* Filters apply to requests for static content, as well as requests
  to the controller servlet and JSP pages, so you can do extra
  processing around them as well.

If Struts were originally created on a Filter based framework, there never
would have been a single monolithic controller servlet.  Instead, it would
have been an application event listener (to do the startup and shutdown
stuff) plus a set of cooperating filters that can be combined according to
the specific needs of a particular application.

That's probably a reasonably complete starting list, although I'm sure
that I've missed a few interesting possibilities :-).

> Thanks,
>
> Donnie
>
Craig

>
> > -----Original Message-----
> > From: craigmcc@localhost [mailto:craigmcc@localhost]On Behalf Of Craig
> > R. McClanahan
> > Sent: Sunday, December 09, 2001 8:57 PM
> > To: Struts Developers List
> > Subject: Re: Struts & Filters (Servlets 2.3)
> >
> >
> > On Sun, 9 Dec 2001, Peter Heller wrote:
> >
> > > Date: Sun, 09 Dec 2001 20:36:34 -0500
> > > From: Peter Heller <st...@japache.org>
> > > Reply-To: Struts Developers List <st...@jakarta.apache.org>
> > > To: struts-dev@jakarta.apache.org
> > > Subject: Struts & Filters (Servlets 2.3)
> > >
> > > Will there be a subclass created in struts such as actionFilter ?
> > >
> > > Will the Struts filter be part of web.xml or struts-config.xml?
> > >
> >
> > I think the question being asked here is "will the Struts controller
> > functionality (currently implemented in ActionServlet) be implemented as a
> > javax.servlet.Filter from the Servlet 2.3 API?"  It's a pretty interesting
> > question.
> >
> > Had the Servlet 2.3 API been available when Struts was originally
> > designed, it's a pretty sure bet that I would have implemented the
> > controller as a Filter instead of as a Servlet.  This would have made
> > possible some interesting approaches to using the Struts controller in
> > front of (or in front of part of) existing applications that are being
> > migrated to Struts, as well as the "multiple controllers per webapp"
> > paradigm that we are currently discussing.
> >
> > However, that's not what happened.  Struts is currently based on the
> > facilities of Servlet 2.2 and JSP 1.1, because that provides support on
> > the very broad range of application servers that support these APIs.  I
> > feel that we ultimately want to migrate to Servlet 2.3 / JSP 1.2 to take
> > advantage of the new facilities -- the quesion is, when?
> >
> > We certainly need to continue to support the ability to run Struts based
> > applications on a Servlet 2.2 / JSP 1.1 platform for the forseeable
> > future.  However, there are many compelling features of the next
> > generation APIs that are worth supporting.  I'd like to see us explore
> > taking advantage of those capabilities by offering enhanced (or
> > alternative) implementations of the basic Struts controller functionality
> > based on the new APIs.
> >
> > What do the other developers think?  Are there enough Servlet 2.3 / JSP
> > 1.2 environments available (obviously, I will be using Tomcat 4 for this,
> > since I'm pretty intimiate with its internals :-) to make development
> > *and deployment* of Servlet 2.3 / JSP 1.2 based applications useful, or is
> > it still a little too early?
> >
> > Even if it's too early, we can start exploring those sorts of ideas so
> > that we're ready when the platforms are readily available.
> >
> > Craig
> >
> >
> >
> > --
> > To unsubscribe, e-mail:
> > <ma...@jakarta.apache.org>
> > For additional commands, e-mail:
> > <ma...@jakarta.apache.org>
> >
> >
>
>
> --
> To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
> For additional commands, e-mail: <ma...@jakarta.apache.org>
>
>



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


RE: Struts & Filters (Servlets 2.3)

Posted by Donnie Hale <do...@haleonline.net>.
Craig,

Could you briefly enumerate the advantages a filter would have over a
servlet for what ActionServlet *currently* does? I can see how it would be
useful for certain new features, and I can see how the context lifecycle
events would be nice to monitor; but I'm not sure I see what a filter buys
us for ActionServlet's current functionality.

Thanks,

Donnie


> -----Original Message-----
> From: craigmcc@localhost [mailto:craigmcc@localhost]On Behalf Of Craig
> R. McClanahan
> Sent: Sunday, December 09, 2001 8:57 PM
> To: Struts Developers List
> Subject: Re: Struts & Filters (Servlets 2.3)
>
>
> On Sun, 9 Dec 2001, Peter Heller wrote:
>
> > Date: Sun, 09 Dec 2001 20:36:34 -0500
> > From: Peter Heller <st...@japache.org>
> > Reply-To: Struts Developers List <st...@jakarta.apache.org>
> > To: struts-dev@jakarta.apache.org
> > Subject: Struts & Filters (Servlets 2.3)
> >
> > Will there be a subclass created in struts such as actionFilter ?
> >
> > Will the Struts filter be part of web.xml or struts-config.xml?
> >
>
> I think the question being asked here is "will the Struts controller
> functionality (currently implemented in ActionServlet) be implemented as a
> javax.servlet.Filter from the Servlet 2.3 API?"  It's a pretty interesting
> question.
>
> Had the Servlet 2.3 API been available when Struts was originally
> designed, it's a pretty sure bet that I would have implemented the
> controller as a Filter instead of as a Servlet.  This would have made
> possible some interesting approaches to using the Struts controller in
> front of (or in front of part of) existing applications that are being
> migrated to Struts, as well as the "multiple controllers per webapp"
> paradigm that we are currently discussing.
>
> However, that's not what happened.  Struts is currently based on the
> facilities of Servlet 2.2 and JSP 1.1, because that provides support on
> the very broad range of application servers that support these APIs.  I
> feel that we ultimately want to migrate to Servlet 2.3 / JSP 1.2 to take
> advantage of the new facilities -- the quesion is, when?
>
> We certainly need to continue to support the ability to run Struts based
> applications on a Servlet 2.2 / JSP 1.1 platform for the forseeable
> future.  However, there are many compelling features of the next
> generation APIs that are worth supporting.  I'd like to see us explore
> taking advantage of those capabilities by offering enhanced (or
> alternative) implementations of the basic Struts controller functionality
> based on the new APIs.
>
> What do the other developers think?  Are there enough Servlet 2.3 / JSP
> 1.2 environments available (obviously, I will be using Tomcat 4 for this,
> since I'm pretty intimiate with its internals :-) to make development
> *and deployment* of Servlet 2.3 / JSP 1.2 based applications useful, or is
> it still a little too early?
>
> Even if it's too early, we can start exploring those sorts of ideas so
> that we're ready when the platforms are readily available.
>
> Craig
>
>
>
> --
> To unsubscribe, e-mail:
> <ma...@jakarta.apache.org>
> For additional commands, e-mail:
> <ma...@jakarta.apache.org>
>
>


--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>


Re: Struts & Filters (Servlets 2.3)

Posted by "Craig R. McClanahan" <cr...@apache.org>.
On Sun, 9 Dec 2001, Peter Heller wrote:

> Date: Sun, 09 Dec 2001 20:36:34 -0500
> From: Peter Heller <st...@japache.org>
> Reply-To: Struts Developers List <st...@jakarta.apache.org>
> To: struts-dev@jakarta.apache.org
> Subject: Struts & Filters (Servlets 2.3)
>
> Will there be a subclass created in struts such as actionFilter ?
>
> Will the Struts filter be part of web.xml or struts-config.xml?
>

I think the question being asked here is "will the Struts controller
functionality (currently implemented in ActionServlet) be implemented as a
javax.servlet.Filter from the Servlet 2.3 API?"  It's a pretty interesting
question.

Had the Servlet 2.3 API been available when Struts was originally
designed, it's a pretty sure bet that I would have implemented the
controller as a Filter instead of as a Servlet.  This would have made
possible some interesting approaches to using the Struts controller in
front of (or in front of part of) existing applications that are being
migrated to Struts, as well as the "multiple controllers per webapp"
paradigm that we are currently discussing.

However, that's not what happened.  Struts is currently based on the
facilities of Servlet 2.2 and JSP 1.1, because that provides support on
the very broad range of application servers that support these APIs.  I
feel that we ultimately want to migrate to Servlet 2.3 / JSP 1.2 to take
advantage of the new facilities -- the quesion is, when?

We certainly need to continue to support the ability to run Struts based
applications on a Servlet 2.2 / JSP 1.1 platform for the forseeable
future.  However, there are many compelling features of the next
generation APIs that are worth supporting.  I'd like to see us explore
taking advantage of those capabilities by offering enhanced (or
alternative) implementations of the basic Struts controller functionality
based on the new APIs.

What do the other developers think?  Are there enough Servlet 2.3 / JSP
1.2 environments available (obviously, I will be using Tomcat 4 for this,
since I'm pretty intimiate with its internals :-) to make development
*and deployment* of Servlet 2.3 / JSP 1.2 based applications useful, or is
it still a little too early?

Even if it's too early, we can start exploring those sorts of ideas so
that we're ready when the platforms are readily available.

Craig



--
To unsubscribe, e-mail:   <ma...@jakarta.apache.org>
For additional commands, e-mail: <ma...@jakarta.apache.org>