Double MVC - Session issue

classic Classic list List threaded Threaded
9 messages Options
Reply | Threaded
Open this post in threaded view
|

Double MVC - Session issue

kamal-2
We are using OPS along with Webwork.  OPS is used for rendering the Xforms and Webwork is used for processing the requests and setting up the data for the forms.  

We are using select1 control with auto-complete support.  To fetch the list of values we have defined a submission element as follows


<xf:submission id="auto-complete-serial-number" method="get"
                bind="forItemSerialNumber" action="/xforms/getSerialNumbers.action"
                instance="serial-numbers" separator="&amp;" replace="instance"
                validate="false" />

the url /xforms/getSerialNumbers.action refers to a webwork action which produces a XML fragment.  The problem is that OPS invokes this as a remote URL submission. Because of this the original session information is not available to the action.

The following check in the code (XFormsModelSubmission.java - lin 451) is used to determine whether to make a remote submission or a local submission.
!NetUtils.urlHasProtocol(resolvedAction)
                               && (externalContext.getRequest().getContainerType().equals("portlet")
                                    || (externalContext.getRequest().getContainerType().equals("servlet")
                                        && (XFormsUtils.isOptimizeLocalSubmission() || isMethodOptimizedLocalSubmission())
                                        && isReplaceAll))

If I remove the isReplaceAll clause from the condition it works fine.  Going through the code I couldn't find a reason why a recplace="instance" can't be treated as a local submission.  Is this a bug or is there some reason to prefer a remote submission over local submission for replace="instance" case.  If that is the case what is the correct fix for this problem?


Hope I have explained the problem clearly.

Thanks for the Help,
Kamal
Reply | Threaded
Open this post in threaded view
|

Re: Double MVC - Session issue

Erik Bruchez
Administrator
Kamal,

 > We are using OPS along with Webwork.  OPS is used for rendering the
Xforms
 > and Webwork is used for processing the requests and setting up the
data for
 > the forms.
 >
 > We are using select1 control with auto-complete support.  To fetch
the list
 > of values we have defined a submission element as follows
 >
 >
 > <xf:submission id="auto-complete-serial-number" method="get"
 > bind="forItemSerialNumber" action="/xforms/getSerialNumbers.action"
 > instance="serial-numbers" separator="&amp;" replace="instance"
 > validate="false" />
 >
 > the url /xforms/getSerialNumbers.action refers to a webwork action which
 > produces a XML fragment.  The problem is that OPS invokes this as a
remote
 > URL submission. Because of this the original session information is not
 > available to the action.

If it is within the same servlet container, it should work, because
the submission code forwards JSESSIONID. Do you use an old version of
Orbeon Forms (A/K/A OPS)? Can you enable XForms logging to see what is
happening during submission?

   http://www.orbeon.com/ops/doc/reference-xforms-ng#xforms-debugging

 > The following check in the code (XFormsModelSubmission.java - lin 451) is
 > used to determine whether to make a remote submission or a local
submission.
 > !NetUtils.urlHasProtocol(resolvedAction)
 >                                &&
 > (externalContext.getRequest().getContainerType().equals("portlet")
 >                                     ||
 > (externalContext.getRequest().getContainerType().equals("servlet")
 >                                         &&
 > (XFormsUtils.isOptimizeLocalSubmission() ||
 > isMethodOptimizedLocalSubmission())
 >                                         && isReplaceAll))
 >
 > If I remove the isReplaceAll clause from the condition it works fine.
  Going
 > through the code I couldn't find a reason why a recplace="instance"
can't be
 > treated as a local submission.  Is this a bug or is there some reason to
 > prefer a remote submission over local submission for replace="instance"
 > case.  If that is the case what is the correct fix for this problem?

In fact there is a comment in the code that explains why:

// NOTE: Optimizing with include() for servlets doesn't allow detecting
// errors caused by the included resource, so we don't allow this for now.

That's the reason why we disabled internal submissions in this
case. But the point is that you should be able to use a regular
submission and still have the session being shared.

-Erik

--
Orbeon Forms - XForms Everywhere
http://www.orbeon.com/blog/




--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Double MVC - Session issue

kamal-2
Thanks Eric.

I debugged further. The cookies are not being propagated. The problem seems to be in XFormsSubmissionUtils.doRegular method (line 180)
final String[] cookies = (String[]) externalContext.getRequest().getHeaderValuesMap().get("cookie");

I got it to work by changing the parameter name to "Cookie" (with captial C).
Reply | Threaded
Open this post in threaded view
|

Re: Double MVC - Session issue

Alessandro  Vernet
Administrator
Kamal,

Good to know. It looks like we might have to check for both "cookie"
and "Cookie". Or better perform some normalization when we populate
that map in ServletExternalContext.Request.getHeaderValuesMap(). I
added a bug for this:

http://forge.objectweb.org/tracker/index.php?func=detail&aid=306480&group_id=168&atid=350207

Out of curiosity, what application server are you using?

Alex

On 12/4/06, Kamal <[hidden email]> wrote:

>
> Thanks Eric.
>
> I debugged further. The cookies are not being propagated. The problem seems
> to be in XFormsSubmissionUtils.doRegular method (line 180)
> final String[] cookies = (String[])
> externalContext.getRequest().getHeaderValuesMap().get("cookie");
>
> I got it to work by changing the parameter name to "Cookie" (with captial
> C).
> --
> View this message in context: http://www.nabble.com/Double-MVC---Session-issue-tf2695958.html#a7674322
> Sent from the ObjectWeb OPS - Users mailing list archive at Nabble.com.
>
>
>
>
>
> --
> You receive this message as a subscriber of the [hidden email] mailing list.
> To unsubscribe: mailto:[hidden email]
> For general help: mailto:[hidden email]?subject=help
> ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
>
>
>

--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Double MVC - Session issue

kamal-2

Thanks Alex.

avernet wrote
Out of curiosity, what application server are you using?
I am using jetty (testing using the jetty-maven-plugin) with Firefox 2.0 browser.
Reply | Threaded
Open this post in threaded view
|

Re: Re: Double MVC - Session issue

Alessandro  Vernet
Administrator
On 12/5/06, Kamal <[hidden email]> wrote:
> > Out of curiosity, what application server are you using?
> >
> I am using jetty (testing using the jetty-maven-plugin) with Firefox 2.0
> browser.

Kamal, this is good to know. It might be a Jetty-related issue. I
added a note to the bug about this.

Alex
--
Blog (XML, Web apps, Open Source):
http://www.orbeon.com/blog/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
--
Follow Orbeon on Twitter: @orbeon
Follow me on Twitter: @avernet
Reply | Threaded
Open this post in threaded view
|

Re: Double MVC - Session issue

Erik Bruchez
Administrator
Alessandro Vernet wrote:
> On 12/5/06, Kamal <[hidden email]> wrote:
>> > Out of curiosity, what application server are you using?
>> >
>> I am using jetty (testing using the jetty-maven-plugin) with Firefox 2.0
>> browser.
>
> Kamal, this is good to know. It might be a Jetty-related issue. I
> added a note to the bug about this.

I committed changes to normalize header names to lower-case in
ExternalContext (they are lower-case in Tomcat, but apparently not in
Jetty according to this bug). Hopefully this will solve the Jetty issue.

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Double MVC - Session issue

Erik Bruchez
Administrator
Erik Bruchez wrote:

> Alessandro Vernet wrote:
>> On 12/5/06, Kamal <[hidden email]> wrote:
>>> > Out of curiosity, what application server are you using?
>>> >
>>> I am using jetty (testing using the jetty-maven-plugin) with Firefox 2.0
>>> browser.
>>
>> Kamal, this is good to know. It might be a Jetty-related issue. I
>> added a note to the bug about this.
>
> I committed changes to normalize header names to lower-case in
> ExternalContext (they are lower-case in Tomcat, but apparently not in
> Jetty according to this bug). Hopefully this will solve the Jetty issue.
I forgot:

Kamal, if you have a chance, can you get the latest CVS or a nightly
build and check if the code in place now fixes this for you?

-Erik

--
Orbeon Forms - Web Forms for the Enterprise Done the Right Way
http://www.orbeon.com/



--
You receive this message as a subscriber of the [hidden email] mailing list.
To unsubscribe: mailto:[hidden email]
For general help: mailto:[hidden email]?subject=help
ObjectWeb mailing lists service home page: http://www.objectweb.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: Double MVC - Session issue

kamal-2

Erik Bruchez wrote
Kamal, if you have a chance, can you get the latest CVS or a nightly
build and check if the code in place now fixes this for you?
Eric I tried with the lastest build and the problem is resolved. Thank you.

Regards,
Kamal