You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@sling.apache.org by Felix Meschberger <fm...@gmail.com> on 2008/03/14 10:17:48 UTC

Re: [jira] Commented: (SLING-325) Add RequestDispatcherOptions.OPT_REQUEST_METHOD

Hi all,

Issue SLING-325 touches a fundamental problem: Tobias Bocanegra asks for
two additions: Support method overwrite on import using an
RequestDispatcherOption and have this option set to a default value of
"GET" for the <sling:include> tag.

I think, the former request to add such an option is not controversary
as it might help in many situations.

What I want to put up on discussion is the definition of the default
value for the sling:include tag :

First, I think we either define this globally for all inclusions through
the RequestDispatcher or we leave it out altogether. We should not
specify a different default for an include through <sling:include> and
for an include through the RequestDispatcher retrieved from the request.

Second, I question the default value as such: AFAIK the servlet spec has
no saying about changing the method name in the included request. In
fact, IMHO the basic assumption is that the include operates with the
same setup as the including request - except if the reqeust object is
overwritten to changes things.

BTW: this is only an issue for the first include as further includes
from the first include (transitives) will just not see the original
method anymore as it is hidden by the first include.

WDYT ?

Regards
Felix

Am Donnerstag, den 13.03.2008, 03:01 -0700 schrieb Bertrand Delacretaz
(JIRA):
> [ https://issues.apache.org/jira/browse/SLING-325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12578219#action_12578219 ] 
> 
> Bertrand Delacretaz commented on SLING-325:
> -------------------------------------------
> 
> > how about a 'forceGet' attribute with default to 'true' if not set ? 
> 
> I like this, and I'd even tend to suggest always forcing to GET for includes. 
> 
> Using includes to process POST or other requests (except HEAD maybe) sounds scary, but that's just a gut feeling, I don't have precise examples.
> 
> So I'm ok for either a forceGet option or for always forcing GET without the option for now, and adding the option later if we ever need it.
> 
> > Add RequestDispatcherOptions.OPT_REQUEST_METHOD
> > -----------------------------------------------
> >
> >                 Key: SLING-325
> >                 URL: https://issues.apache.org/jira/browse/SLING-325
> >             Project: Sling
> >          Issue Type: New Feature
> >          Components: Scripting
> >            Reporter: Tobias Bocanegra
> >
> > I'm facing a problem with POST handling in scripts. i have a 'main' script that includes others (header, navigation, footer, etc.) using <sling:include/>.
> > now i have a html form that uses (multipart) POST that i want to handle myself and not with the ujax post servlet. therefor i added a 'POST.jsp' beside my 'html.jsp' of the main script. this works. now the problem is, that all included resources that do not have a POST.jsp are rendered by the ujax post servlet, which is not what i want. of course i can add POST.jsp to all other scripts but that's a bit tiresome.
> > suggest to:
> > - add new RequestDispatcherOption  OPT_REQUEST_METHOD that allows override of the method (maybe limit to 'GET')
> > - extend the <sling:include/> tag to take a 'method' attribute and default it to GET, if absent (it would be tedious to specify the GET for every include, so rather make it default).
> 


Re: [jira] Commented: (SLING-325) Add RequestDispatcherOptions.OPT_REQUEST_METHOD

Posted by Tobias Bocanegra <to...@day.com>.
On 3/14/08, Felix Meschberger <fm...@gmail.com> wrote:
> Hi,
>
>  Am Freitag, den 14.03.2008, 09:00 -0700 schrieb Tobias Bocanegra:
>
> > >  First, I think we either define this globally for all inclusions through
>  > >  the RequestDispatcher or we leave it out altogether. We should not
>  > >  specify a different default for an include through <sling:include> and
>  > >  for an include through the RequestDispatcher retrieved from the request.
>  > i think this i only a problem when generating 'HTML' output. all other
>  > servlets that include other ones or proxy them, probably want to keep
>  > the request method.
>  >
>  > i think it's a fundamental problem between "POST as replacement for
>  > GET with ?" and "POST to writeback content".
>
>
> This is thin ice of course: POST and GET with ? are not the same - at
>  least in the author's orignial intention ;-)
>
>
>  >  the ujax post servlet
>  > should only be used in the later case. since the first is merely
>  > parameter passing, i think we can transform it to GETs for included
>  > requests.
>  >
>  > >  Second, I question the default value as such: AFAIK the servlet spec has
>  > >  no saying about changing the method name in the included request. In
>  > >  fact, IMHO the basic assumption is that the include operates with the
>  > >  same setup as the including request - except if the reqeust object is
>  > >  overwritten to changes things.
>  > >
>  > >  BTW: this is only an issue for the first include as further includes
>  > >  from the first include (transitives) will just not see the original
>  > >  method anymore as it is hidden by the first include.
>  > >  Am Donnerstag, den 13.03.2008, 03:01 -0700 schrieb Bertrand Delacretaz
>  > >  (JIRA):
>  > this is exactly the problem eg. when using a 'proxy servlet' that the
>  > request needs
>  > to keep to original method.
>  >
>  > so i think defaulting it to force a GET is ok. maybe this can be
>  > exposed better in the api. eg (silly name, of course)
>  >
>  >   slingReq.getRequestDispatcherThatForcesGet()
>  >
>  > regards, toby
>
>
> If you use the getRequestDispatcher method, you may also pass the
>  RequestDispatcherOptions setting. But this proposal in fact gives way to
>  another one: How about a new tag:
>
>    <sling:includeGet>
>
>  which would behave exactly like <sling:include> except that the include
>  will use the RequestDispatcherOption for GET.

as i mentioned in the jira issue - i think inclusion of a non-get are
very rare in scripts. so i would rather have the 'force-GET' as
default in the <sling:include/>.
if this is also the default case in the req.dispatcher, i don't care,
but i agree it should align.
>
>  WDYT
>
>  Regards
>
> Felix
>
>
>  >
>  > >
>  > > > [ https://issues.apache.org/jira/browse/SLING-325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12578219#action_12578219 ]
>  > >  >
>  > >  > Bertrand Delacretaz commented on SLING-325:
>  > >  > -------------------------------------------
>  > >  >
>  > >  > > how about a 'forceGet' attribute with default to 'true' if not set ?
>  > >  >
>  > >  > I like this, and I'd even tend to suggest always forcing to GET for includes.
>  > >  >
>  > >  > Using includes to process POST or other requests (except HEAD maybe) sounds scary, but that's just a gut feeling, I don't have precise examples.
>  > >  >
>  > >  > So I'm ok for either a forceGet option or for always forcing GET without the option for now, and adding the option later if we ever need it.
>  > >  >
>  > >  > > Add RequestDispatcherOptions.OPT_REQUEST_METHOD
>  > >  > > -----------------------------------------------
>  > >  > >
>  > >  > >                 Key: SLING-325
>  > >  > >                 URL: https://issues.apache.org/jira/browse/SLING-325
>  > >  > >             Project: Sling
>  > >  > >          Issue Type: New Feature
>  > >  > >          Components: Scripting
>  > >  > >            Reporter: Tobias Bocanegra
>  > >  > >
>  > >  > > I'm facing a problem with POST handling in scripts. i have a 'main' script that includes others (header, navigation, footer, etc.) using <sling:include/>.
>  > >  > > now i have a html form that uses (multipart) POST that i want to handle myself and not with the ujax post servlet. therefor i added a 'POST.jsp' beside my 'html.jsp' of the main script. this works. now the problem is, that all included resources that do not have a POST.jsp are rendered by the ujax post servlet, which is not what i want. of course i can add POST.jsp to all other scripts but that's a bit tiresome.
>  > >  > > suggest to:
>  > >  > > - add new RequestDispatcherOption  OPT_REQUEST_METHOD that allows override of the method (maybe limit to 'GET')
>  > >  > > - extend the <sling:include/> tag to take a 'method' attribute and default it to GET, if absent (it would be tedious to specify the GET for every include, so rather make it default).
>  > >  >
>  > >
>  > >
>  >
>  >
>
>


-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---

Re: [jira] Commented: (SLING-325) Add RequestDispatcherOptions.OPT_REQUEST_METHOD

Posted by Felix Meschberger <fm...@gmail.com>.
Hi,

Am Freitag, den 14.03.2008, 09:00 -0700 schrieb Tobias Bocanegra:
> >  First, I think we either define this globally for all inclusions through
> >  the RequestDispatcher or we leave it out altogether. We should not
> >  specify a different default for an include through <sling:include> and
> >  for an include through the RequestDispatcher retrieved from the request.
> i think this i only a problem when generating 'HTML' output. all other
> servlets that include other ones or proxy them, probably want to keep
> the request method.
> 
> i think it's a fundamental problem between "POST as replacement for
> GET with ?" and "POST to writeback content".

This is thin ice of course: POST and GET with ? are not the same - at
least in the author's orignial intention ;-)

>  the ujax post servlet
> should only be used in the later case. since the first is merely
> parameter passing, i think we can transform it to GETs for included
> requests.
> 
> >  Second, I question the default value as such: AFAIK the servlet spec has
> >  no saying about changing the method name in the included request. In
> >  fact, IMHO the basic assumption is that the include operates with the
> >  same setup as the including request - except if the reqeust object is
> >  overwritten to changes things.
> >
> >  BTW: this is only an issue for the first include as further includes
> >  from the first include (transitives) will just not see the original
> >  method anymore as it is hidden by the first include.
> >  Am Donnerstag, den 13.03.2008, 03:01 -0700 schrieb Bertrand Delacretaz
> >  (JIRA):
> this is exactly the problem eg. when using a 'proxy servlet' that the
> request needs
> to keep to original method.
> 
> so i think defaulting it to force a GET is ok. maybe this can be
> exposed better in the api. eg (silly name, of course)
> 
>   slingReq.getRequestDispatcherThatForcesGet()
> 
> regards, toby

If you use the getRequestDispatcher method, you may also pass the
RequestDispatcherOptions setting. But this proposal in fact gives way to
another one: How about a new tag:

   <sling:includeGet>

which would behave exactly like <sling:include> except that the include
will use the RequestDispatcherOption for GET.

WDYT

Regards
Felix

> 
> >
> > > [ https://issues.apache.org/jira/browse/SLING-325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12578219#action_12578219 ]
> >  >
> >  > Bertrand Delacretaz commented on SLING-325:
> >  > -------------------------------------------
> >  >
> >  > > how about a 'forceGet' attribute with default to 'true' if not set ?
> >  >
> >  > I like this, and I'd even tend to suggest always forcing to GET for includes.
> >  >
> >  > Using includes to process POST or other requests (except HEAD maybe) sounds scary, but that's just a gut feeling, I don't have precise examples.
> >  >
> >  > So I'm ok for either a forceGet option or for always forcing GET without the option for now, and adding the option later if we ever need it.
> >  >
> >  > > Add RequestDispatcherOptions.OPT_REQUEST_METHOD
> >  > > -----------------------------------------------
> >  > >
> >  > >                 Key: SLING-325
> >  > >                 URL: https://issues.apache.org/jira/browse/SLING-325
> >  > >             Project: Sling
> >  > >          Issue Type: New Feature
> >  > >          Components: Scripting
> >  > >            Reporter: Tobias Bocanegra
> >  > >
> >  > > I'm facing a problem with POST handling in scripts. i have a 'main' script that includes others (header, navigation, footer, etc.) using <sling:include/>.
> >  > > now i have a html form that uses (multipart) POST that i want to handle myself and not with the ujax post servlet. therefor i added a 'POST.jsp' beside my 'html.jsp' of the main script. this works. now the problem is, that all included resources that do not have a POST.jsp are rendered by the ujax post servlet, which is not what i want. of course i can add POST.jsp to all other scripts but that's a bit tiresome.
> >  > > suggest to:
> >  > > - add new RequestDispatcherOption  OPT_REQUEST_METHOD that allows override of the method (maybe limit to 'GET')
> >  > > - extend the <sling:include/> tag to take a 'method' attribute and default it to GET, if absent (it would be tedious to specify the GET for every include, so rather make it default).
> >  >
> >
> >
> 
> 


Re: [jira] Commented: (SLING-325) Add RequestDispatcherOptions.OPT_REQUEST_METHOD

Posted by Tobias Bocanegra <to...@day.com>.
>  First, I think we either define this globally for all inclusions through
>  the RequestDispatcher or we leave it out altogether. We should not
>  specify a different default for an include through <sling:include> and
>  for an include through the RequestDispatcher retrieved from the request.
i think this i only a problem when generating 'HTML' output. all other
servlets that include other ones or proxy them, probably want to keep
the request method.

i think it's a fundamental problem between "POST as replacement for
GET with ?" and "POST to writeback content". the ujax post servlet
should only be used in the later case. since the first is merely
parameter passing, i think we can transform it to GETs for included
requests.

>  Second, I question the default value as such: AFAIK the servlet spec has
>  no saying about changing the method name in the included request. In
>  fact, IMHO the basic assumption is that the include operates with the
>  same setup as the including request - except if the reqeust object is
>  overwritten to changes things.
>
>  BTW: this is only an issue for the first include as further includes
>  from the first include (transitives) will just not see the original
>  method anymore as it is hidden by the first include.
>  Am Donnerstag, den 13.03.2008, 03:01 -0700 schrieb Bertrand Delacretaz
>  (JIRA):
this is exactly the problem eg. when using a 'proxy servlet' that the
request needs
to keep to original method.

so i think defaulting it to force a GET is ok. maybe this can be
exposed better in the api. eg (silly name, of course)

  slingReq.getRequestDispatcherThatForcesGet()

regards, toby

>
> > [ https://issues.apache.org/jira/browse/SLING-325?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=12578219#action_12578219 ]
>  >
>  > Bertrand Delacretaz commented on SLING-325:
>  > -------------------------------------------
>  >
>  > > how about a 'forceGet' attribute with default to 'true' if not set ?
>  >
>  > I like this, and I'd even tend to suggest always forcing to GET for includes.
>  >
>  > Using includes to process POST or other requests (except HEAD maybe) sounds scary, but that's just a gut feeling, I don't have precise examples.
>  >
>  > So I'm ok for either a forceGet option or for always forcing GET without the option for now, and adding the option later if we ever need it.
>  >
>  > > Add RequestDispatcherOptions.OPT_REQUEST_METHOD
>  > > -----------------------------------------------
>  > >
>  > >                 Key: SLING-325
>  > >                 URL: https://issues.apache.org/jira/browse/SLING-325
>  > >             Project: Sling
>  > >          Issue Type: New Feature
>  > >          Components: Scripting
>  > >            Reporter: Tobias Bocanegra
>  > >
>  > > I'm facing a problem with POST handling in scripts. i have a 'main' script that includes others (header, navigation, footer, etc.) using <sling:include/>.
>  > > now i have a html form that uses (multipart) POST that i want to handle myself and not with the ujax post servlet. therefor i added a 'POST.jsp' beside my 'html.jsp' of the main script. this works. now the problem is, that all included resources that do not have a POST.jsp are rendered by the ujax post servlet, which is not what i want. of course i can add POST.jsp to all other scripts but that's a bit tiresome.
>  > > suggest to:
>  > > - add new RequestDispatcherOption  OPT_REQUEST_METHOD that allows override of the method (maybe limit to 'GET')
>  > > - extend the <sling:include/> tag to take a 'method' attribute and default it to GET, if absent (it would be tedious to specify the GET for every include, so rather make it default).
>  >
>
>


-- 
-----------------------------------------< tobias.bocanegra@day.com >---
Tobias Bocanegra, Day Management AG, Barfuesserplatz 6, CH - 4001 Basel
T +41 61 226 98 98, F +41 61 226 98 97
-----------------------------------------------< http://www.day.com >---