You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@struts.apache.org by Umesh Awasthi <um...@gmail.com> on 2012/08/13 08:00:05 UTC
Benefits of using Filter as front controller
Hi All,
I was reading this thread
http://struts.1045723.n5.nabble.com/Servlet-filter-as-front-controller-td3497275.html
regarding the intentions of using Filter as front controller while it seems
to violate even *Servlet specification*.
Can any one throw light on this?
--
With Regards
Umesh Awasthi
http://www.travellingrants.com/
Re: Benefits of using Filter as front controller
Posted by Dave Newton <da...@gmail.com>.
On Tue, Aug 14, 2012 at 12:10 PM, Rene Gielen wrote:
> So far I fail to see where Struts 2 deviates from or violates the spec.
>
Agreed; I've now read the relevant sections of older and new specs, and
AFAICT it does not explicitly disallow serving resources.
Further, it is arguable that the phrase:
"[they may] modify or adapt responses from a resource"
can be interpreted with the thought that an action is a resource, just as a
servlet is.
>From a logical standpoint, this makes sense--in S2 the resources are
actions.
I'm not sure what to make of the IBM claim, I don't know what they could
do, say, with an app using a single servlet mapping with a GET parameter
for dispatching, since the parameter wouldn't be mapped in a way WS could
do anything about.
I also like Spring MVC, but I actually tend to prefer S2's implementation,
particularly since I can get a lot of non-S2 functionality by integrating
with Spring essentially seamlessly.
Dave
Re: Benefits of using Filter as front controller
Posted by Rene Gielen <gi...@it-neering.net>.
Thanks for this information, very interesting - seems like we're not
alone with FiterDispatcher :)
- René
Am 15.08.12 00:45, schrieb Joseph Mocker:
> FWIW, JAX-RS/Jersey provides both a Filter and a Servlet option as a controller, however the Servlet came first.
>
> http://java.net/jira/browse/JERSEY-122
>
> Note the bug mentions Wicket also uses a Filter. The bug also provides an interesting reason for the use of a filter
>
> to intercept "all HTTP calls against a path but only consumes those calls it can handles. All other calls are
> allowed to continue and get handled by another Servlet or Filter."
>
> --joe
>
>
> Joseph Mocker | Velti | Senior Software Architect
> t +1.650.566.7033 m +1.408.676.6625
> e jmocker@velti.com @Mobclix
>
> The leading global technology provider of
> mobile marketing and advertising solutions
>
> On Aug 14, 2012, at 12:41 PM, Rene Gielen wrote:
>
>> No worries, always good to question - review - rethink
>>
>> If there is serious interest in an alternative servlet dispatcher besides FilterDispatcher, contributions are welcome. From the top of my head, the old dispatcher is still around as deprecated, and most of the dispatcher functionality resides in a delegate.
>>
>> - René
>>
>> Sent from my iPad
>>
>> On 14.08.2012, at 20:21, Struts Two <st...@yahoo.ca> wrote:
>>
>>>>> I remember more than one case where I found WAS / Websphere Portal to implement a very ... say ... at least ... imaginative interpretation of the specs
>>>
>>> That is exactly the point,the compromise of "clear-cut" sections of spec in favor of "unclear, murky, interpretive" sections of spec in struts 2 much like IBM. There is no "interpretation" on whether a Servlet can/should be used to server resource but when it comes to filters there is. And quite rightfully so, as there may be darn compelling reasons to do so, since things quite few often do not follow patterns put in black and white. I am not trying to stir an endless discussion on what interpretation is correct as there will be no consensus. And I do not know what has been the darn compelling reason that could have not gotten away with using a Servlet as front controller in struts 2, but I would have loved to have the option of using a Servlet as my front controller in struts 2.
>>>
>>> With all said, I did not mean to belittle struts 2 or take a jab at any struts 2 contributor in my previous comment. And I believe it is very honorable of you to try make the tool available to the development community for free by putting a lot of work in your free and personal time. I just wanted to reflect the opinion for some spectrum of struts user community though may be small in numbers.
>>>
>>>
>>> ----- Original Message -----
>>> From: Rene Gielen <rg...@apache.org>
>>> To: Struts Users Mailing List <us...@struts.apache.org>
>>> Cc:
>>> Sent: Tuesday, August 14, 2012 12:10:56 PM
>>> Subject: Re: Benefits of using Filter as front controller
>>>
>>> So far I fail to see where Struts 2 deviates from or violates the spec.
>>> The fact that _usually_ a front controller - a concept not to be found
>>> at all in the servlet spec - is implemented as servlet does not mean
>>> that it _has_ to be implemented that way, unless the spec says or
>>> clearly implies otherwise. For what I found in the and cited earlier,
>>> this is not the case.
>>>
>>> That WAS *interprets* the spec in a different way - especially when it
>>> comes to a tooling level that has nothing to do with the spec whatsoever
>>> (parsing web.xml to generate loadbalancing / proxy webserver
>>> configuration) - is a totally different story. To some extent I
>>> understand the rationale behind this, implying a servlet mapping should
>>> exist for a given URL - but besides IBM claiming this has to be the
>>> case, I haven't found any evidence so far. Interestingly, when it comes
>>> to IBM support saying Struts 2 deviates from the spec, I remember more
>>> than one case where I found WAS / Websphere Portal to implement a very
>>> ... say ... at least ... imaginative interpretation of the specs. I'm
>>> not quite sure if them saying that Struts 2 deviates makes a case for
>>> this being a fact to count on. But again, I'm happy to hear I'm wrong if
>>> someone could clearly point out what I might have missed when reading
>>> the spec.
>>>
>>> Side note - sorry to say, but in my very personal and for sure not
>>> representative experience, every time a "some application servers might
>>> have issues" case arises, there is a good chance that _some_ of them
>>> share a common product line name, starting with "W" :) And well, going
>>> through hell when deploying apps to WAS* is something I suffered from
>>> myself many times, with various different frameworks and technology
>>> stacks in use.
>>>
>>> I'll try to wrap up my points:
>>> - the filter-based dispatching addressed real and serious technical
>>> integration issues, and was able to solve them
>>> - if it would violate the spec, we would *have to* remove it again, or
>>> at least deliver a then spec conform dispatcher servlet as alternative -
>>> so far there seems to be no evidence this is the case
>>> - the Struts team *can for sure do much better* in documenting the
>>> possible glitches, especially after what we learned from this thread and
>>> your experiences; we should point out that using a filter dispatcher
>>> might impose the need to add a default dummy servlet mapping to help
>>> some application servers
>>>
>>> BTW: I agree, Spring MVC became a great framework once they dropped the
>>> inheritance-based controller madness, replacing it with annotation based
>>> POJO configuration and heavy AOP magic. Nevertheless, Struts 2 has a lot
>>> of sweet spots even over Spring MVC, as to my opinion as a user of both :)
>>>
>>> Cheers,
>>> - René
>>>
>>> Am 14.08.12 15:46, schrieb Struts Two:
>>>> What people are missing here is that using filters and deviating from the spec as front controller would cause quite a few issues when some applications servers are used. I quite clearly remember that I went through hell to deploy my applications on WebSphere applications with an Http server as front Web server. WebSphere goes through web.xml files and uses Servlet URL mappings to generate the plugin file for resource mapping and filters are ignored. Even when I opened a pmr, I was told by support that struts 2 deviates from the Spec. when you pick a framework, you got to be aware that these things may cost you dearly down the road depending on what application servers you use or you plan to migrate.
>>>>
>>>> As much as I have been an avid struts user [specially struts 1], I personally think that you should seriously consider Spring MVC / MVC Portlet against any other framework. I ,per se, have had a great experience with Spring MVC which somehow brings up the good memories of struts 1 [once everything is put in the context of its time]
>>>>
>>>>
>>>>
>>>> ----- Original Message -----
>>>> From: "umeshawasthi@gmail.com" <um...@gmail.com>
>>>> To: Struts Users Mailing List <us...@struts.apache.org>
>>>> Cc:
>>>> Sent: Monday, August 13, 2012 2:05:45 PM
>>>> Subject: Re: Benefits of using Filter as front controller
>>>>
>>>> Rene
>>>> Thanks for such a detailed explanation and descrbing each and every aspects
>>>> Now even I can say and explains things in much more and good way
>>>> Sent from BlackBerry® on Airtel
>>>>
>>>> -----Original Message-----
>>>> From: Rene Gielen <rg...@apache.org>
>>>> Date: Mon, 13 Aug 2012 20:00:04
>>>> To: Struts Users Mailing List<us...@struts.apache.org>
>>>> Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>>>> Subject: Re: Benefits of using Filter as front controller
>>>>
>>>> Grabbed me a copy of Servlet Spec 2.4:
>>>>
>>>> <quote>
>>>> SRV.6.1 What is a filter?
>>>> A filter is a reusable piece of code that can transform the content of
>>>> HTTP requests, responses, and header information. Filters do not
>>>> generally create a response or respond to a request as servlets do,
>>>> rather they modify or adapt the requests for a resource, and modify or
>>>> adapt responses from a resource.
>>>> </quote>
>>>>
>>>> "do not generally" is way different from "may not", right?
>>>>
>>>> Reading both the relevant parts of the spec and the API docs again, I
>>>> cannot see any violation of the servlet specification by using a Filter
>>>> for doing the dispatching, rather than a Servlet.
>>>>
>>>> The other part is how requests are mapped, which imposes the question if
>>>> a servlet mapping matching the request URL must exist:
>>>>
>>>> <quote>
>>>> SRV.11.1 Use of URL Paths
>>>> [...]
>>>> 1. The container will try to find an exact match of the path of the
>>>> request to the path of the servlet. A successful match selects the servlet.
>>>> 2. The container will recursively try to match the longest path-prefix.
>>>> This is done by stepping down the path tree a directory at a time, using
>>>> the ’/’ character as a path separator. The longest match determines the
>>>> servlet selected.
>>>> (ad 2.: Previous versions of this specification made use of these
>>>> mapping tech- niques as a suggestion rather than a requirement, allowing
>>>> servlet con- tainers to each have their different schemes for mapping
>>>> client requests to servlets.)
>>>> 3. If the last segment in the URL path contains an extension (e.g.
>>>> .jsp), the servlet container will try to match a servlet that handles
>>>> requests for the extension. An extension is defined as the part of the
>>>> last segment after the last ’.’ character.
>>>> 4. If neither of the previous three rules result in a servlet match, the
>>>> container will attempt to serve content appropriate for the resource
>>>> requested. If a "default" servlet is defined for the application, it
>>>> will be used.
>>>> </quote>
>>>>
>>>> Point 4 is crucial. As to my opinion, it doesn't state clearly if a
>>>> default mapping must exist or not, which leaves it IMO up to the container.
>>>>
>>>> That said, most frameworks use dispatcher servlets, and WebWork / Struts
>>>> 2 once did as well.
>>>>
>>>> The rationale behind switching to the Filter architecture was to deal
>>>> better with integrating technologies such a Sitemesh or Portlet, which
>>>> both profit from splitting the dispatching in more than one phase. This
>>>> could only be accomplished by using filters rather than servlets. Since
>>>> then, e.g. all major problems with sitemes integration magically
>>>> disappeared.
>>>>
>>>> So my point of view is that there is nothing wrong with using filters
>>>> for dispatching. If the container interprets the servlet spec in an
>>>> opposite way, a dummy default servlet mapping should do the trick.
>>>>
>>>> Nevertheless I'm happy to hear about points I might have missed or
>>>> misinterpreted.
>>>>
>>>> - René
>>>>
>>> <snip/>
>>>
>>> --
>>> René Gielen
>>> http://twitter.com/rgielen
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
René Gielen
IT-Neering.net
Saarstrasse 100, 52062 Aachen, Germany
Tel: +49-(0)241-4010770
Fax: +49-(0)241-4010771
Cel: +49-(0)163-2844164
http://twitter.com/rgielen
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Benefits of using Filter as front controller
Posted by Joseph Mocker <jm...@velti.com>.
FWIW, JAX-RS/Jersey provides both a Filter and a Servlet option as a controller, however the Servlet came first.
http://java.net/jira/browse/JERSEY-122
Note the bug mentions Wicket also uses a Filter. The bug also provides an interesting reason for the use of a filter
to intercept "all HTTP calls against a path but only consumes those calls it can handles. All other calls are
allowed to continue and get handled by another Servlet or Filter."
--joe
Joseph Mocker | Velti | Senior Software Architect
t +1.650.566.7033 m +1.408.676.6625
e jmocker@velti.com @Mobclix
The leading global technology provider of
mobile marketing and advertising solutions
On Aug 14, 2012, at 12:41 PM, Rene Gielen wrote:
> No worries, always good to question - review - rethink
>
> If there is serious interest in an alternative servlet dispatcher besides FilterDispatcher, contributions are welcome. From the top of my head, the old dispatcher is still around as deprecated, and most of the dispatcher functionality resides in a delegate.
>
> - René
>
> Sent from my iPad
>
> On 14.08.2012, at 20:21, Struts Two <st...@yahoo.ca> wrote:
>
>>>> I remember more than one case where I found WAS / Websphere Portal to implement a very ... say ... at least ... imaginative interpretation of the specs
>>
>> That is exactly the point,the compromise of "clear-cut" sections of spec in favor of "unclear, murky, interpretive" sections of spec in struts 2 much like IBM. There is no "interpretation" on whether a Servlet can/should be used to server resource but when it comes to filters there is. And quite rightfully so, as there may be darn compelling reasons to do so, since things quite few often do not follow patterns put in black and white. I am not trying to stir an endless discussion on what interpretation is correct as there will be no consensus. And I do not know what has been the darn compelling reason that could have not gotten away with using a Servlet as front controller in struts 2, but I would have loved to have the option of using a Servlet as my front controller in struts 2.
>>
>> With all said, I did not mean to belittle struts 2 or take a jab at any struts 2 contributor in my previous comment. And I believe it is very honorable of you to try make the tool available to the development community for free by putting a lot of work in your free and personal time. I just wanted to reflect the opinion for some spectrum of struts user community though may be small in numbers.
>>
>>
>> ----- Original Message -----
>> From: Rene Gielen <rg...@apache.org>
>> To: Struts Users Mailing List <us...@struts.apache.org>
>> Cc:
>> Sent: Tuesday, August 14, 2012 12:10:56 PM
>> Subject: Re: Benefits of using Filter as front controller
>>
>> So far I fail to see where Struts 2 deviates from or violates the spec.
>> The fact that _usually_ a front controller - a concept not to be found
>> at all in the servlet spec - is implemented as servlet does not mean
>> that it _has_ to be implemented that way, unless the spec says or
>> clearly implies otherwise. For what I found in the and cited earlier,
>> this is not the case.
>>
>> That WAS *interprets* the spec in a different way - especially when it
>> comes to a tooling level that has nothing to do with the spec whatsoever
>> (parsing web.xml to generate loadbalancing / proxy webserver
>> configuration) - is a totally different story. To some extent I
>> understand the rationale behind this, implying a servlet mapping should
>> exist for a given URL - but besides IBM claiming this has to be the
>> case, I haven't found any evidence so far. Interestingly, when it comes
>> to IBM support saying Struts 2 deviates from the spec, I remember more
>> than one case where I found WAS / Websphere Portal to implement a very
>> ... say ... at least ... imaginative interpretation of the specs. I'm
>> not quite sure if them saying that Struts 2 deviates makes a case for
>> this being a fact to count on. But again, I'm happy to hear I'm wrong if
>> someone could clearly point out what I might have missed when reading
>> the spec.
>>
>> Side note - sorry to say, but in my very personal and for sure not
>> representative experience, every time a "some application servers might
>> have issues" case arises, there is a good chance that _some_ of them
>> share a common product line name, starting with "W" :) And well, going
>> through hell when deploying apps to WAS* is something I suffered from
>> myself many times, with various different frameworks and technology
>> stacks in use.
>>
>> I'll try to wrap up my points:
>> - the filter-based dispatching addressed real and serious technical
>> integration issues, and was able to solve them
>> - if it would violate the spec, we would *have to* remove it again, or
>> at least deliver a then spec conform dispatcher servlet as alternative -
>> so far there seems to be no evidence this is the case
>> - the Struts team *can for sure do much better* in documenting the
>> possible glitches, especially after what we learned from this thread and
>> your experiences; we should point out that using a filter dispatcher
>> might impose the need to add a default dummy servlet mapping to help
>> some application servers
>>
>> BTW: I agree, Spring MVC became a great framework once they dropped the
>> inheritance-based controller madness, replacing it with annotation based
>> POJO configuration and heavy AOP magic. Nevertheless, Struts 2 has a lot
>> of sweet spots even over Spring MVC, as to my opinion as a user of both :)
>>
>> Cheers,
>> - René
>>
>> Am 14.08.12 15:46, schrieb Struts Two:
>>> What people are missing here is that using filters and deviating from the spec as front controller would cause quite a few issues when some applications servers are used. I quite clearly remember that I went through hell to deploy my applications on WebSphere applications with an Http server as front Web server. WebSphere goes through web.xml files and uses Servlet URL mappings to generate the plugin file for resource mapping and filters are ignored. Even when I opened a pmr, I was told by support that struts 2 deviates from the Spec. when you pick a framework, you got to be aware that these things may cost you dearly down the road depending on what application servers you use or you plan to migrate.
>>>
>>> As much as I have been an avid struts user [specially struts 1], I personally think that you should seriously consider Spring MVC / MVC Portlet against any other framework. I ,per se, have had a great experience with Spring MVC which somehow brings up the good memories of struts 1 [once everything is put in the context of its time]
>>>
>>>
>>>
>>> ----- Original Message -----
>>> From: "umeshawasthi@gmail.com" <um...@gmail.com>
>>> To: Struts Users Mailing List <us...@struts.apache.org>
>>> Cc:
>>> Sent: Monday, August 13, 2012 2:05:45 PM
>>> Subject: Re: Benefits of using Filter as front controller
>>>
>>> Rene
>>> Thanks for such a detailed explanation and descrbing each and every aspects
>>> Now even I can say and explains things in much more and good way
>>> Sent from BlackBerry® on Airtel
>>>
>>> -----Original Message-----
>>> From: Rene Gielen <rg...@apache.org>
>>> Date: Mon, 13 Aug 2012 20:00:04
>>> To: Struts Users Mailing List<us...@struts.apache.org>
>>> Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>>> Subject: Re: Benefits of using Filter as front controller
>>>
>>> Grabbed me a copy of Servlet Spec 2.4:
>>>
>>> <quote>
>>> SRV.6.1 What is a filter?
>>> A filter is a reusable piece of code that can transform the content of
>>> HTTP requests, responses, and header information. Filters do not
>>> generally create a response or respond to a request as servlets do,
>>> rather they modify or adapt the requests for a resource, and modify or
>>> adapt responses from a resource.
>>> </quote>
>>>
>>> "do not generally" is way different from "may not", right?
>>>
>>> Reading both the relevant parts of the spec and the API docs again, I
>>> cannot see any violation of the servlet specification by using a Filter
>>> for doing the dispatching, rather than a Servlet.
>>>
>>> The other part is how requests are mapped, which imposes the question if
>>> a servlet mapping matching the request URL must exist:
>>>
>>> <quote>
>>> SRV.11.1 Use of URL Paths
>>> [...]
>>> 1. The container will try to find an exact match of the path of the
>>> request to the path of the servlet. A successful match selects the servlet.
>>> 2. The container will recursively try to match the longest path-prefix.
>>> This is done by stepping down the path tree a directory at a time, using
>>> the ’/’ character as a path separator. The longest match determines the
>>> servlet selected.
>>> (ad 2.: Previous versions of this specification made use of these
>>> mapping tech- niques as a suggestion rather than a requirement, allowing
>>> servlet con- tainers to each have their different schemes for mapping
>>> client requests to servlets.)
>>> 3. If the last segment in the URL path contains an extension (e.g.
>>> .jsp), the servlet container will try to match a servlet that handles
>>> requests for the extension. An extension is defined as the part of the
>>> last segment after the last ’.’ character.
>>> 4. If neither of the previous three rules result in a servlet match, the
>>> container will attempt to serve content appropriate for the resource
>>> requested. If a "default" servlet is defined for the application, it
>>> will be used.
>>> </quote>
>>>
>>> Point 4 is crucial. As to my opinion, it doesn't state clearly if a
>>> default mapping must exist or not, which leaves it IMO up to the container.
>>>
>>> That said, most frameworks use dispatcher servlets, and WebWork / Struts
>>> 2 once did as well.
>>>
>>> The rationale behind switching to the Filter architecture was to deal
>>> better with integrating technologies such a Sitemesh or Portlet, which
>>> both profit from splitting the dispatching in more than one phase. This
>>> could only be accomplished by using filters rather than servlets. Since
>>> then, e.g. all major problems with sitemes integration magically
>>> disappeared.
>>>
>>> So my point of view is that there is nothing wrong with using filters
>>> for dispatching. If the container interprets the servlet spec in an
>>> opposite way, a dummy default servlet mapping should do the trick.
>>>
>>> Nevertheless I'm happy to hear about points I might have missed or
>>> misinterpreted.
>>>
>>> - René
>>>
>> <snip/>
>>
>> --
>> René Gielen
>> http://twitter.com/rgielen
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Benefits of using Filter as front controller
Posted by Rene Gielen <gi...@it-neering.net>.
No worries, always good to question - review - rethink
If there is serious interest in an alternative servlet dispatcher besides FilterDispatcher, contributions are welcome. From the top of my head, the old dispatcher is still around as deprecated, and most of the dispatcher functionality resides in a delegate.
- René
Sent from my iPad
On 14.08.2012, at 20:21, Struts Two <st...@yahoo.ca> wrote:
>>> I remember more than one case where I found WAS / Websphere Portal to implement a very ... say ... at least ... imaginative interpretation of the specs
>
> That is exactly the point,the compromise of "clear-cut" sections of spec in favor of "unclear, murky, interpretive" sections of spec in struts 2 much like IBM. There is no "interpretation" on whether a Servlet can/should be used to server resource but when it comes to filters there is. And quite rightfully so, as there may be darn compelling reasons to do so, since things quite few often do not follow patterns put in black and white. I am not trying to stir an endless discussion on what interpretation is correct as there will be no consensus. And I do not know what has been the darn compelling reason that could have not gotten away with using a Servlet as front controller in struts 2, but I would have loved to have the option of using a Servlet as my front controller in struts 2.
>
> With all said, I did not mean to belittle struts 2 or take a jab at any struts 2 contributor in my previous comment. And I believe it is very honorable of you to try make the tool available to the development community for free by putting a lot of work in your free and personal time. I just wanted to reflect the opinion for some spectrum of struts user community though may be small in numbers.
>
>
> ----- Original Message -----
> From: Rene Gielen <rg...@apache.org>
> To: Struts Users Mailing List <us...@struts.apache.org>
> Cc:
> Sent: Tuesday, August 14, 2012 12:10:56 PM
> Subject: Re: Benefits of using Filter as front controller
>
> So far I fail to see where Struts 2 deviates from or violates the spec.
> The fact that _usually_ a front controller - a concept not to be found
> at all in the servlet spec - is implemented as servlet does not mean
> that it _has_ to be implemented that way, unless the spec says or
> clearly implies otherwise. For what I found in the and cited earlier,
> this is not the case.
>
> That WAS *interprets* the spec in a different way - especially when it
> comes to a tooling level that has nothing to do with the spec whatsoever
> (parsing web.xml to generate loadbalancing / proxy webserver
> configuration) - is a totally different story. To some extent I
> understand the rationale behind this, implying a servlet mapping should
> exist for a given URL - but besides IBM claiming this has to be the
> case, I haven't found any evidence so far. Interestingly, when it comes
> to IBM support saying Struts 2 deviates from the spec, I remember more
> than one case where I found WAS / Websphere Portal to implement a very
> ... say ... at least ... imaginative interpretation of the specs. I'm
> not quite sure if them saying that Struts 2 deviates makes a case for
> this being a fact to count on. But again, I'm happy to hear I'm wrong if
> someone could clearly point out what I might have missed when reading
> the spec.
>
> Side note - sorry to say, but in my very personal and for sure not
> representative experience, every time a "some application servers might
> have issues" case arises, there is a good chance that _some_ of them
> share a common product line name, starting with "W" :) And well, going
> through hell when deploying apps to WAS* is something I suffered from
> myself many times, with various different frameworks and technology
> stacks in use.
>
> I'll try to wrap up my points:
> - the filter-based dispatching addressed real and serious technical
> integration issues, and was able to solve them
> - if it would violate the spec, we would *have to* remove it again, or
> at least deliver a then spec conform dispatcher servlet as alternative -
> so far there seems to be no evidence this is the case
> - the Struts team *can for sure do much better* in documenting the
> possible glitches, especially after what we learned from this thread and
> your experiences; we should point out that using a filter dispatcher
> might impose the need to add a default dummy servlet mapping to help
> some application servers
>
> BTW: I agree, Spring MVC became a great framework once they dropped the
> inheritance-based controller madness, replacing it with annotation based
> POJO configuration and heavy AOP magic. Nevertheless, Struts 2 has a lot
> of sweet spots even over Spring MVC, as to my opinion as a user of both :)
>
> Cheers,
> - René
>
> Am 14.08.12 15:46, schrieb Struts Two:
>> What people are missing here is that using filters and deviating from the spec as front controller would cause quite a few issues when some applications servers are used. I quite clearly remember that I went through hell to deploy my applications on WebSphere applications with an Http server as front Web server. WebSphere goes through web.xml files and uses Servlet URL mappings to generate the plugin file for resource mapping and filters are ignored. Even when I opened a pmr, I was told by support that struts 2 deviates from the Spec. when you pick a framework, you got to be aware that these things may cost you dearly down the road depending on what application servers you use or you plan to migrate.
>>
>> As much as I have been an avid struts user [specially struts 1], I personally think that you should seriously consider Spring MVC / MVC Portlet against any other framework. I ,per se, have had a great experience with Spring MVC which somehow brings up the good memories of struts 1 [once everything is put in the context of its time]
>>
>>
>>
>> ----- Original Message -----
>> From: "umeshawasthi@gmail.com" <um...@gmail.com>
>> To: Struts Users Mailing List <us...@struts.apache.org>
>> Cc:
>> Sent: Monday, August 13, 2012 2:05:45 PM
>> Subject: Re: Benefits of using Filter as front controller
>>
>> Rene
>> Thanks for such a detailed explanation and descrbing each and every aspects
>> Now even I can say and explains things in much more and good way
>> Sent from BlackBerry® on Airtel
>>
>> -----Original Message-----
>> From: Rene Gielen <rg...@apache.org>
>> Date: Mon, 13 Aug 2012 20:00:04
>> To: Struts Users Mailing List<us...@struts.apache.org>
>> Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>> Subject: Re: Benefits of using Filter as front controller
>>
>> Grabbed me a copy of Servlet Spec 2.4:
>>
>> <quote>
>> SRV.6.1 What is a filter?
>> A filter is a reusable piece of code that can transform the content of
>> HTTP requests, responses, and header information. Filters do not
>> generally create a response or respond to a request as servlets do,
>> rather they modify or adapt the requests for a resource, and modify or
>> adapt responses from a resource.
>> </quote>
>>
>> "do not generally" is way different from "may not", right?
>>
>> Reading both the relevant parts of the spec and the API docs again, I
>> cannot see any violation of the servlet specification by using a Filter
>> for doing the dispatching, rather than a Servlet.
>>
>> The other part is how requests are mapped, which imposes the question if
>> a servlet mapping matching the request URL must exist:
>>
>> <quote>
>> SRV.11.1 Use of URL Paths
>> [...]
>> 1. The container will try to find an exact match of the path of the
>> request to the path of the servlet. A successful match selects the servlet.
>> 2. The container will recursively try to match the longest path-prefix.
>> This is done by stepping down the path tree a directory at a time, using
>> the ’/’ character as a path separator. The longest match determines the
>> servlet selected.
>> (ad 2.: Previous versions of this specification made use of these
>> mapping tech- niques as a suggestion rather than a requirement, allowing
>> servlet con- tainers to each have their different schemes for mapping
>> client requests to servlets.)
>> 3. If the last segment in the URL path contains an extension (e.g.
>> .jsp), the servlet container will try to match a servlet that handles
>> requests for the extension. An extension is defined as the part of the
>> last segment after the last ’.’ character.
>> 4. If neither of the previous three rules result in a servlet match, the
>> container will attempt to serve content appropriate for the resource
>> requested. If a "default" servlet is defined for the application, it
>> will be used.
>> </quote>
>>
>> Point 4 is crucial. As to my opinion, it doesn't state clearly if a
>> default mapping must exist or not, which leaves it IMO up to the container.
>>
>> That said, most frameworks use dispatcher servlets, and WebWork / Struts
>> 2 once did as well.
>>
>> The rationale behind switching to the Filter architecture was to deal
>> better with integrating technologies such a Sitemesh or Portlet, which
>> both profit from splitting the dispatching in more than one phase. This
>> could only be accomplished by using filters rather than servlets. Since
>> then, e.g. all major problems with sitemes integration magically
>> disappeared.
>>
>> So my point of view is that there is nothing wrong with using filters
>> for dispatching. If the container interprets the servlet spec in an
>> opposite way, a dummy default servlet mapping should do the trick.
>>
>> Nevertheless I'm happy to hear about points I might have missed or
>> misinterpreted.
>>
>> - René
>>
> <snip/>
>
> --
> René Gielen
> http://twitter.com/rgielen
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Benefits of using Filter as front controller
Posted by Struts Two <st...@yahoo.ca>.
>> I remember more than one case where I found WAS / Websphere Portal to implement a very ... say ... at least ... imaginative interpretation of the specs
That is exactly the point,the compromise of "clear-cut" sections of spec in favor of "unclear, murky, interpretive" sections of spec in struts 2 much like IBM. There is no "interpretation" on whether a Servlet can/should be used to server resource but when it comes to filters there is. And quite rightfully so, as there may be darn compelling reasons to do so, since things quite few often do not follow patterns put in black and white. I am not trying to stir an endless discussion on what interpretation is correct as there will be no consensus. And I do not know what has been the darn compelling reason that could have not gotten away with using a Servlet as front controller in struts 2, but I would have loved to have the option of using a Servlet as my front controller in struts 2.
With all said, I did not mean to belittle struts 2 or take a jab at any struts 2 contributor in my previous comment. And I believe it is very honorable of you to try make the tool available to the development community for free by putting a lot of work in your free and personal time. I just wanted to reflect the opinion for some spectrum of struts user community though may be small in numbers.
----- Original Message -----
From: Rene Gielen <rg...@apache.org>
To: Struts Users Mailing List <us...@struts.apache.org>
Cc:
Sent: Tuesday, August 14, 2012 12:10:56 PM
Subject: Re: Benefits of using Filter as front controller
So far I fail to see where Struts 2 deviates from or violates the spec.
The fact that _usually_ a front controller - a concept not to be found
at all in the servlet spec - is implemented as servlet does not mean
that it _has_ to be implemented that way, unless the spec says or
clearly implies otherwise. For what I found in the and cited earlier,
this is not the case.
That WAS *interprets* the spec in a different way - especially when it
comes to a tooling level that has nothing to do with the spec whatsoever
(parsing web.xml to generate loadbalancing / proxy webserver
configuration) - is a totally different story. To some extent I
understand the rationale behind this, implying a servlet mapping should
exist for a given URL - but besides IBM claiming this has to be the
case, I haven't found any evidence so far. Interestingly, when it comes
to IBM support saying Struts 2 deviates from the spec, I remember more
than one case where I found WAS / Websphere Portal to implement a very
... say ... at least ... imaginative interpretation of the specs. I'm
not quite sure if them saying that Struts 2 deviates makes a case for
this being a fact to count on. But again, I'm happy to hear I'm wrong if
someone could clearly point out what I might have missed when reading
the spec.
Side note - sorry to say, but in my very personal and for sure not
representative experience, every time a "some application servers might
have issues" case arises, there is a good chance that _some_ of them
share a common product line name, starting with "W" :) And well, going
through hell when deploying apps to WAS* is something I suffered from
myself many times, with various different frameworks and technology
stacks in use.
I'll try to wrap up my points:
- the filter-based dispatching addressed real and serious technical
integration issues, and was able to solve them
- if it would violate the spec, we would *have to* remove it again, or
at least deliver a then spec conform dispatcher servlet as alternative -
so far there seems to be no evidence this is the case
- the Struts team *can for sure do much better* in documenting the
possible glitches, especially after what we learned from this thread and
your experiences; we should point out that using a filter dispatcher
might impose the need to add a default dummy servlet mapping to help
some application servers
BTW: I agree, Spring MVC became a great framework once they dropped the
inheritance-based controller madness, replacing it with annotation based
POJO configuration and heavy AOP magic. Nevertheless, Struts 2 has a lot
of sweet spots even over Spring MVC, as to my opinion as a user of both :)
Cheers,
- René
Am 14.08.12 15:46, schrieb Struts Two:
> What people are missing here is that using filters and deviating from the spec as front controller would cause quite a few issues when some applications servers are used. I quite clearly remember that I went through hell to deploy my applications on WebSphere applications with an Http server as front Web server. WebSphere goes through web.xml files and uses Servlet URL mappings to generate the plugin file for resource mapping and filters are ignored. Even when I opened a pmr, I was told by support that struts 2 deviates from the Spec. when you pick a framework, you got to be aware that these things may cost you dearly down the road depending on what application servers you use or you plan to migrate.
>
> As much as I have been an avid struts user [specially struts 1], I personally think that you should seriously consider Spring MVC / MVC Portlet against any other framework. I ,per se, have had a great experience with Spring MVC which somehow brings up the good memories of struts 1 [once everything is put in the context of its time]
>
>
>
> ----- Original Message -----
> From: "umeshawasthi@gmail.com" <um...@gmail.com>
> To: Struts Users Mailing List <us...@struts.apache.org>
> Cc:
> Sent: Monday, August 13, 2012 2:05:45 PM
> Subject: Re: Benefits of using Filter as front controller
>
> Rene
> Thanks for such a detailed explanation and descrbing each and every aspects
> Now even I can say and explains things in much more and good way
> Sent from BlackBerry® on Airtel
>
> -----Original Message-----
> From: Rene Gielen <rg...@apache.org>
> Date: Mon, 13 Aug 2012 20:00:04
> To: Struts Users Mailing List<us...@struts.apache.org>
> Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> Subject: Re: Benefits of using Filter as front controller
>
> Grabbed me a copy of Servlet Spec 2.4:
>
> <quote>
> SRV.6.1 What is a filter?
> A filter is a reusable piece of code that can transform the content of
> HTTP requests, responses, and header information. Filters do not
> generally create a response or respond to a request as servlets do,
> rather they modify or adapt the requests for a resource, and modify or
> adapt responses from a resource.
> </quote>
>
> "do not generally" is way different from "may not", right?
>
> Reading both the relevant parts of the spec and the API docs again, I
> cannot see any violation of the servlet specification by using a Filter
> for doing the dispatching, rather than a Servlet.
>
> The other part is how requests are mapped, which imposes the question if
> a servlet mapping matching the request URL must exist:
>
> <quote>
> SRV.11.1 Use of URL Paths
> [...]
> 1. The container will try to find an exact match of the path of the
> request to the path of the servlet. A successful match selects the servlet.
> 2. The container will recursively try to match the longest path-prefix.
> This is done by stepping down the path tree a directory at a time, using
> the ’/’ character as a path separator. The longest match determines the
> servlet selected.
> (ad 2.: Previous versions of this specification made use of these
> mapping tech- niques as a suggestion rather than a requirement, allowing
> servlet con- tainers to each have their different schemes for mapping
> client requests to servlets.)
> 3. If the last segment in the URL path contains an extension (e.g.
> .jsp), the servlet container will try to match a servlet that handles
> requests for the extension. An extension is defined as the part of the
> last segment after the last ’.’ character.
> 4. If neither of the previous three rules result in a servlet match, the
> container will attempt to serve content appropriate for the resource
> requested. If a "default" servlet is defined for the application, it
> will be used.
> </quote>
>
> Point 4 is crucial. As to my opinion, it doesn't state clearly if a
> default mapping must exist or not, which leaves it IMO up to the container.
>
> That said, most frameworks use dispatcher servlets, and WebWork / Struts
> 2 once did as well.
>
> The rationale behind switching to the Filter architecture was to deal
> better with integrating technologies such a Sitemesh or Portlet, which
> both profit from splitting the dispatching in more than one phase. This
> could only be accomplished by using filters rather than servlets. Since
> then, e.g. all major problems with sitemes integration magically
> disappeared.
>
> So my point of view is that there is nothing wrong with using filters
> for dispatching. If the container interprets the servlet spec in an
> opposite way, a dummy default servlet mapping should do the trick.
>
> Nevertheless I'm happy to hear about points I might have missed or
> misinterpreted.
>
> - René
>
<snip/>
--
René Gielen
http://twitter.com/rgielen
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Benefits of using Filter as front controller
Posted by Rene Gielen <rg...@apache.org>.
So far I fail to see where Struts 2 deviates from or violates the spec.
The fact that _usually_ a front controller - a concept not to be found
at all in the servlet spec - is implemented as servlet does not mean
that it _has_ to be implemented that way, unless the spec says or
clearly implies otherwise. For what I found in the and cited earlier,
this is not the case.
That WAS *interprets* the spec in a different way - especially when it
comes to a tooling level that has nothing to do with the spec whatsoever
(parsing web.xml to generate loadbalancing / proxy webserver
configuration) - is a totally different story. To some extent I
understand the rationale behind this, implying a servlet mapping should
exist for a given URL - but besides IBM claiming this has to be the
case, I haven't found any evidence so far. Interestingly, when it comes
to IBM support saying Struts 2 deviates from the spec, I remember more
than one case where I found WAS / Websphere Portal to implement a very
... say ... at least ... imaginative interpretation of the specs. I'm
not quite sure if them saying that Struts 2 deviates makes a case for
this being a fact to count on. But again, I'm happy to hear I'm wrong if
someone could clearly point out what I might have missed when reading
the spec.
Side note - sorry to say, but in my very personal and for sure not
representative experience, every time a "some application servers might
have issues" case arises, there is a good chance that _some_ of them
share a common product line name, starting with "W" :) And well, going
through hell when deploying apps to WAS* is something I suffered from
myself many times, with various different frameworks and technology
stacks in use.
I'll try to wrap up my points:
- the filter-based dispatching addressed real and serious technical
integration issues, and was able to solve them
- if it would violate the spec, we would *have to* remove it again, or
at least deliver a then spec conform dispatcher servlet as alternative -
so far there seems to be no evidence this is the case
- the Struts team *can for sure do much better* in documenting the
possible glitches, especially after what we learned from this thread and
your experiences; we should point out that using a filter dispatcher
might impose the need to add a default dummy servlet mapping to help
some application servers
BTW: I agree, Spring MVC became a great framework once they dropped the
inheritance-based controller madness, replacing it with annotation based
POJO configuration and heavy AOP magic. Nevertheless, Struts 2 has a lot
of sweet spots even over Spring MVC, as to my opinion as a user of both :)
Cheers,
- René
Am 14.08.12 15:46, schrieb Struts Two:
> What people are missing here is that using filters and deviating from the spec as front controller would cause quite a few issues when some applications servers are used. I quite clearly remember that I went through hell to deploy my applications on WebSphere applications with an Http server as front Web server. WebSphere goes through web.xml files and uses Servlet URL mappings to generate the plugin file for resource mapping and filters are ignored. Even when I opened a pmr, I was told by support that struts 2 deviates from the Spec. when you pick a framework, you got to be aware that these things may cost you dearly down the road depending on what application servers you use or you plan to migrate.
>
> As much as I have been an avid struts user [specially struts 1], I personally think that you should seriously consider Spring MVC / MVC Portlet against any other framework. I ,per se, have had a great experience with Spring MVC which somehow brings up the good memories of struts 1 [once everything is put in the context of its time]
>
>
>
> ----- Original Message -----
> From: "umeshawasthi@gmail.com" <um...@gmail.com>
> To: Struts Users Mailing List <us...@struts.apache.org>
> Cc:
> Sent: Monday, August 13, 2012 2:05:45 PM
> Subject: Re: Benefits of using Filter as front controller
>
> Rene
> Thanks for such a detailed explanation and descrbing each and every aspects
> Now even I can say and explains things in much more and good way
> Sent from BlackBerry® on Airtel
>
> -----Original Message-----
> From: Rene Gielen <rg...@apache.org>
> Date: Mon, 13 Aug 2012 20:00:04
> To: Struts Users Mailing List<us...@struts.apache.org>
> Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> Subject: Re: Benefits of using Filter as front controller
>
> Grabbed me a copy of Servlet Spec 2.4:
>
> <quote>
> SRV.6.1 What is a filter?
> A filter is a reusable piece of code that can transform the content of
> HTTP requests, responses, and header information. Filters do not
> generally create a response or respond to a request as servlets do,
> rather they modify or adapt the requests for a resource, and modify or
> adapt responses from a resource.
> </quote>
>
> "do not generally" is way different from "may not", right?
>
> Reading both the relevant parts of the spec and the API docs again, I
> cannot see any violation of the servlet specification by using a Filter
> for doing the dispatching, rather than a Servlet.
>
> The other part is how requests are mapped, which imposes the question if
> a servlet mapping matching the request URL must exist:
>
> <quote>
> SRV.11.1 Use of URL Paths
> [...]
> 1. The container will try to find an exact match of the path of the
> request to the path of the servlet. A successful match selects the servlet.
> 2. The container will recursively try to match the longest path-prefix.
> This is done by stepping down the path tree a directory at a time, using
> the ’/’ character as a path separator. The longest match determines the
> servlet selected.
> (ad 2.: Previous versions of this specification made use of these
> mapping tech- niques as a suggestion rather than a requirement, allowing
> servlet con- tainers to each have their different schemes for mapping
> client requests to servlets.)
> 3. If the last segment in the URL path contains an extension (e.g.
> .jsp), the servlet container will try to match a servlet that handles
> requests for the extension. An extension is defined as the part of the
> last segment after the last ’.’ character.
> 4. If neither of the previous three rules result in a servlet match, the
> container will attempt to serve content appropriate for the resource
> requested. If a "default" servlet is defined for the application, it
> will be used.
> </quote>
>
> Point 4 is crucial. As to my opinion, it doesn't state clearly if a
> default mapping must exist or not, which leaves it IMO up to the container.
>
> That said, most frameworks use dispatcher servlets, and WebWork / Struts
> 2 once did as well.
>
> The rationale behind switching to the Filter architecture was to deal
> better with integrating technologies such a Sitemesh or Portlet, which
> both profit from splitting the dispatching in more than one phase. This
> could only be accomplished by using filters rather than servlets. Since
> then, e.g. all major problems with sitemes integration magically
> disappeared.
>
> So my point of view is that there is nothing wrong with using filters
> for dispatching. If the container interprets the servlet spec in an
> opposite way, a dummy default servlet mapping should do the trick.
>
> Nevertheless I'm happy to hear about points I might have missed or
> misinterpreted.
>
> - René
>
<snip/>
--
René Gielen
http://twitter.com/rgielen
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Benefits of using Filter as front controller
Posted by Struts Two <st...@yahoo.ca>.
What people are missing here is that using filters and deviating from the spec as front controller would cause quite a few issues when some applications servers are used. I quite clearly remember that I went through hell to deploy my applications on WebSphere applications with an Http server as front Web server. WebSphere goes through web.xml files and uses Servlet URL mappings to generate the plugin file for resource mapping and filters are ignored. Even when I opened a pmr, I was told by support that struts 2 deviates from the Spec. when you pick a framework, you got to be aware that these things may cost you dearly down the road depending on what application servers you use or you plan to migrate.
As much as I have been an avid struts user [specially struts 1], I personally think that you should seriously consider Spring MVC / MVC Portlet against any other framework. I ,per se, have had a great experience with Spring MVC which somehow brings up the good memories of struts 1 [once everything is put in the context of its time]
----- Original Message -----
From: "umeshawasthi@gmail.com" <um...@gmail.com>
To: Struts Users Mailing List <us...@struts.apache.org>
Cc:
Sent: Monday, August 13, 2012 2:05:45 PM
Subject: Re: Benefits of using Filter as front controller
Rene
Thanks for such a detailed explanation and descrbing each and every aspects
Now even I can say and explains things in much more and good way
Sent from BlackBerry® on Airtel
-----Original Message-----
From: Rene Gielen <rg...@apache.org>
Date: Mon, 13 Aug 2012 20:00:04
To: Struts Users Mailing List<us...@struts.apache.org>
Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
Subject: Re: Benefits of using Filter as front controller
Grabbed me a copy of Servlet Spec 2.4:
<quote>
SRV.6.1 What is a filter?
A filter is a reusable piece of code that can transform the content of
HTTP requests, responses, and header information. Filters do not
generally create a response or respond to a request as servlets do,
rather they modify or adapt the requests for a resource, and modify or
adapt responses from a resource.
</quote>
"do not generally" is way different from "may not", right?
Reading both the relevant parts of the spec and the API docs again, I
cannot see any violation of the servlet specification by using a Filter
for doing the dispatching, rather than a Servlet.
The other part is how requests are mapped, which imposes the question if
a servlet mapping matching the request URL must exist:
<quote>
SRV.11.1 Use of URL Paths
[...]
1. The container will try to find an exact match of the path of the
request to the path of the servlet. A successful match selects the servlet.
2. The container will recursively try to match the longest path-prefix.
This is done by stepping down the path tree a directory at a time, using
the ’/’ character as a path separator. The longest match determines the
servlet selected.
(ad 2.: Previous versions of this specification made use of these
mapping tech- niques as a suggestion rather than a requirement, allowing
servlet con- tainers to each have their different schemes for mapping
client requests to servlets.)
3. If the last segment in the URL path contains an extension (e.g.
.jsp), the servlet container will try to match a servlet that handles
requests for the extension. An extension is defined as the part of the
last segment after the last ’.’ character.
4. If neither of the previous three rules result in a servlet match, the
container will attempt to serve content appropriate for the resource
requested. If a "default" servlet is defined for the application, it
will be used.
</quote>
Point 4 is crucial. As to my opinion, it doesn't state clearly if a
default mapping must exist or not, which leaves it IMO up to the container.
That said, most frameworks use dispatcher servlets, and WebWork / Struts
2 once did as well.
The rationale behind switching to the Filter architecture was to deal
better with integrating technologies such a Sitemesh or Portlet, which
both profit from splitting the dispatching in more than one phase. This
could only be accomplished by using filters rather than servlets. Since
then, e.g. all major problems with sitemes integration magically
disappeared.
So my point of view is that there is nothing wrong with using filters
for dispatching. If the container interprets the servlet spec in an
opposite way, a dummy default servlet mapping should do the trick.
Nevertheless I'm happy to hear about points I might have missed or
misinterpreted.
- René
Am 8/13/12 16:01 , schrieb Paul Benedict:
> I'll take back what I said and reserve opinion until further research.
> I'll be interested in what you all find. For the record, the Spring
> Framework has its front-controllers as servlets.
>
> http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/package-summary.html
>
> Paul
>
> On Mon, Aug 13, 2012 at 8:53 AM, <um...@gmail.com> wrote:
>> Yes this was one of the point I was thinking
>> Same question was today asked on SO and this lead me to reaseach as what advantages and reasons was there to use filter as controller
>> Sent from BlackBerry® on Airtel
>>
>> -----Original Message-----
>> From: Dave Newton <da...@gmail.com>
>> Date: Mon, 13 Aug 2012 09:49:43
>> To: Struts Users Mailing List<us...@struts.apache.org>
>> Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>> Subject: Re: Benefits of using Filter as front controller
>>
>> IIRC it states filters shouldn't be used to serve resources. I can't look
>> it up at the moment, but will later today.
>>
>> Dave
>>
>> (pardon brevity, typos, and top-quoting; on cell)
>> On Aug 13, 2012 9:44 AM, "Paul Benedict" <pb...@apache.org> wrote:
>>
>>> With all due respect, I think saying Struts 2 violates the Servlet
>>> Spec is a grand stretch of the imagination.
>>>
>>> http://stackoverflow.com/questions/2957165/servlet-vs-filter
>>>
>>> Struts has a filter gives greater control over the kind of dispatching
>>> needed. You can then intercept processing not just web requests, but
>>> forwards, includes, and container errors. See the <dispatch> child on
>>> the <filter> element in web.xml. AFAIK, these advanced interception
>>> techniques are not available
>>>
>>> Paul
>>>
>>> On Mon, Aug 13, 2012 at 8:14 AM, Martin Gainty <mg...@hotmail.com>
>>> wrote:
>>>>
>>>> A good question!
>>>> The issue of "direct access of filters as resources" does appear to
>>> break the 2.4 Servlet spec for the reason that Struts needs access to all
>>> (attributes)
>>>> from the Request
>>>>
>>>> Another important issue is "who is doing the dispatching" under Strut2
>>>>
>>>> Martin
>>>> ______________________________________________
>>>> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>>>>
>>>> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>>> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
>>> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
>>> dient lediglich dem Austausch von Informationen und entfaltet keine
>>> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
>>> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>>>> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas
>>> le destinataire prévu, nous te demandons avec bonté que pour satisfaire
>>> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
>>> de ceci est interdite. Ce message sert à l'information seulement et n'aura
>>> pas n'importe quel effet légalement obligatoire. Étant donné que les email
>>> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
>>> aucune responsabilité pour le contenu fourni.
>>>>
>>>>
>>>>> Date: Mon, 13 Aug 2012 11:30:05 +0530
>>>>> Subject: Benefits of using Filter as front controller
>>>>> From: umeshawasthi@gmail.com
>>>>> To: user@struts.apache.org
>>>>>
>>>>> Hi All,
>>>>>
>>>>> I was reading this thread
>>>>>
>>> http://struts.1045723.n5.nabble.com/Servlet-filter-as-front-controller-td3497275.html
>>>>> regarding the intentions of using Filter as front controller while it
>>> seems
>>>>> to violate even *Servlet specification*.
>>>>>
>>>>> Can any one throw light on this?
>>>>>
>>>>> --
>>>>> With Regards
>>>>> Umesh Awasthi
>>>>> http://www.travellingrants.com/
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
René Gielen
http://twitter.com/rgielen
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Benefits of using Filter as front controller
Posted by um...@gmail.com.
Rene
Thanks for such a detailed explanation and descrbing each and every aspects
Now even I can say and explains things in much more and good way
Sent from BlackBerry® on Airtel
-----Original Message-----
From: Rene Gielen <rg...@apache.org>
Date: Mon, 13 Aug 2012 20:00:04
To: Struts Users Mailing List<us...@struts.apache.org>
Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
Subject: Re: Benefits of using Filter as front controller
Grabbed me a copy of Servlet Spec 2.4:
<quote>
SRV.6.1 What is a filter?
A filter is a reusable piece of code that can transform the content of
HTTP requests, responses, and header information. Filters do not
generally create a response or respond to a request as servlets do,
rather they modify or adapt the requests for a resource, and modify or
adapt responses from a resource.
</quote>
"do not generally" is way different from "may not", right?
Reading both the relevant parts of the spec and the API docs again, I
cannot see any violation of the servlet specification by using a Filter
for doing the dispatching, rather than a Servlet.
The other part is how requests are mapped, which imposes the question if
a servlet mapping matching the request URL must exist:
<quote>
SRV.11.1 Use of URL Paths
[...]
1. The container will try to find an exact match of the path of the
request to the path of the servlet. A successful match selects the servlet.
2. The container will recursively try to match the longest path-prefix.
This is done by stepping down the path tree a directory at a time, using
the ’/’ character as a path separator. The longest match determines the
servlet selected.
(ad 2.: Previous versions of this specification made use of these
mapping tech- niques as a suggestion rather than a requirement, allowing
servlet con- tainers to each have their different schemes for mapping
client requests to servlets.)
3. If the last segment in the URL path contains an extension (e.g.
.jsp), the servlet container will try to match a servlet that handles
requests for the extension. An extension is defined as the part of the
last segment after the last ’.’ character.
4. If neither of the previous three rules result in a servlet match, the
container will attempt to serve content appropriate for the resource
requested. If a "default" servlet is defined for the application, it
will be used.
</quote>
Point 4 is crucial. As to my opinion, it doesn't state clearly if a
default mapping must exist or not, which leaves it IMO up to the container.
That said, most frameworks use dispatcher servlets, and WebWork / Struts
2 once did as well.
The rationale behind switching to the Filter architecture was to deal
better with integrating technologies such a Sitemesh or Portlet, which
both profit from splitting the dispatching in more than one phase. This
could only be accomplished by using filters rather than servlets. Since
then, e.g. all major problems with sitemes integration magically
disappeared.
So my point of view is that there is nothing wrong with using filters
for dispatching. If the container interprets the servlet spec in an
opposite way, a dummy default servlet mapping should do the trick.
Nevertheless I'm happy to hear about points I might have missed or
misinterpreted.
- René
Am 8/13/12 16:01 , schrieb Paul Benedict:
> I'll take back what I said and reserve opinion until further research.
> I'll be interested in what you all find. For the record, the Spring
> Framework has its front-controllers as servlets.
>
> http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/package-summary.html
>
> Paul
>
> On Mon, Aug 13, 2012 at 8:53 AM, <um...@gmail.com> wrote:
>> Yes this was one of the point I was thinking
>> Same question was today asked on SO and this lead me to reaseach as what advantages and reasons was there to use filter as controller
>> Sent from BlackBerry® on Airtel
>>
>> -----Original Message-----
>> From: Dave Newton <da...@gmail.com>
>> Date: Mon, 13 Aug 2012 09:49:43
>> To: Struts Users Mailing List<us...@struts.apache.org>
>> Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>> Subject: Re: Benefits of using Filter as front controller
>>
>> IIRC it states filters shouldn't be used to serve resources. I can't look
>> it up at the moment, but will later today.
>>
>> Dave
>>
>> (pardon brevity, typos, and top-quoting; on cell)
>> On Aug 13, 2012 9:44 AM, "Paul Benedict" <pb...@apache.org> wrote:
>>
>>> With all due respect, I think saying Struts 2 violates the Servlet
>>> Spec is a grand stretch of the imagination.
>>>
>>> http://stackoverflow.com/questions/2957165/servlet-vs-filter
>>>
>>> Struts has a filter gives greater control over the kind of dispatching
>>> needed. You can then intercept processing not just web requests, but
>>> forwards, includes, and container errors. See the <dispatch> child on
>>> the <filter> element in web.xml. AFAIK, these advanced interception
>>> techniques are not available
>>>
>>> Paul
>>>
>>> On Mon, Aug 13, 2012 at 8:14 AM, Martin Gainty <mg...@hotmail.com>
>>> wrote:
>>>>
>>>> A good question!
>>>> The issue of "direct access of filters as resources" does appear to
>>> break the 2.4 Servlet spec for the reason that Struts needs access to all
>>> (attributes)
>>>> from the Request
>>>>
>>>> Another important issue is "who is doing the dispatching" under Strut2
>>>>
>>>> Martin
>>>> ______________________________________________
>>>> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>>>>
>>>> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>>> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
>>> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
>>> dient lediglich dem Austausch von Informationen und entfaltet keine
>>> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
>>> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>>>> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas
>>> le destinataire prévu, nous te demandons avec bonté que pour satisfaire
>>> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
>>> de ceci est interdite. Ce message sert à l'information seulement et n'aura
>>> pas n'importe quel effet légalement obligatoire. Étant donné que les email
>>> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
>>> aucune responsabilité pour le contenu fourni.
>>>>
>>>>
>>>>> Date: Mon, 13 Aug 2012 11:30:05 +0530
>>>>> Subject: Benefits of using Filter as front controller
>>>>> From: umeshawasthi@gmail.com
>>>>> To: user@struts.apache.org
>>>>>
>>>>> Hi All,
>>>>>
>>>>> I was reading this thread
>>>>>
>>> http://struts.1045723.n5.nabble.com/Servlet-filter-as-front-controller-td3497275.html
>>>>> regarding the intentions of using Filter as front controller while it
>>> seems
>>>>> to violate even *Servlet specification*.
>>>>>
>>>>> Can any one throw light on this?
>>>>>
>>>>> --
>>>>> With Regards
>>>>> Umesh Awasthi
>>>>> http://www.travellingrants.com/
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
René Gielen
http://twitter.com/rgielen
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Benefits of using Filter as front controller
Posted by Rene Gielen <rg...@apache.org>.
Grabbed me a copy of Servlet Spec 2.4:
<quote>
SRV.6.1 What is a filter?
A filter is a reusable piece of code that can transform the content of
HTTP requests, responses, and header information. Filters do not
generally create a response or respond to a request as servlets do,
rather they modify or adapt the requests for a resource, and modify or
adapt responses from a resource.
</quote>
"do not generally" is way different from "may not", right?
Reading both the relevant parts of the spec and the API docs again, I
cannot see any violation of the servlet specification by using a Filter
for doing the dispatching, rather than a Servlet.
The other part is how requests are mapped, which imposes the question if
a servlet mapping matching the request URL must exist:
<quote>
SRV.11.1 Use of URL Paths
[...]
1. The container will try to find an exact match of the path of the
request to the path of the servlet. A successful match selects the servlet.
2. The container will recursively try to match the longest path-prefix.
This is done by stepping down the path tree a directory at a time, using
the ’/’ character as a path separator. The longest match determines the
servlet selected.
(ad 2.: Previous versions of this specification made use of these
mapping tech- niques as a suggestion rather than a requirement, allowing
servlet con- tainers to each have their different schemes for mapping
client requests to servlets.)
3. If the last segment in the URL path contains an extension (e.g.
.jsp), the servlet container will try to match a servlet that handles
requests for the extension. An extension is defined as the part of the
last segment after the last ’.’ character.
4. If neither of the previous three rules result in a servlet match, the
container will attempt to serve content appropriate for the resource
requested. If a "default" servlet is defined for the application, it
will be used.
</quote>
Point 4 is crucial. As to my opinion, it doesn't state clearly if a
default mapping must exist or not, which leaves it IMO up to the container.
That said, most frameworks use dispatcher servlets, and WebWork / Struts
2 once did as well.
The rationale behind switching to the Filter architecture was to deal
better with integrating technologies such a Sitemesh or Portlet, which
both profit from splitting the dispatching in more than one phase. This
could only be accomplished by using filters rather than servlets. Since
then, e.g. all major problems with sitemes integration magically
disappeared.
So my point of view is that there is nothing wrong with using filters
for dispatching. If the container interprets the servlet spec in an
opposite way, a dummy default servlet mapping should do the trick.
Nevertheless I'm happy to hear about points I might have missed or
misinterpreted.
- René
Am 8/13/12 16:01 , schrieb Paul Benedict:
> I'll take back what I said and reserve opinion until further research.
> I'll be interested in what you all find. For the record, the Spring
> Framework has its front-controllers as servlets.
>
> http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/package-summary.html
>
> Paul
>
> On Mon, Aug 13, 2012 at 8:53 AM, <um...@gmail.com> wrote:
>> Yes this was one of the point I was thinking
>> Same question was today asked on SO and this lead me to reaseach as what advantages and reasons was there to use filter as controller
>> Sent from BlackBerry® on Airtel
>>
>> -----Original Message-----
>> From: Dave Newton <da...@gmail.com>
>> Date: Mon, 13 Aug 2012 09:49:43
>> To: Struts Users Mailing List<us...@struts.apache.org>
>> Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
>> Subject: Re: Benefits of using Filter as front controller
>>
>> IIRC it states filters shouldn't be used to serve resources. I can't look
>> it up at the moment, but will later today.
>>
>> Dave
>>
>> (pardon brevity, typos, and top-quoting; on cell)
>> On Aug 13, 2012 9:44 AM, "Paul Benedict" <pb...@apache.org> wrote:
>>
>>> With all due respect, I think saying Struts 2 violates the Servlet
>>> Spec is a grand stretch of the imagination.
>>>
>>> http://stackoverflow.com/questions/2957165/servlet-vs-filter
>>>
>>> Struts has a filter gives greater control over the kind of dispatching
>>> needed. You can then intercept processing not just web requests, but
>>> forwards, includes, and container errors. See the <dispatch> child on
>>> the <filter> element in web.xml. AFAIK, these advanced interception
>>> techniques are not available
>>>
>>> Paul
>>>
>>> On Mon, Aug 13, 2012 at 8:14 AM, Martin Gainty <mg...@hotmail.com>
>>> wrote:
>>>>
>>>> A good question!
>>>> The issue of "direct access of filters as resources" does appear to
>>> break the 2.4 Servlet spec for the reason that Struts needs access to all
>>> (attributes)
>>>> from the Request
>>>>
>>>> Another important issue is "who is doing the dispatching" under Strut2
>>>>
>>>> Martin
>>>> ______________________________________________
>>>> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>>>>
>>>> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>>> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
>>> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
>>> dient lediglich dem Austausch von Informationen und entfaltet keine
>>> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
>>> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>>>> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas
>>> le destinataire prévu, nous te demandons avec bonté que pour satisfaire
>>> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
>>> de ceci est interdite. Ce message sert à l'information seulement et n'aura
>>> pas n'importe quel effet légalement obligatoire. Étant donné que les email
>>> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
>>> aucune responsabilité pour le contenu fourni.
>>>>
>>>>
>>>>> Date: Mon, 13 Aug 2012 11:30:05 +0530
>>>>> Subject: Benefits of using Filter as front controller
>>>>> From: umeshawasthi@gmail.com
>>>>> To: user@struts.apache.org
>>>>>
>>>>> Hi All,
>>>>>
>>>>> I was reading this thread
>>>>>
>>> http://struts.1045723.n5.nabble.com/Servlet-filter-as-front-controller-td3497275.html
>>>>> regarding the intentions of using Filter as front controller while it
>>> seems
>>>>> to violate even *Servlet specification*.
>>>>>
>>>>> Can any one throw light on this?
>>>>>
>>>>> --
>>>>> With Regards
>>>>> Umesh Awasthi
>>>>> http://www.travellingrants.com/
>>>>
>>>
>>> ---------------------------------------------------------------------
>>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>>> For additional commands, e-mail: user-help@struts.apache.org
>>>
>>>
>>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
--
René Gielen
http://twitter.com/rgielen
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Benefits of using Filter as front controller
Posted by Paul Benedict <pb...@apache.org>.
I'll take back what I said and reserve opinion until further research.
I'll be interested in what you all find. For the record, the Spring
Framework has its front-controllers as servlets.
http://static.springsource.org/spring/docs/3.1.x/javadoc-api/org/springframework/web/servlet/package-summary.html
Paul
On Mon, Aug 13, 2012 at 8:53 AM, <um...@gmail.com> wrote:
> Yes this was one of the point I was thinking
> Same question was today asked on SO and this lead me to reaseach as what advantages and reasons was there to use filter as controller
> Sent from BlackBerry® on Airtel
>
> -----Original Message-----
> From: Dave Newton <da...@gmail.com>
> Date: Mon, 13 Aug 2012 09:49:43
> To: Struts Users Mailing List<us...@struts.apache.org>
> Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
> Subject: Re: Benefits of using Filter as front controller
>
> IIRC it states filters shouldn't be used to serve resources. I can't look
> it up at the moment, but will later today.
>
> Dave
>
> (pardon brevity, typos, and top-quoting; on cell)
> On Aug 13, 2012 9:44 AM, "Paul Benedict" <pb...@apache.org> wrote:
>
>> With all due respect, I think saying Struts 2 violates the Servlet
>> Spec is a grand stretch of the imagination.
>>
>> http://stackoverflow.com/questions/2957165/servlet-vs-filter
>>
>> Struts has a filter gives greater control over the kind of dispatching
>> needed. You can then intercept processing not just web requests, but
>> forwards, includes, and container errors. See the <dispatch> child on
>> the <filter> element in web.xml. AFAIK, these advanced interception
>> techniques are not available
>>
>> Paul
>>
>> On Mon, Aug 13, 2012 at 8:14 AM, Martin Gainty <mg...@hotmail.com>
>> wrote:
>> >
>> > A good question!
>> > The issue of "direct access of filters as resources" does appear to
>> break the 2.4 Servlet spec for the reason that Struts needs access to all
>> (attributes)
>> > from the Request
>> >
>> > Another important issue is "who is doing the dispatching" under Strut2
>> >
>> > Martin
>> > ______________________________________________
>> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>> >
>> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
>> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
>> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
>> dient lediglich dem Austausch von Informationen und entfaltet keine
>> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
>> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
>> > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas
>> le destinataire prévu, nous te demandons avec bonté que pour satisfaire
>> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
>> de ceci est interdite. Ce message sert à l'information seulement et n'aura
>> pas n'importe quel effet légalement obligatoire. Étant donné que les email
>> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
>> aucune responsabilité pour le contenu fourni.
>> >
>> >
>> >> Date: Mon, 13 Aug 2012 11:30:05 +0530
>> >> Subject: Benefits of using Filter as front controller
>> >> From: umeshawasthi@gmail.com
>> >> To: user@struts.apache.org
>> >>
>> >> Hi All,
>> >>
>> >> I was reading this thread
>> >>
>> http://struts.1045723.n5.nabble.com/Servlet-filter-as-front-controller-td3497275.html
>> >> regarding the intentions of using Filter as front controller while it
>> seems
>> >> to violate even *Servlet specification*.
>> >>
>> >> Can any one throw light on this?
>> >>
>> >> --
>> >> With Regards
>> >> Umesh Awasthi
>> >> http://www.travellingrants.com/
>> >
>>
>> ---------------------------------------------------------------------
>> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
>> For additional commands, e-mail: user-help@struts.apache.org
>>
>>
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
Re: Benefits of using Filter as front controller
Posted by um...@gmail.com.
Yes this was one of the point I was thinking
Same question was today asked on SO and this lead me to reaseach as what advantages and reasons was there to use filter as controller
Sent from BlackBerry® on Airtel
-----Original Message-----
From: Dave Newton <da...@gmail.com>
Date: Mon, 13 Aug 2012 09:49:43
To: Struts Users Mailing List<us...@struts.apache.org>
Reply-To: "Struts Users Mailing List" <us...@struts.apache.org>
Subject: Re: Benefits of using Filter as front controller
IIRC it states filters shouldn't be used to serve resources. I can't look
it up at the moment, but will later today.
Dave
(pardon brevity, typos, and top-quoting; on cell)
On Aug 13, 2012 9:44 AM, "Paul Benedict" <pb...@apache.org> wrote:
> With all due respect, I think saying Struts 2 violates the Servlet
> Spec is a grand stretch of the imagination.
>
> http://stackoverflow.com/questions/2957165/servlet-vs-filter
>
> Struts has a filter gives greater control over the kind of dispatching
> needed. You can then intercept processing not just web requests, but
> forwards, includes, and container errors. See the <dispatch> child on
> the <filter> element in web.xml. AFAIK, these advanced interception
> techniques are not available
>
> Paul
>
> On Mon, Aug 13, 2012 at 8:14 AM, Martin Gainty <mg...@hotmail.com>
> wrote:
> >
> > A good question!
> > The issue of "direct access of filters as resources" does appear to
> break the 2.4 Servlet spec for the reason that Struts needs access to all
> (attributes)
> > from the Request
> >
> > Another important issue is "who is doing the dispatching" under Strut2
> >
> > Martin
> > ______________________________________________
> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
> >
> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas
> le destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
> >
> >
> >> Date: Mon, 13 Aug 2012 11:30:05 +0530
> >> Subject: Benefits of using Filter as front controller
> >> From: umeshawasthi@gmail.com
> >> To: user@struts.apache.org
> >>
> >> Hi All,
> >>
> >> I was reading this thread
> >>
> http://struts.1045723.n5.nabble.com/Servlet-filter-as-front-controller-td3497275.html
> >> regarding the intentions of using Filter as front controller while it
> seems
> >> to violate even *Servlet specification*.
> >>
> >> Can any one throw light on this?
> >>
> >> --
> >> With Regards
> >> Umesh Awasthi
> >> http://www.travellingrants.com/
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: Benefits of using Filter as front controller
Posted by Dave Newton <da...@gmail.com>.
IIRC it states filters shouldn't be used to serve resources. I can't look
it up at the moment, but will later today.
Dave
(pardon brevity, typos, and top-quoting; on cell)
On Aug 13, 2012 9:44 AM, "Paul Benedict" <pb...@apache.org> wrote:
> With all due respect, I think saying Struts 2 violates the Servlet
> Spec is a grand stretch of the imagination.
>
> http://stackoverflow.com/questions/2957165/servlet-vs-filter
>
> Struts has a filter gives greater control over the kind of dispatching
> needed. You can then intercept processing not just web requests, but
> forwards, includes, and container errors. See the <dispatch> child on
> the <filter> element in web.xml. AFAIK, these advanced interception
> techniques are not available
>
> Paul
>
> On Mon, Aug 13, 2012 at 8:14 AM, Martin Gainty <mg...@hotmail.com>
> wrote:
> >
> > A good question!
> > The issue of "direct access of filters as resources" does appear to
> break the 2.4 Servlet spec for the reason that Struts needs access to all
> (attributes)
> > from the Request
> >
> > Another important issue is "who is doing the dispatching" under Strut2
> >
> > Martin
> > ______________________________________________
> > Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
> >
> > Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene
> Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte
> Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht
> dient lediglich dem Austausch von Informationen und entfaltet keine
> rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von
> E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> > Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas
> le destinataire prévu, nous te demandons avec bonté que pour satisfaire
> informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie
> de ceci est interdite. Ce message sert à l'information seulement et n'aura
> pas n'importe quel effet légalement obligatoire. Étant donné que les email
> peuvent facilement être sujets à la manipulation, nous ne pouvons accepter
> aucune responsabilité pour le contenu fourni.
> >
> >
> >> Date: Mon, 13 Aug 2012 11:30:05 +0530
> >> Subject: Benefits of using Filter as front controller
> >> From: umeshawasthi@gmail.com
> >> To: user@struts.apache.org
> >>
> >> Hi All,
> >>
> >> I was reading this thread
> >>
> http://struts.1045723.n5.nabble.com/Servlet-filter-as-front-controller-td3497275.html
> >> regarding the intentions of using Filter as front controller while it
> seems
> >> to violate even *Servlet specification*.
> >>
> >> Can any one throw light on this?
> >>
> >> --
> >> With Regards
> >> Umesh Awasthi
> >> http://www.travellingrants.com/
> >
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
> For additional commands, e-mail: user-help@struts.apache.org
>
>
Re: Benefits of using Filter as front controller
Posted by Paul Benedict <pb...@apache.org>.
With all due respect, I think saying Struts 2 violates the Servlet
Spec is a grand stretch of the imagination.
http://stackoverflow.com/questions/2957165/servlet-vs-filter
Struts has a filter gives greater control over the kind of dispatching
needed. You can then intercept processing not just web requests, but
forwards, includes, and container errors. See the <dispatch> child on
the <filter> element in web.xml. AFAIK, these advanced interception
techniques are not available
Paul
On Mon, Aug 13, 2012 at 8:14 AM, Martin Gainty <mg...@hotmail.com> wrote:
>
> A good question!
> The issue of "direct access of filters as resources" does appear to break the 2.4 Servlet spec for the reason that Struts needs access to all (attributes)
> from the Request
>
> Another important issue is "who is doing the dispatching" under Strut2
>
> Martin
> ______________________________________________
> Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
>
> Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
> Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
>
>
>> Date: Mon, 13 Aug 2012 11:30:05 +0530
>> Subject: Benefits of using Filter as front controller
>> From: umeshawasthi@gmail.com
>> To: user@struts.apache.org
>>
>> Hi All,
>>
>> I was reading this thread
>> http://struts.1045723.n5.nabble.com/Servlet-filter-as-front-controller-td3497275.html
>> regarding the intentions of using Filter as front controller while it seems
>> to violate even *Servlet specification*.
>>
>> Can any one throw light on this?
>>
>> --
>> With Regards
>> Umesh Awasthi
>> http://www.travellingrants.com/
>
---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org
RE: Benefits of using Filter as front controller
Posted by Martin Gainty <mg...@hotmail.com>.
A good question!
The issue of "direct access of filters as resources" does appear to break the 2.4 Servlet spec for the reason that Struts needs access to all (attributes)
from the Request
Another important issue is "who is doing the dispatching" under Strut2
Martin
______________________________________________
Verzicht und Vertraulichkeitanmerkung/Note de déni et de confidentialité
Diese Nachricht ist vertraulich. Sollten Sie nicht der vorgesehene Empfaenger sein, so bitten wir hoeflich um eine Mitteilung. Jede unbefugte Weiterleitung oder Fertigung einer Kopie ist unzulaessig. Diese Nachricht dient lediglich dem Austausch von Informationen und entfaltet keine rechtliche Bindungswirkung. Aufgrund der leichten Manipulierbarkeit von E-Mails koennen wir keine Haftung fuer den Inhalt uebernehmen.
Ce message est confidentiel et peut être privilégié. Si vous n'êtes pas le destinataire prévu, nous te demandons avec bonté que pour satisfaire informez l'expéditeur. N'importe quelle diffusion non autorisée ou la copie de ceci est interdite. Ce message sert à l'information seulement et n'aura pas n'importe quel effet légalement obligatoire. Étant donné que les email peuvent facilement être sujets à la manipulation, nous ne pouvons accepter aucune responsabilité pour le contenu fourni.
> Date: Mon, 13 Aug 2012 11:30:05 +0530
> Subject: Benefits of using Filter as front controller
> From: umeshawasthi@gmail.com
> To: user@struts.apache.org
>
> Hi All,
>
> I was reading this thread
> http://struts.1045723.n5.nabble.com/Servlet-filter-as-front-controller-td3497275.html
> regarding the intentions of using Filter as front controller while it seems
> to violate even *Servlet specification*.
>
> Can any one throw light on this?
>
> --
> With Regards
> Umesh Awasthi
> http://www.travellingrants.com/