submitting with method "post" and loosing session attributes

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

submitting with method "post" and loosing session attributes

Gerrit Germis-2
Hi,

I'm using struts/tiles with the nightly build of xforms (separartely
deployed). I have successfully created and populated my xform, but now,
when I try to submit the results back to another action using the "post"
method, I loose my profile information that was stored in the session.
This is what my submission looks like:

   <xforms:submission id="test-submit"
       action="http://localhost:8080/umadmin/someAction" method="post"
       ref="instance('document-instance')/data/DocumentRevision"
replace="all"/>

   <xforms:submit submission="test-submit">
       <xforms:label>Go to action!</xforms:label>
   </xforms:submit>

The complete flow is like this:

 - setup: /xforms-jsp/* is setup to be filtered by OPS
 - User logs into the website, profile information is stored in session
 - form is generated by navigating to URL:
http://localhost:8080/umadmin/xforms-jsp/some-app
 - User fills in data
 - User presses the submit button labeled "Go to action!" mentioned
above
 - PROBLEM: user is prompted for login again since no profile
information was found in session

How can I make sure the profile information is not lost on submission?

Sincerely
Gerrit



--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: submitting with method "post" and loosing session attributes

Erik Bruchez
Administrator
Gerrit Germis wrote:

> Hi,
>
> I'm using struts/tiles with the nightly build of xforms (separartely
> deployed). I have successfully created and populated my xform, but now,
> when I try to submit the results back to another action using the "post"
> method, I loose my profile information that was stored in the session.
> This is what my submission looks like:
>
>    <xforms:submission id="test-submit"
>        action="http://localhost:8080/umadmin/someAction" method="post"
>        ref="instance('document-instance')/data/DocumentRevision"
> replace="all"/>
>
>    <xforms:submit submission="test-submit">
>        <xforms:label>Go to action!</xforms:label>
>    </xforms:submit>
>
> The complete flow is like this:
>
>  - setup: /xforms-jsp/* is setup to be filtered by OPS
>  - User logs into the website, profile information is stored in session
>  - form is generated by navigating to URL:
> http://localhost:8080/umadmin/xforms-jsp/some-app
>  - User fills in data
>  - User presses the submit button labeled "Go to action!" mentioned
> above
>  - PROBLEM: user is prompted for login again since no profile
> information was found in session
>
> How can I make sure the profile information is not lost on submission?
When doing a submission, we do forward the JSESSIONID cookie so the
session should be kept. Would /umadmin/ share the same session as the
external URL producing the XForms page?

-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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: submitting with method "post" and loosing session attributes

Gerrit Germis-2
In reply to this post by Gerrit Germis-2
Hi Erik,

I'm not sure I understand your question. The Xforms page is generated
from within the /umadmin context. Orbeon is deployed to the /ops
context. We tried looking with "LiveHttpHeaders" in firefox to the
problem. We found that multiple POST and GET requests are performed when
pressing the submit button. The first POST does get the correct
JSESSIONID, but after that, apparantly a new session id is created and
used for some reason.

This is what 'LiveHttpHeaders' caught on submitting the results of the
form. Note that for "xforms-server" the
JSESSIONID=6C4FF453E59B164DF5AFD95326F15170, and for
"xforms-server-submit" the JSESSIONID=196D593B2B400B583C1571B9B4408B32


POST /umadmin/ops/xforms-server HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9)
Gecko/20071025 Firefox/2.0.0.9
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plai
n;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Content-Type: application/xml
Referer: http://localhost:8080/umadmin/testIFrame.do
Content-Length: 578
Cookie: siteStyle=default; JSESSIONID=6C4FF453E59B164DF5AFD95326F15170
Pragma: no-cache
Cache-Control: no-cache
<!DOCTYPE xxforms:event-request [<!ENTITY nbsp "&#160;">]>
<xxforms:event-request xmlns:xxforms="http://orbeon.org/oxf/xml/xforms">
 
<xxforms:static-state>pers:E5F6A3BC-D667-FBEF-B1BA-EFCFCFC23F56</xxforms
:static-state>
 
<xxforms:dynamic-state>pers:032BD484-EFFD-972A-1F90-30CC120FC550</xxform
s:dynamic-state>
    <xxforms:action>
        <xxforms:event name="DOMFocusIn"
source-control-id="xforms-element-122"></xxforms:event>
        <xxforms:event name="DOMActivate"
source-control-id="xforms-element-122"></xxforms:event>
    </xxforms:action>
</xxforms:event-request>
HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
Last-Modified: Wed, 14 Nov 2007 18:12:27 GMT
Expires: Wed, 14 Nov 2007 18:12:27 GMT
Cache-Control: must-revalidate
Content-Type: application/xml;charset=utf-8
Content-Length: 647
Date: Wed, 14 Nov 2007 18:12:28 GMT
----------------------------------------------------------
http://localhost:8080/ops/xforms-server-submit

POST /ops/xforms-server-submit HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9)
Gecko/20071025 Firefox/2.0.0.9
Accept:
text/xml,application/xml,application/xhtml+xml,text/html;q=0.9,text/plai
n;q=0.8,image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8080/umadmin/testIFrame.do
Content-Type: application/x-www-form-urlencoded
Content-Length: 2557
%24static-state=pers%3AE5F6A3BC-D667-FBEF-B1BA-EFCFCFC23F56&%24dynamic-s
tate=pers%3A62E808AA-C0CF-A6F5-9441-70497304F6FF&%24server-events=X2y6DZ
%2F6qm2DVz4pc7gQetVFdwYLFlFokpCDQb04GpgzGG%2FkdDmKhnMt31ZdCea7pTliVMbQd6
Omje+VLN4EzVDYI870hLfsCc9nFZNuKD97XIOALr2%2Fr5SzoDpLvkCrqOhr5IQvU5uqSEiL
QczGb5pY9R5+4x5YFtrpCxM7J2pgtLuu%2F%2B3cmXkrdXvGCM0H%2BMUAbjDae%2F%2BBG6
h2e1jXixz5PKIR9hFPQIe2ZgPh+hyajGCLOgfCqmkt1VwaLQEEGaHTP&%24client-state=
ajax-dynamic-state%26pers%253A62E808AA-C0CF-A6F5-9441-70497304F6FF%26ini
tial-dynamic-state%26pers%253A032BD484-EFFD-972A-1F90-30CC120FC550%26loa
d-did-run%26true&%24repeat-tree=line-repeat-credit%2Cline-repeat-debit%2
CrepeatManualDocuments&%24repeat-indexes=repeatManualDocuments+1%2Cline-
repeat-credit+1%2Cline-repeat-debit+1&xforms-element-27=&xforms-element-
60=%E3%80%92102-0094%E5%8D%83%E4%BB%A3%E7%94%B0%E5%8C%BA%E7%B4%80%E5%B0%
BE%E4%BA%95%E7%94%BA%EF%BC%94%EF%BC%8D%EF%BC%91%E3%83%8B%E3%83%A5%E3%83%
BC%E3%82%AA%E3%83%BC%E3%82%BF%E3%83%8B%E3%82%AC%E3%83%BC%E3%83%87%E3%83%
B3%E3%82%B3%E3%83%BC%E3%83%88%EF%BC%92%EF%BC%91%E9%9A%8E%E6%A0%AA%E5%BC%
8F%E4%BC%9A%E7%A4%BE%EF%BC%B5%EF%BC%B3%EF%BC%B3%E8%A8%BC%E5%88%B8%E6%B3%
95%E4%BA%BA%E6%A5%AD%E5%8B%99%E9%83%A8%E5%B1%B1%E5%B2%B8%E5%85%83%E7%B4%
80%E3%80%80%E6%A7%98&xforms-element-61=%E3%80%92102-0094%E6%9D%B1%E4%BA%
AC%E9%83%BD%E5%8D%83%E4%BB%A3%E7%94%B0%E5%8C%BA%E7%B4%80%E5%B0%BE%E4%BA%
95%E7%94%BA%EF%BC%94%EF%BC%8D%EF%BC%91%EF%BE%86%EF%BD%AD%EF%BD%B0%EF%BD%
B5%EF%BD%B0%EF%BE%80%EF%BE%86%EF%BD%B6%EF%BE%9E%EF%BD%B0%EF%BE%83%EF%BE%
9E%EF%BE%9D%EF%BD%BA%EF%BD%B0%EF%BE%84%EF%BC%92%EF%BC%91%E9%9A%8E&xforms
-element-64%C2%B71=283974&xforms-element-65%C2%B71=%E6%B6%B2%E6%99%B6%E3
%83%91%E3%83%8D%E3%83%AB%EF%BC%91%EF%BC%95%E3%82%A4%E3%83%B3%E3%83%81&xf
orms-element-66%C2%B71=2006-02-01&xforms-element-67%C2%B71=2006-02-28&xf
orms-element-68%C2%B71=-2&xforms-element-69%C2%B71=6&xforms-element-72%C
2%B71=&xforms-element-77%C2%B71=%E5%BE%A1%E8%A7%A3%E7%B4%84&xforms-eleme
nt-64=&xforms-element-65=&xforms-element-66=&xforms-element-67=&xforms-e
lement-68=&xforms-element-69=&xforms-element-77=&xforms-element-93%C2%B7
1=283975&xforms-element-94%C2%B71=%E6%B6%B2%E6%99%B6%E3%83%91%E3%83%8D%E
3%83%AB%EF%BC%91%EF%BC%95%E3%82%A4%E3%83%B3%E3%83%81&xforms-element-95%C
2%B71=2006-01-01&xforms-element-96%C2%B71=2006-01-31&xforms-element-97%C
2%B71=-2&xforms-element-98%C2%B71=6000&xforms-element-101%C2%B71=&xforms
-element-106%C2%B71=%E5%BE%A1%E8%A7%A3%E7%B4%84&xforms-element-93=&xform
s-element-94=&xforms-element-95=&xforms-element-96=&xforms-element-97=&x
forms-element-98=&xforms-element-106=
HTTP/1.x 200 OK
Server: Apache-Coyote/1.1, Apache-Coyote/1.1
Set-Cookie: JSESSIONID=196D593B2B400B583C1571B9B4408B32; Path=/umadmin
Date: Wed, 14 Nov 2007 18:12:28 GMT
Content-Type: text/html;charset=UTF-8
Transfer-Encoding: chunked
----------------------------------------------------------
http://localhost:8080/config/theme/xforms-widgets.css

GET /config/theme/xforms-widgets.css HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9)
Gecko/20071025 Firefox/2.0.0.9
Accept: text/css,*/*;q=0.1
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8080/ops/xforms-server-submit

HTTP/1.x 404 /config/theme/xforms-widgets.css
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Length: 1048
Date: Wed, 14 Nov 2007 18:12:28 GMT
----------------------------------------------------------
http://localhost:8080/umadmin/js/calendar/calendar.js;jsessionid=196D593
B2B400B583C1571B9B4408B32

GET
/umadmin/js/calendar/calendar.js;jsessionid=196D593B2B400B583C1571B9B440
8B32 HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9)
Gecko/20071025 Firefox/2.0.0.9
Accept: */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8080/ops/xforms-server-submit
Cookie: siteStyle=default; JSESSIONID=196D593B2B400B583C1571B9B4408B32

HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
Etag: W/"51541-1195046193390"
Last-Modified: Wed, 14 Nov 2007 13:16:33 GMT
Content-Type: text/javascript
Content-Length: 51541
Date: Wed, 14 Nov 2007 18:12:28 GMT
----------------------------------------------------------
http://localhost:8080/umadmin/js/calendar/lang/calendar-en.js;jsessionid
=196D593B2B400B583C1571B9B4408B32

GET
/umadmin/js/calendar/lang/calendar-en.js;jsessionid=196D593B2B400B583C15
71B9B4408B32 HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9)
Gecko/20071025 Firefox/2.0.0.9
Accept: */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8080/ops/xforms-server-submit
Cookie: siteStyle=default; JSESSIONID=196D593B2B400B583C1571B9B4408B32

HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
Etag: W/"3727-1195046195265"
Last-Modified: Wed, 14 Nov 2007 13:16:35 GMT
Content-Type: text/javascript
Content-Length: 3727
Date: Wed, 14 Nov 2007 18:12:28 GMT
----------------------------------------------------------
http://localhost:8080/umadmin/js/calendar/calendar-setup.js;jsessionid=1
96D593B2B400B583C1571B9B4408B32

GET
/umadmin/js/calendar/calendar-setup.js;jsessionid=196D593B2B400B583C1571
B9B4408B32 HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9)
Gecko/20071025 Firefox/2.0.0.9
Accept: */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8080/ops/xforms-server-submit
Cookie: siteStyle=default; JSESSIONID=196D593B2B400B583C1571B9B4408B32

HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
Etag: W/"9048-1195046199562"
Last-Modified: Wed, 14 Nov 2007 13:16:39 GMT
Content-Type: text/javascript
Content-Length: 9048
Date: Wed, 14 Nov 2007 18:12:28 GMT
----------------------------------------------------------
http://localhost:8080/umadmin/style/default/images/up.gif;jsessionid=196
D593B2B400B583C1571B9B4408B32

GET
/umadmin/style/default/images/up.gif;jsessionid=196D593B2B400B583C1571B9
B4408B32 HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9)
Gecko/20071025 Firefox/2.0.0.9
Accept: image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8080/ops/xforms-server-submit
Cookie: siteStyle=default; JSESSIONID=196D593B2B400B583C1571B9B4408B32

HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
Etag: W/"2244-1195046196812"
Last-Modified: Wed, 14 Nov 2007 13:16:36 GMT
Content-Type: image/gif
Content-Length: 2244
Date: Wed, 14 Nov 2007 18:12:28 GMT
----------------------------------------------------------
http://localhost:8080/umadmin/style/default/images/headerIcon.png;jsessi
onid=196D593B2B400B583C1571B9B4408B32

GET
/umadmin/style/default/images/headerIcon.png;jsessionid=196D593B2B400B58
3C1571B9B4408B32 HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9)
Gecko/20071025 Firefox/2.0.0.9
Accept: image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8080/ops/xforms-server-submit
Cookie: siteStyle=default; JSESSIONID=196D593B2B400B583C1571B9B4408B32

HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
Etag: W/"1606-1195046202187"
Last-Modified: Wed, 14 Nov 2007 13:16:42 GMT
Content-Type: image/png
Content-Length: 1606
Date: Wed, 14 Nov 2007 18:12:28 GMT
----------------------------------------------------------
http://localhost:8080/umadmin/style/common/images/stamp.gif;jsessionid=1
96D593B2B400B583C1571B9B4408B32

GET
/umadmin/style/common/images/stamp.gif;jsessionid=196D593B2B400B583C1571
B9B4408B32 HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9)
Gecko/20071025 Firefox/2.0.0.9
Accept: image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8080/ops/xforms-server-submit
Cookie: siteStyle=default; JSESSIONID=196D593B2B400B583C1571B9B4408B32

HTTP/1.x 200 OK
Server: Apache-Coyote/1.1
Etag: W/"1667-1195046199328"
Last-Modified: Wed, 14 Nov 2007 13:16:39 GMT
Content-Type: image/gif
Content-Length: 1667
Date: Wed, 14 Nov 2007 18:12:28 GMT
----------------------------------------------------------
http://localhost:8080/umadmin/style/common/images/postcard.gif

GET /umadmin/style/common/images/postcard.gif HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9)
Gecko/20071025 Firefox/2.0.0.9
Accept: image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8080/ops/xforms-server-submit
Cookie: siteStyle=default; JSESSIONID=196D593B2B400B583C1571B9B4408B32
If-Modified-Since: Wed, 14 Nov 2007 13:16:29 GMT
If-None-Match: W/"3024-1195046189453"

HTTP/1.x 304 Not Modified
Server: Apache-Coyote/1.1
Date: Wed, 14 Nov 2007 18:12:28 GMT
----------------------------------------------------------
http://localhost:8080/ops/style/default/images/headerbg.png

GET /ops/style/default/images/headerbg.png HTTP/1.1
Host: localhost:8080
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.8.1.9)
Gecko/20071025 Firefox/2.0.0.9
Accept: image/png,*/*;q=0.5
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 300
Connection: keep-alive
Referer: http://localhost:8080/ops/xforms-server-submit

HTTP/1.x 404 Not Found
Server: Apache-Coyote/1.1
Content-Type: text/html;charset=utf-8
Content-Length: 952
Date: Wed, 14 Nov 2007 18:12:28 GMT
----------------------------------------------------------


Cheers,
Gerrit

 

-----Original Message-----
From: Erik Bruchez [mailto:[hidden email]] On Behalf Of Erik Bruchez
Sent: Wednesday, November 14, 2007 18:09 PM
To: [hidden email]
Subject: Re: [ops-users] submitting with method "post" and loosing
session attributes

Gerrit Germis wrote:
> Hi,
>
> I'm using struts/tiles with the nightly build of xforms (separartely
> deployed). I have successfully created and populated my xform, but
now,
> when I try to submit the results back to another action using the
"post"

> method, I loose my profile information that was stored in the session.
> This is what my submission looks like:
>
>    <xforms:submission id="test-submit"
>        action="http://localhost:8080/umadmin/someAction" method="post"
>        ref="instance('document-instance')/data/DocumentRevision"
> replace="all"/>
>
>    <xforms:submit submission="test-submit">
>        <xforms:label>Go to action!</xforms:label>
>    </xforms:submit>
>
> The complete flow is like this:
>
>  - setup: /xforms-jsp/* is setup to be filtered by OPS
>  - User logs into the website, profile information is stored in
session
>  - form is generated by navigating to URL:
> http://localhost:8080/umadmin/xforms-jsp/some-app
>  - User fills in data
>  - User presses the submit button labeled "Go to action!" mentioned
> above
>  - PROBLEM: user is prompted for login again since no profile
> information was found in session
>
> How can I make sure the profile information is not lost on submission?

When doing a submission, we do forward the JSESSIONID cookie so the
session should be kept. Would /umadmin/ share the same session as the
external URL producing the XForms page?

-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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: submitting with method "post" and loosing session attributes

Chaminda
In reply to this post by Gerrit Germis-2
Hi Gerrit,

Sorry for replying your thread to, This is not an answer for you problem. According to your problem I guess you are familiar with this. Thats why Im posing my problem here,

I want to send request to a servlet and in the servlet set a request attribute. Upto that part I know. But I  dont know how to dispatch the request to XHTML other that JSP.


In JSP we do like this

dispatcher.forward("/WEB-INF/Jsp/my.jsp");

How can I do this for xhtml,

Thanks, Sorry again for posing to here


Gerrit Germis-2 wrote
Hi,

I'm using struts/tiles with the nightly build of xforms (separartely
deployed). I have successfully created and populated my xform, but now,
when I try to submit the results back to another action using the "post"
method, I loose my profile information that was stored in the session.
This is what my submission looks like:

   <xforms:submission id="test-submit"
       action="http://localhost:8080/umadmin/someAction" method="post"
       ref="instance('document-instance')/data/DocumentRevision"
replace="all"/>

   <xforms:submit submission="test-submit">
       <xforms:label>Go to action!</xforms:label>
   </xforms:submit>

The complete flow is like this:

 - setup: /xforms-jsp/* is setup to be filtered by OPS
 - User logs into the website, profile information is stored in session
 - form is generated by navigating to URL:
http://localhost:8080/umadmin/xforms-jsp/some-app
 - User fills in data
 - User presses the submit button labeled "Go to action!" mentioned
above
 - PROBLEM: user is prompted for login again since no profile
information was found in session

How can I make sure the profile information is not lost on submission?

Sincerely
Gerrit



--
You receive this message as a subscriber of the ops-users@ow2.org mailing list.
To unsubscribe: mailto:ops-users-unsubscribe@ow2.org
For general help: mailto:sympa@ow2.org?subject=help
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

RE: submitting with method "post" and loosing session attributes

Gerrit Germis-2
In reply to this post by Gerrit Germis-2
Hi Chaminda,

I'm also new to orbeon and xforms, so this might not be (most probably)
the correct way to do it, but it seems to be working for us so far.
Here's how we set things up:

- Our webapp is at /umadmin
- Separate deployment to /ops
- In the /umadmin context, the /umadmin/xforms-jsp/* is filtered by OPS,
so this is where we put the .jsp file that generates the XHTML/Xforms
output (or in your case, you could simply put the .xhtml file somewhere
in that directory). As a side-note, maybe also tell you that you
shouldn't put the .xml files that you load from the xform itself in any
directory in /umadmin/xforms-jsp/*.. I've lost a lot of time being
puzzled by why it wasn't working...
- We created a HttpServletResponseWrapper object to be able to capture
the output of the page generated by Xforms (see later)
- We add a cookie (JSESSIONID) with a path of "/" to that response
object so it is accessible by both contexts and we don't loose our
profile information put in the session during login
- From within the servlet, we do a forward to the /xforms-jsp/* URL that
generates the actual form and capture the output generated by OPS:

RequestDispatcher rd =
servlet.getServletContext().getRequestDispatcher("/xforms-jsp/our-app/in
dex.xhtml");
rd.forward(request, new MyHttpServletResponseWrapper(response));
form.setHTML(response.toString());
return mapping.findForward("success");

- This way, we can create a .jsp file and use "<%= form.getHTML() %>" in
the JSP file to actually include the generated form wherever we want in
the page.
- As an additional benefit, this way of doing it allows us to use tiles
too

- Next problem was when submitting the data in the form, this would give
us a URL like: http://localhost:8080/ops/xforms-server-submit which we
didn't want, so here's how we "fixed" this:

The target of the submission defined in the xform is another struts
action. We defined a global forward in the struts-config.xml having the
'redirect="true"' attribute pointing to the first action again. After
doing the processing on the submitted data (by processing the
request.getInputStream()), we simply do a
'mapping.findForward("ourforward");' which makes the client re-request
the original .jsp file generating the form again...


Again, I emphasise that this is probably not the way of working with
Xforms, so any suggestions or remarks are most welcome..

Hope this helps,
Gerrit



-----Original Message-----
From: Chaminda [mailto:[hidden email]]
Sent: Friday, November 16, 2007 10:34 AM
To: [hidden email]
Subject: Re: [ops-users] submitting with method "post" and loosing
session attributes


Hi Gerrit,

Sorry for replying your thread to, This is not an answer for you
problem.
According to your problem I guess you are familiar with this. Thats why
Im
posing my problem here,

I want to send request to a servlet and in the servlet set a request
attribute. Upto that part I know. But I  dont know how to dispatch the
request to XHTML other that JSP.


In JSP we do like this

dispatcher.forward("/WEB-INF/Jsp/my.jsp");

How can I do this for xhtml,

Thanks, Sorry again for posing to here



Gerrit Germis-2 wrote:
>
> Hi,
>
> I'm using struts/tiles with the nightly build of xforms (separartely
> deployed). I have successfully created and populated my xform, but
now,
> when I try to submit the results back to another action using the
"post"

> method, I loose my profile information that was stored in the session.
> This is what my submission looks like:
>
>    <xforms:submission id="test-submit"
>        action="http://localhost:8080/umadmin/someAction" method="post"
>        ref="instance('document-instance')/data/DocumentRevision"
> replace="all"/>
>
>    <xforms:submit submission="test-submit">
>        <xforms:label>Go to action!</xforms:label>
>    </xforms:submit>
>
> The complete flow is like this:
>
>  - setup: /xforms-jsp/* is setup to be filtered by OPS
>  - User logs into the website, profile information is stored in
session

>  - form is generated by navigating to URL:
> http://localhost:8080/umadmin/xforms-jsp/some-app
>  - User fills in data
>  - User presses the submit button labeled "Go to action!" mentioned
> above
>  - PROBLEM: user is prompted for login again since no profile
> information was found in session
>
> How can I make sure the profile information is not lost on submission?
>
> Sincerely
> Gerrit
>
>
>
> --
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
>
>

--
View this message in context:
http://www.nabble.com/submitting-with-method-%22post%22-and-loosing-sess
ion-attributes-tf4803253.html#a13790034
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: submitting with method "post" and loosing session attributes

Erik Bruchez
Administrator
Gerrit,

This is not just one way of using XForms or Orbeon Forms, so don't  
worry about doing something wrong. If the solution works for you, then  
that's great. So thanks for sharing it on the list!

-Erik


On Nov 16, 2007, at 11:43 AM, Gerrit Germis wrote:

> Hi Chaminda,
>
> I'm also new to orbeon and xforms, so this might not be (most  
> probably)
> the correct way to do it, but it seems to be working for us so far.
> Here's how we set things up:
>
> - Our webapp is at /umadmin
> - Separate deployment to /ops
> - In the /umadmin context, the /umadmin/xforms-jsp/* is filtered by  
> OPS,
> so this is where we put the .jsp file that generates the XHTML/Xforms
> output (or in your case, you could simply put the .xhtml file  
> somewhere
> in that directory). As a side-note, maybe also tell you that you
> shouldn't put the .xml files that you load from the xform itself in  
> any
> directory in /umadmin/xforms-jsp/*.. I've lost a lot of time being
> puzzled by why it wasn't working...
> - We created a HttpServletResponseWrapper object to be able to capture
> the output of the page generated by Xforms (see later)
> - We add a cookie (JSESSIONID) with a path of "/" to that response
> object so it is accessible by both contexts and we don't loose our
> profile information put in the session during login
> - From within the servlet, we do a forward to the /xforms-jsp/* URL  
> that
> generates the actual form and capture the output generated by OPS:
>
> RequestDispatcher rd =
> servlet.getServletContext().getRequestDispatcher("/xforms-jsp/our-
> app/in
> dex.xhtml");
> rd.forward(request, new MyHttpServletResponseWrapper(response));
> form.setHTML(response.toString());
> return mapping.findForward("success");
>
> - This way, we can create a .jsp file and use "<%= form.getHTML()  
> %>" in
> the JSP file to actually include the generated form wherever we want  
> in
> the page.
> - As an additional benefit, this way of doing it allows us to use  
> tiles
> too
>
> - Next problem was when submitting the data in the form, this would  
> give
> us a URL like: http://localhost:8080/ops/xforms-server-submit which we
> didn't want, so here's how we "fixed" this:
>
> The target of the submission defined in the xform is another struts
> action. We defined a global forward in the struts-config.xml having  
> the
> 'redirect="true"' attribute pointing to the first action again. After
> doing the processing on the submitted data (by processing the
> request.getInputStream()), we simply do a
> 'mapping.findForward("ourforward");' which makes the client re-request
> the original .jsp file generating the form again...
>
>
> Again, I emphasise that this is probably not the way of working with
> Xforms, so any suggestions or remarks are most welcome..
>
> Hope this helps,
> Gerrit
>
>
>
> -----Original Message-----
> From: Chaminda [mailto:[hidden email]]
> Sent: Friday, November 16, 2007 10:34 AM
> To: [hidden email]
> Subject: Re: [ops-users] submitting with method "post" and loosing
> session attributes
>
>
> Hi Gerrit,
>
> Sorry for replying your thread to, This is not an answer for you
> problem.
> According to your problem I guess you are familiar with this. Thats  
> why
> Im
> posing my problem here,
>
> I want to send request to a servlet and in the servlet set a request
> attribute. Upto that part I know. But I  dont know how to dispatch the
> request to XHTML other that JSP.
>
>
> In JSP we do like this
>
> dispatcher.forward("/WEB-INF/Jsp/my.jsp");
>
> How can I do this for xhtml,
>
> Thanks, Sorry again for posing to here
>
>
>
> Gerrit Germis-2 wrote:
>>
>> Hi,
>>
>> I'm using struts/tiles with the nightly build of xforms (separartely
>> deployed). I have successfully created and populated my xform, but
> now,
>> when I try to submit the results back to another action using the
> "post"
>> method, I loose my profile information that was stored in the  
>> session.
>> This is what my submission looks like:
>>
>>   <xforms:submission id="test-submit"
>>       action="http://localhost:8080/umadmin/someAction" method="post"
>>       ref="instance('document-instance')/data/DocumentRevision"
>> replace="all"/>
>>
>>   <xforms:submit submission="test-submit">
>>       <xforms:label>Go to action!</xforms:label>
>>   </xforms:submit>
>>
>> The complete flow is like this:
>>
>> - setup: /xforms-jsp/* is setup to be filtered by OPS
>> - User logs into the website, profile information is stored in
> session
>> - form is generated by navigating to URL:
>> http://localhost:8080/umadmin/xforms-jsp/some-app
>> - User fills in data
>> - User presses the submit button labeled "Go to action!" mentioned
>> above
>> - PROBLEM: user is prompted for login again since no profile
>> information was found in session
>>
>> How can I make sure the profile information is not lost on  
>> submission?
>>
>> Sincerely
>> Gerrit
>>
>>
>>
>> --
>> 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
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>
>>
>
> --
> View this message in context:
> http://www.nabble.com/submitting-with-method-%22post%22-and-loosing-sess
> ion-attributes-tf4803253.html#a13790034
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: submitting with method "post" and loosing session attributes

Markku Laine
Hi Erik,


I have also faced the same problem before, i.e. loosing session
attributes when submitting with method "post" (on the first submission
only), but unfortunately I haven't found a working solution yet.

I attached a simple example web application (servlet) which reproduces the
problem. When the servlet is requested (e.g.,
http://localhost:8080/OFSession), the doGet() method responses with a
generated XHTML+XForms page. The generated page contains the following
data:
  *Current (at the time when doGet() method was being processed) session ID
  *Current (at the time when doGet() method was being processed) & stored
attribute value (i.e. session ID)


The generated page also contains XForms markup, which submits a request
with method "post" to the servlet. The servlet responses with an
XML document. The XML document contains the following data:
  *Current (at the time when doPost() method was being processed) session
ID
  *Current (at the time when doPost() method was being processed) & stored
attribute value (i.e. session ID)


Logically, all four values ought to be same, right?. However, if the
XForms request is submitted automatically upon the "xforms-ready" event,
then on the first time/submission the session ID has changed and,
therefore, also the stored session attribute value is null (cannot be
found from this session because it is the same session where to the
attribute was set). If the request is submitted again (CTRL+F5 in
Firefox), then the values match.

If the XForms request is submitted manually, i.e. by clicking a
button/trigger, then all four values are the same even on the first
time/submission. In addition, the example works fine also when used
without Orbeon Forms XForms Engine (ops xforms filter turned off and using
Mozilla XForms plug-in).

I'm using Orbeon Forms 3.6.0rc1 (filter set the the URL "/*") with
standard configurations. You can test the example/behaviour with
manual/automatic submission by commenting two lines (marked) in the
servlet.SessionTesterServlet.java class (lines 56 and 67.

Is this a bug in Oreon Forms? If not, how do I need to modify my example
web application to make it work also on the first time/submission?

Best regards


-Markku Laine

On Fri, 16 Nov 2007, Erik Bruchez wrote:

> Gerrit,
>
> This is not just one way of using XForms or Orbeon Forms, so don't worry
> about doing something wrong. If the solution works for you, then that's
> great. So thanks for sharing it on the list!
>
> -Erik
>
>
> On Nov 16, 2007, at 11:43 AM, Gerrit Germis wrote:
>
>> Hi Chaminda,
>>
>> I'm also new to orbeon and xforms, so this might not be (most probably)
>> the correct way to do it, but it seems to be working for us so far.
>> Here's how we set things up:
>>
>> - Our webapp is at /umadmin
>> - Separate deployment to /ops
>> - In the /umadmin context, the /umadmin/xforms-jsp/* is filtered by OPS,
>> so this is where we put the .jsp file that generates the XHTML/Xforms
>> output (or in your case, you could simply put the .xhtml file somewhere
>> in that directory). As a side-note, maybe also tell you that you
>> shouldn't put the .xml files that you load from the xform itself in any
>> directory in /umadmin/xforms-jsp/*.. I've lost a lot of time being
>> puzzled by why it wasn't working...
>> - We created a HttpServletResponseWrapper object to be able to capture
>> the output of the page generated by Xforms (see later)
>> - We add a cookie (JSESSIONID) with a path of "/" to that response
>> object so it is accessible by both contexts and we don't loose our
>> profile information put in the session during login
>> - From within the servlet, we do a forward to the /xforms-jsp/* URL that
>> generates the actual form and capture the output generated by OPS:
>>
>> RequestDispatcher rd =
>> servlet.getServletContext().getRequestDispatcher("/xforms-jsp/our-app/in
>> dex.xhtml");
>> rd.forward(request, new MyHttpServletResponseWrapper(response));
>> form.setHTML(response.toString());
>> return mapping.findForward("success");
>>
>> - This way, we can create a .jsp file and use "<%= form.getHTML() %>" in
>> the JSP file to actually include the generated form wherever we want in
>> the page.
>> - As an additional benefit, this way of doing it allows us to use tiles
>> too
>>
>> - Next problem was when submitting the data in the form, this would give
>> us a URL like: http://localhost:8080/ops/xforms-server-submit which we
>> didn't want, so here's how we "fixed" this:
>>
>> The target of the submission defined in the xform is another struts
>> action. We defined a global forward in the struts-config.xml having the
>> 'redirect="true"' attribute pointing to the first action again. After
>> doing the processing on the submitted data (by processing the
>> request.getInputStream()), we simply do a
>> 'mapping.findForward("ourforward");' which makes the client re-request
>> the original .jsp file generating the form again...
>>
>>
>> Again, I emphasise that this is probably not the way of working with
>> Xforms, so any suggestions or remarks are most welcome..
>>
>> Hope this helps,
>> Gerrit
>>
>>
>>
>> -----Original Message-----
>> From: Chaminda [mailto:[hidden email]]
>> Sent: Friday, November 16, 2007 10:34 AM
>> To: [hidden email]
>> Subject: Re: [ops-users] submitting with method "post" and loosing
>> session attributes
>>
>>
>> Hi Gerrit,
>>
>> Sorry for replying your thread to, This is not an answer for you
>> problem.
>> According to your problem I guess you are familiar with this. Thats why
>> Im
>> posing my problem here,
>>
>> I want to send request to a servlet and in the servlet set a request
>> attribute. Upto that part I know. But I  dont know how to dispatch the
>> request to XHTML other that JSP.
>>
>>
>> In JSP we do like this
>>
>> dispatcher.forward("/WEB-INF/Jsp/my.jsp");
>>
>> How can I do this for xhtml,
>>
>> Thanks, Sorry again for posing to here
>>
>>
>>
>> Gerrit Germis-2 wrote:
>> >
>> > Hi,
>> >
>> > I'm using struts/tiles with the nightly build of xforms (separartely
>> > deployed). I have successfully created and populated my xform, but
>> now,
>> > when I try to submit the results back to another action using the
>> "post"
>> > method, I loose my profile information that was stored in the session.
>> > This is what my submission looks like:
>> >
>> >   <xforms:submission id="test-submit"
>> >       action="http://localhost:8080/umadmin/someAction" method="post"
>> >       ref="instance('document-instance')/data/DocumentRevision"
>> > replace="all"/>
>> >
>> >   <xforms:submit submission="test-submit">
>> >       <xforms:label>Go to action!</xforms:label>
>> >   </xforms:submit>
>> >
>> > The complete flow is like this:
>> >
>> > - setup: /xforms-jsp/* is setup to be filtered by OPS
>> > - User logs into the website, profile information is stored in
>> session
>> > - form is generated by navigating to URL:
>> > http://localhost:8080/umadmin/xforms-jsp/some-app
>> > - User fills in data
>> > - User presses the submit button labeled "Go to action!" mentioned
>> > above
>> > - PROBLEM: user is prompted for login again since no profile
>> > information was found in session
>> >
>> > How can I make sure the profile information is not lost on submission?
>> >
>> > Sincerely
>> > Gerrit
>> >
>> >
>> >
>> > --
>> > 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
>> > OW2 mailing lists service home page: http://www.ow2.org/wws
>> >
>> >
>>
>> --
>> View this message in context:
>> http://www.nabble.com/submitting-with-method-%22post%22-and-loosing-sess
>> ion-attributes-tf4803253.html#a13790034
>> 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
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>
> --
> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
> http://www.orbeon.com/
>
>
--
Markku Laine <[hidden email]>
Research assistant, Helsinki University of Technology
Telecommunications Software and Multimedia Laboratory
P.O.Box 5400, FIN-02015 HUT, FINLAND
Mobile. +358-50-565 8179 (Finland)
Mobile.  +64-21-037 3605 (New Zealand, 01 Oct - 21 Dec, 2007)

--
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
OW2 mailing lists service home page: http://www.ow2.org/wws

OFSession.war (14K) Download Attachment
Reply | Threaded
Open this post in threaded view
|

Re: submitting with method "post" and loosing session attributes

Erik Bruchez
Administrator
Markku,

Thanks for the reproducible example. I will try to have a look at this  
ASAP.

-Erik

On Nov 28, 2007, at 3:24 AM, .::: Markku :::. wrote:

> Hi Erik,
>
>
> I have also faced the same problem before, i.e. loosing session  
> attributes when submitting with method "post" (on the first  
> submission only), but unfortunately I haven't found a working  
> solution yet.
>
> I attached a simple example web application (servlet) which  
> reproduces the problem. When the servlet is requested (e.g., http://localhost:8080/OFSession)
> , the doGet() method responses with a generated XHTML+XForms page.  
> The generated page contains the following data:
> *Current (at the time when doGet() method was being processed)  
> session ID
> *Current (at the time when doGet() method was being processed) &  
> stored attribute value (i.e. session ID)
>
>
> The generated page also contains XForms markup, which submits a  
> request with method "post" to the servlet. The servlet responses  
> with an XML document. The XML document contains the following data:
> *Current (at the time when doPost() method was being processed)  
> session ID
> *Current (at the time when doPost() method was being processed) &  
> stored attribute value (i.e. session ID)
>
>
> Logically, all four values ought to be same, right?. However, if the  
> XForms request is submitted automatically upon the "xforms-ready"  
> event, then on the first time/submission the session ID has changed  
> and, therefore, also the stored session attribute value is null  
> (cannot be found from this session because it is the same session  
> where to the attribute was set). If the request is submitted again  
> (CTRL+F5 in Firefox), then the values match.
>
> If the XForms request is submitted manually, i.e. by clicking a  
> button/trigger, then all four values are the same even on the first  
> time/submission. In addition, the example works fine also when used  
> without Orbeon Forms XForms Engine (ops xforms filter turned off and  
> using Mozilla XForms plug-in).
>
> I'm using Orbeon Forms 3.6.0rc1 (filter set the the URL "/*") with  
> standard configurations. You can test the example/behaviour with  
> manual/automatic submission by commenting two lines (marked) in the  
> servlet.SessionTesterServlet.java class (lines 56 and 67.
>
> Is this a bug in Oreon Forms? If not, how do I need to modify my  
> example web application to make it work also on the first time/
> submission?
>
> Best regards
>
>
> -Markku Laine
>
> On Fri, 16 Nov 2007, Erik Bruchez wrote:
>
>> Gerrit,
>>
>> This is not just one way of using XForms or Orbeon Forms, so don't  
>> worry about doing something wrong. If the solution works for you,  
>> then that's great. So thanks for sharing it on the list!
>>
>> -Erik
>>
>>
>> On Nov 16, 2007, at 11:43 AM, Gerrit Germis wrote:
>>
>>> Hi Chaminda,
>>> I'm also new to orbeon and xforms, so this might not be (most  
>>> probably)
>>> the correct way to do it, but it seems to be working for us so far.
>>> Here's how we set things up:
>>> - Our webapp is at /umadmin
>>> - Separate deployment to /ops
>>> - In the /umadmin context, the /umadmin/xforms-jsp/* is filtered  
>>> by OPS,
>>> so this is where we put the .jsp file that generates the XHTML/
>>> Xforms
>>> output (or in your case, you could simply put the .xhtml file  
>>> somewhere
>>> in that directory). As a side-note, maybe also tell you that you
>>> shouldn't put the .xml files that you load from the xform itself  
>>> in any
>>> directory in /umadmin/xforms-jsp/*.. I've lost a lot of time being
>>> puzzled by why it wasn't working...
>>> - We created a HttpServletResponseWrapper object to be able to  
>>> capture
>>> the output of the page generated by Xforms (see later)
>>> - We add a cookie (JSESSIONID) with a path of "/" to that response
>>> object so it is accessible by both contexts and we don't loose our
>>> profile information put in the session during login
>>> - From within the servlet, we do a forward to the /xforms-jsp/*  
>>> URL that
>>> generates the actual form and capture the output generated by OPS:
>>> RequestDispatcher rd =
>>> servlet.getServletContext().getRequestDispatcher("/xforms-jsp/our-
>>> app/in
>>> dex.xhtml");
>>> rd.forward(request, new MyHttpServletResponseWrapper(response));
>>> form.setHTML(response.toString());
>>> return mapping.findForward("success");
>>> - This way, we can create a .jsp file and use "<%= form.getHTML()  
>>> %>" in
>>> the JSP file to actually include the generated form wherever we  
>>> want in
>>> the page.
>>> - As an additional benefit, this way of doing it allows us to use  
>>> tiles
>>> too
>>> - Next problem was when submitting the data in the form, this  
>>> would give
>>> us a URL like: http://localhost:8080/ops/xforms-server-submit 
>>> which we
>>> didn't want, so here's how we "fixed" this:
>>> The target of the submission defined in the xform is another struts
>>> action. We defined a global forward in the struts-config.xml  
>>> having the
>>> 'redirect="true"' attribute pointing to the first action again.  
>>> After
>>> doing the processing on the submitted data (by processing the
>>> request.getInputStream()), we simply do a
>>> 'mapping.findForward("ourforward");' which makes the client re-
>>> request
>>> the original .jsp file generating the form again...
>>> Again, I emphasise that this is probably not the way of working with
>>> Xforms, so any suggestions or remarks are most welcome..
>>> Hope this helps,
>>> Gerrit
>>> -----Original Message-----
>>> From: Chaminda [mailto:[hidden email]]
>>> Sent: Friday, November 16, 2007 10:34 AM
>>> To: [hidden email]
>>> Subject: Re: [ops-users] submitting with method "post" and loosing
>>> session attributes
>>> Hi Gerrit,
>>> Sorry for replying your thread to, This is not an answer for you
>>> problem.
>>> According to your problem I guess you are familiar with this.  
>>> Thats why
>>> Im
>>> posing my problem here,
>>> I want to send request to a servlet and in the servlet set a request
>>> attribute. Upto that part I know. But I  dont know how to dispatch  
>>> the
>>> request to XHTML other that JSP.
>>> In JSP we do like this
>>> dispatcher.forward("/WEB-INF/Jsp/my.jsp");
>>> How can I do this for xhtml,
>>> Thanks, Sorry again for posing to here
>>> Gerrit Germis-2 wrote:
>>> > > Hi,
>>> > > I'm using struts/tiles with the nightly build of xforms  
>>> (separartely
>>> > deployed). I have successfully created and populated my xform, but
>>> now,
>>> > when I try to submit the results back to another action using the
>>> "post"
>>> > method, I loose my profile information that was stored in the  
>>> session.
>>> > This is what my submission looks like:
>>> > >   <xforms:submission id="test-submit"
>>> >       action="http://localhost:8080/umadmin/someAction"  
>>> method="post"
>>> >       ref="instance('document-instance')/data/DocumentRevision"
>>> > replace="all"/>
>>> > >   <xforms:submit submission="test-submit">
>>> >       <xforms:label>Go to action!</xforms:label>
>>> >   </xforms:submit>
>>> > > The complete flow is like this:
>>> > > - setup: /xforms-jsp/* is setup to be filtered by OPS
>>> > - User logs into the website, profile information is stored in
>>> session
>>> > - form is generated by navigating to URL:
>>> > http://localhost:8080/umadmin/xforms-jsp/some-app
>>> > - User fills in data
>>> > - User presses the submit button labeled "Go to action!" mentioned
>>> > above
>>> > - PROBLEM: user is prompted for login again since no profile
>>> > information was found in session
>>> > > How can I make sure the profile information is not lost on  
>>> submission?
>>> > > Sincerely
>>> > Gerrit
>>> > > > > --
>>> > 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
>>> > OW2 mailing lists service home page: http://www.ow2.org/wws
>>> > > --
>>> View this message in context:
>>> http://www.nabble.com/submitting-with-method-%22post%22-and-loosing-sess
>>> ion-attributes-tf4803253.html#a13790034
>>> 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
>>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>
>> --
>> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>> http://www.orbeon.com/
>>
>>
>
> --
> Markku Laine <[hidden email]>
> Research assistant, Helsinki University of Technology
> Telecommunications Software and Multimedia Laboratory
> P.O.Box 5400, FIN-02015 HUT, FINLAND
> Mobile. +358-50-565 8179 (Finland)
> Mobile.  +64-21-037 3605 (New Zealand, 01 Oct - 21 Dec,  
> 2007)<OFSession.war>
> --
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: submitting with method "post" and loosing session attributes

Erik Bruchez
Administrator
In reply to this post by Markku Laine
Markku,

I investigated this a bit. Thanks for the reproducible case. It does  
seem to be a little tricky!

Here are my findings:

1. Web browser initially doesn't send any session cooke
2. /OFSession servlet creates session with id FOO
3. XForms filter cross-context forwards request to /ops servlet with  
XForms content
4. Orbeon Forms processes XForms content and performs submission upon  
xforms-ready
5. Submission attempts to forward JSESSION cookie but doesn't find any  
so none is forwarded
6. Submission request hits /OFSession again, and since there is no  
JSESSION id cookie, a new session BAR is created
7. Problem!

The main issue is with #5 above. The session created in /OFSession is  
new, and Tomcat doesn't create the session cookie at that point, so /
ops doesn't get any cookie from the forwarded request. What's more  
troubling though is that if you call request.getSession(false), no  
session object is returned either. However, if you call  
request.getSession(true), you get a session with id "FOO", which is  
what we want.

So we could in theory force the creation of a session, get the session  
id, and use this id to create a new JSESSIONID cookie to forward  
during submission if we don't find one in the first place. However  
this is not great because we may create a session needlessly.

Another solution would be for the XForms filter to store the session  
id into the request, and then the XForms submission could use that  
session id. Or, similarly, simply information that a session is  
available. Then the XForms submission would know that it must call  
request.getSession(true). This code could actually be hidden in  
ServletExternalContext.

The latter possibility sounds reasonably good. The only drag, besides  
the relative complexity of the code, is that it's not clear to me  
whether this is a Tomcat-only issue and/or solution.

I entered a bug to track this:

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

Any thoughts on the above?

-Erik

On Nov 28, 2007, at 3:24 AM, .::: Markku :::. wrote:

> Hi Erik,
>
>
> I have also faced the same problem before, i.e. loosing session  
> attributes when submitting with method "post" (on the first  
> submission only), but unfortunately I haven't found a working  
> solution yet.
>
> I attached a simple example web application (servlet) which  
> reproduces the problem. When the servlet is requested (e.g., http://localhost:8080/OFSession)
> , the doGet() method responses with a generated XHTML+XForms page.  
> The generated page contains the following data:
> *Current (at the time when doGet() method was being processed)  
> session ID
> *Current (at the time when doGet() method was being processed) &  
> stored attribute value (i.e. session ID)
>
>
> The generated page also contains XForms markup, which submits a  
> request with method "post" to the servlet. The servlet responses  
> with an XML document. The XML document contains the following data:
> *Current (at the time when doPost() method was being processed)  
> session ID
> *Current (at the time when doPost() method was being processed) &  
> stored attribute value (i.e. session ID)
>
>
> Logically, all four values ought to be same, right?. However, if the  
> XForms request is submitted automatically upon the "xforms-ready"  
> event, then on the first time/submission the session ID has changed  
> and, therefore, also the stored session attribute value is null  
> (cannot be found from this session because it is the same session  
> where to the attribute was set). If the request is submitted again  
> (CTRL+F5 in Firefox), then the values match.
>
> If the XForms request is submitted manually, i.e. by clicking a  
> button/trigger, then all four values are the same even on the first  
> time/submission. In addition, the example works fine also when used  
> without Orbeon Forms XForms Engine (ops xforms filter turned off and  
> using Mozilla XForms plug-in).
>
> I'm using Orbeon Forms 3.6.0rc1 (filter set the the URL "/*") with  
> standard configurations. You can test the example/behaviour with  
> manual/automatic submission by commenting two lines (marked) in the  
> servlet.SessionTesterServlet.java class (lines 56 and 67.
>
> Is this a bug in Oreon Forms? If not, how do I need to modify my  
> example web application to make it work also on the first time/
> submission?
>
> Best regards
>
>
> -Markku Laine
>
> On Fri, 16 Nov 2007, Erik Bruchez wrote:
>
>> Gerrit,
>>
>> This is not just one way of using XForms or Orbeon Forms, so don't  
>> worry about doing something wrong. If the solution works for you,  
>> then that's great. So thanks for sharing it on the list!
>>
>> -Erik
>>
>>
>> On Nov 16, 2007, at 11:43 AM, Gerrit Germis wrote:
>>
>>> Hi Chaminda,
>>> I'm also new to orbeon and xforms, so this might not be (most  
>>> probably)
>>> the correct way to do it, but it seems to be working for us so far.
>>> Here's how we set things up:
>>> - Our webapp is at /umadmin
>>> - Separate deployment to /ops
>>> - In the /umadmin context, the /umadmin/xforms-jsp/* is filtered  
>>> by OPS,
>>> so this is where we put the .jsp file that generates the XHTML/
>>> Xforms
>>> output (or in your case, you could simply put the .xhtml file  
>>> somewhere
>>> in that directory). As a side-note, maybe also tell you that you
>>> shouldn't put the .xml files that you load from the xform itself  
>>> in any
>>> directory in /umadmin/xforms-jsp/*.. I've lost a lot of time being
>>> puzzled by why it wasn't working...
>>> - We created a HttpServletResponseWrapper object to be able to  
>>> capture
>>> the output of the page generated by Xforms (see later)
>>> - We add a cookie (JSESSIONID) with a path of "/" to that response
>>> object so it is accessible by both contexts and we don't loose our
>>> profile information put in the session during login
>>> - From within the servlet, we do a forward to the /xforms-jsp/*  
>>> URL that
>>> generates the actual form and capture the output generated by OPS:
>>> RequestDispatcher rd =
>>> servlet.getServletContext().getRequestDispatcher("/xforms-jsp/our-
>>> app/in
>>> dex.xhtml");
>>> rd.forward(request, new MyHttpServletResponseWrapper(response));
>>> form.setHTML(response.toString());
>>> return mapping.findForward("success");
>>> - This way, we can create a .jsp file and use "<%= form.getHTML()  
>>> %>" in
>>> the JSP file to actually include the generated form wherever we  
>>> want in
>>> the page.
>>> - As an additional benefit, this way of doing it allows us to use  
>>> tiles
>>> too
>>> - Next problem was when submitting the data in the form, this  
>>> would give
>>> us a URL like: http://localhost:8080/ops/xforms-server-submit 
>>> which we
>>> didn't want, so here's how we "fixed" this:
>>> The target of the submission defined in the xform is another struts
>>> action. We defined a global forward in the struts-config.xml  
>>> having the
>>> 'redirect="true"' attribute pointing to the first action again.  
>>> After
>>> doing the processing on the submitted data (by processing the
>>> request.getInputStream()), we simply do a
>>> 'mapping.findForward("ourforward");' which makes the client re-
>>> request
>>> the original .jsp file generating the form again...
>>> Again, I emphasise that this is probably not the way of working with
>>> Xforms, so any suggestions or remarks are most welcome..
>>> Hope this helps,
>>> Gerrit
>>> -----Original Message-----
>>> From: Chaminda [mailto:[hidden email]]
>>> Sent: Friday, November 16, 2007 10:34 AM
>>> To: [hidden email]
>>> Subject: Re: [ops-users] submitting with method "post" and loosing
>>> session attributes
>>> Hi Gerrit,
>>> Sorry for replying your thread to, This is not an answer for you
>>> problem.
>>> According to your problem I guess you are familiar with this.  
>>> Thats why
>>> Im
>>> posing my problem here,
>>> I want to send request to a servlet and in the servlet set a request
>>> attribute. Upto that part I know. But I  dont know how to dispatch  
>>> the
>>> request to XHTML other that JSP.
>>> In JSP we do like this
>>> dispatcher.forward("/WEB-INF/Jsp/my.jsp");
>>> How can I do this for xhtml,
>>> Thanks, Sorry again for posing to here
>>> Gerrit Germis-2 wrote:
>>> > > Hi,
>>> > > I'm using struts/tiles with the nightly build of xforms  
>>> (separartely
>>> > deployed). I have successfully created and populated my xform, but
>>> now,
>>> > when I try to submit the results back to another action using the
>>> "post"
>>> > method, I loose my profile information that was stored in the  
>>> session.
>>> > This is what my submission looks like:
>>> > >   <xforms:submission id="test-submit"
>>> >       action="http://localhost:8080/umadmin/someAction"  
>>> method="post"
>>> >       ref="instance('document-instance')/data/DocumentRevision"
>>> > replace="all"/>
>>> > >   <xforms:submit submission="test-submit">
>>> >       <xforms:label>Go to action!</xforms:label>
>>> >   </xforms:submit>
>>> > > The complete flow is like this:
>>> > > - setup: /xforms-jsp/* is setup to be filtered by OPS
>>> > - User logs into the website, profile information is stored in
>>> session
>>> > - form is generated by navigating to URL:
>>> > http://localhost:8080/umadmin/xforms-jsp/some-app
>>> > - User fills in data
>>> > - User presses the submit button labeled "Go to action!" mentioned
>>> > above
>>> > - PROBLEM: user is prompted for login again since no profile
>>> > information was found in session
>>> > > How can I make sure the profile information is not lost on  
>>> submission?
>>> > > Sincerely
>>> > Gerrit
>>> > > > > --
>>> > 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
>>> > OW2 mailing lists service home page: http://www.ow2.org/wws
>>> > > --
>>> View this message in context:
>>> http://www.nabble.com/submitting-with-method-%22post%22-and-loosing-sess
>>> ion-attributes-tf4803253.html#a13790034
>>> 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
>>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>
>> --
>> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>> http://www.orbeon.com/
>>
>>
>
> --
> Markku Laine <[hidden email]>
> Research assistant, Helsinki University of Technology
> Telecommunications Software and Multimedia Laboratory
> P.O.Box 5400, FIN-02015 HUT, FINLAND
> Mobile. +358-50-565 8179 (Finland)
> Mobile.  +64-21-037 3605 (New Zealand, 01 Oct - 21 Dec,  
> 2007)<OFSession.war>
> --
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: submitting with method "post" and loosing session attributes

Erik Bruchez
Administrator
A quick follow-up: I experimented a bit and implemented the solution  
below. It seems to do the trick and solve the problem, but I haven't  
checked it in yet as I am wondering if it could break with other  
servlet containers.

Thoughts on this welcome.

-Erik

On Dec 10, 2007, at 4:44 PM, Erik Bruchez wrote:

> Markku,
>
> I investigated this a bit. Thanks for the reproducible case. It does  
> seem to be a little tricky!
>
> Here are my findings:
>
> 1. Web browser initially doesn't send any session cooke
> 2. /OFSession servlet creates session with id FOO
> 3. XForms filter cross-context forwards request to /ops servlet with  
> XForms content
> 4. Orbeon Forms processes XForms content and performs submission  
> upon xforms-ready
> 5. Submission attempts to forward JSESSION cookie but doesn't find  
> any so none is forwarded
> 6. Submission request hits /OFSession again, and since there is no  
> JSESSION id cookie, a new session BAR is created
> 7. Problem!
>
> The main issue is with #5 above. The session created in /OFSession  
> is new, and Tomcat doesn't create the session cookie at that point,  
> so /ops doesn't get any cookie from the forwarded request. What's  
> more troubling though is that if you call request.getSession(false),  
> no session object is returned either. However, if you call  
> request.getSession(true), you get a session with id "FOO", which is  
> what we want.
>
> So we could in theory force the creation of a session, get the  
> session id, and use this id to create a new JSESSIONID cookie to  
> forward during submission if we don't find one in the first place.  
> However this is not great because we may create a session needlessly.
>
> Another solution would be for the XForms filter to store the session  
> id into the request, and then the XForms submission could use that  
> session id. Or, similarly, simply information that a session is  
> available. Then the XForms submission would know that it must call  
> request.getSession(true). This code could actually be hidden in  
> ServletExternalContext.
>
> The latter possibility sounds reasonably good. The only drag,  
> besides the relative complexity of the code, is that it's not clear  
> to me whether this is a Tomcat-only issue and/or solution.
>
> I entered a bug to track this:
>
> http://forge.objectweb.org/tracker/index.php?func=detail&aid=308023&group_id=168&atid=350207
>
> Any thoughts on the above?
>
> -Erik
>
> On Nov 28, 2007, at 3:24 AM, .::: Markku :::. wrote:
>
>> Hi Erik,
>>
>>
>> I have also faced the same problem before, i.e. loosing session  
>> attributes when submitting with method "post" (on the first  
>> submission only), but unfortunately I haven't found a working  
>> solution yet.
>>
>> I attached a simple example web application (servlet) which  
>> reproduces the problem. When the servlet is requested (e.g., http://localhost:8080/OFSession)
>> , the doGet() method responses with a generated XHTML+XForms page.  
>> The generated page contains the following data:
>> *Current (at the time when doGet() method was being processed)  
>> session ID
>> *Current (at the time when doGet() method was being processed) &  
>> stored attribute value (i.e. session ID)
>>
>>
>> The generated page also contains XForms markup, which submits a  
>> request with method "post" to the servlet. The servlet responses  
>> with an XML document. The XML document contains the following data:
>> *Current (at the time when doPost() method was being processed)  
>> session ID
>> *Current (at the time when doPost() method was being processed) &  
>> stored attribute value (i.e. session ID)
>>
>>
>> Logically, all four values ought to be same, right?. However, if  
>> the XForms request is submitted automatically upon the "xforms-
>> ready" event, then on the first time/submission the session ID has  
>> changed and, therefore, also the stored session attribute value is  
>> null (cannot be found from this session because it is the same  
>> session where to the attribute was set). If the request is  
>> submitted again (CTRL+F5 in Firefox), then the values match.
>>
>> If the XForms request is submitted manually, i.e. by clicking a  
>> button/trigger, then all four values are the same even on the first  
>> time/submission. In addition, the example works fine also when used  
>> without Orbeon Forms XForms Engine (ops xforms filter turned off  
>> and using Mozilla XForms plug-in).
>>
>> I'm using Orbeon Forms 3.6.0rc1 (filter set the the URL "/*") with  
>> standard configurations. You can test the example/behaviour with  
>> manual/automatic submission by commenting two lines (marked) in the  
>> servlet.SessionTesterServlet.java class (lines 56 and 67.
>>
>> Is this a bug in Oreon Forms? If not, how do I need to modify my  
>> example web application to make it work also on the first time/
>> submission?
>>
>> Best regards
>>
>>
>> -Markku Laine
>>
>> On Fri, 16 Nov 2007, Erik Bruchez wrote:
>>
>>> Gerrit,
>>>
>>> This is not just one way of using XForms or Orbeon Forms, so don't  
>>> worry about doing something wrong. If the solution works for you,  
>>> then that's great. So thanks for sharing it on the list!
>>>
>>> -Erik
>>>
>>>
>>> On Nov 16, 2007, at 11:43 AM, Gerrit Germis wrote:
>>>
>>>> Hi Chaminda,
>>>> I'm also new to orbeon and xforms, so this might not be (most  
>>>> probably)
>>>> the correct way to do it, but it seems to be working for us so far.
>>>> Here's how we set things up:
>>>> - Our webapp is at /umadmin
>>>> - Separate deployment to /ops
>>>> - In the /umadmin context, the /umadmin/xforms-jsp/* is filtered  
>>>> by OPS,
>>>> so this is where we put the .jsp file that generates the XHTML/
>>>> Xforms
>>>> output (or in your case, you could simply put the .xhtml file  
>>>> somewhere
>>>> in that directory). As a side-note, maybe also tell you that you
>>>> shouldn't put the .xml files that you load from the xform itself  
>>>> in any
>>>> directory in /umadmin/xforms-jsp/*.. I've lost a lot of time being
>>>> puzzled by why it wasn't working...
>>>> - We created a HttpServletResponseWrapper object to be able to  
>>>> capture
>>>> the output of the page generated by Xforms (see later)
>>>> - We add a cookie (JSESSIONID) with a path of "/" to that response
>>>> object so it is accessible by both contexts and we don't loose our
>>>> profile information put in the session during login
>>>> - From within the servlet, we do a forward to the /xforms-jsp/*  
>>>> URL that
>>>> generates the actual form and capture the output generated by OPS:
>>>> RequestDispatcher rd =
>>>> servlet.getServletContext().getRequestDispatcher("/xforms-jsp/our-
>>>> app/in
>>>> dex.xhtml");
>>>> rd.forward(request, new MyHttpServletResponseWrapper(response));
>>>> form.setHTML(response.toString());
>>>> return mapping.findForward("success");
>>>> - This way, we can create a .jsp file and use "<%= form.getHTML()  
>>>> %>" in
>>>> the JSP file to actually include the generated form wherever we  
>>>> want in
>>>> the page.
>>>> - As an additional benefit, this way of doing it allows us to use  
>>>> tiles
>>>> too
>>>> - Next problem was when submitting the data in the form, this  
>>>> would give
>>>> us a URL like: http://localhost:8080/ops/xforms-server-submit 
>>>> which we
>>>> didn't want, so here's how we "fixed" this:
>>>> The target of the submission defined in the xform is another struts
>>>> action. We defined a global forward in the struts-config.xml  
>>>> having the
>>>> 'redirect="true"' attribute pointing to the first action again.  
>>>> After
>>>> doing the processing on the submitted data (by processing the
>>>> request.getInputStream()), we simply do a
>>>> 'mapping.findForward("ourforward");' which makes the client re-
>>>> request
>>>> the original .jsp file generating the form again...
>>>> Again, I emphasise that this is probably not the way of working  
>>>> with
>>>> Xforms, so any suggestions or remarks are most welcome..
>>>> Hope this helps,
>>>> Gerrit
>>>> -----Original Message-----
>>>> From: Chaminda [mailto:[hidden email]]
>>>> Sent: Friday, November 16, 2007 10:34 AM
>>>> To: [hidden email]
>>>> Subject: Re: [ops-users] submitting with method "post" and loosing
>>>> session attributes
>>>> Hi Gerrit,
>>>> Sorry for replying your thread to, This is not an answer for you
>>>> problem.
>>>> According to your problem I guess you are familiar with this.  
>>>> Thats why
>>>> Im
>>>> posing my problem here,
>>>> I want to send request to a servlet and in the servlet set a  
>>>> request
>>>> attribute. Upto that part I know. But I  dont know how to  
>>>> dispatch the
>>>> request to XHTML other that JSP.
>>>> In JSP we do like this
>>>> dispatcher.forward("/WEB-INF/Jsp/my.jsp");
>>>> How can I do this for xhtml,
>>>> Thanks, Sorry again for posing to here
>>>> Gerrit Germis-2 wrote:
>>>> > > Hi,
>>>> > > I'm using struts/tiles with the nightly build of xforms  
>>>> (separartely
>>>> > deployed). I have successfully created and populated my xform,  
>>>> but
>>>> now,
>>>> > when I try to submit the results back to another action using the
>>>> "post"
>>>> > method, I loose my profile information that was stored in the  
>>>> session.
>>>> > This is what my submission looks like:
>>>> > >   <xforms:submission id="test-submit"
>>>> >       action="http://localhost:8080/umadmin/someAction"  
>>>> method="post"
>>>> >       ref="instance('document-instance')/data/DocumentRevision"
>>>> > replace="all"/>
>>>> > >   <xforms:submit submission="test-submit">
>>>> >       <xforms:label>Go to action!</xforms:label>
>>>> >   </xforms:submit>
>>>> > > The complete flow is like this:
>>>> > > - setup: /xforms-jsp/* is setup to be filtered by OPS
>>>> > - User logs into the website, profile information is stored in
>>>> session
>>>> > - form is generated by navigating to URL:
>>>> > http://localhost:8080/umadmin/xforms-jsp/some-app
>>>> > - User fills in data
>>>> > - User presses the submit button labeled "Go to action!"  
>>>> mentioned
>>>> > above
>>>> > - PROBLEM: user is prompted for login again since no profile
>>>> > information was found in session
>>>> > > How can I make sure the profile information is not lost on  
>>>> submission?
>>>> > > Sincerely
>>>> > Gerrit
>>>> > > > > --
>>>> > 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
>>>> > OW2 mailing lists service home page: http://www.ow2.org/wws
>>>> > > --
>>>> View this message in context:
>>>> http://www.nabble.com/submitting-with-method-%22post%22-and-loosing-sess
>>>> ion-attributes-tf4803253.html#a13790034
>>>> 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
>>>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>>
>>> --
>>> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>>> http://www.orbeon.com/
>>>
>>>
>>
>> --
>> Markku Laine <[hidden email]>
>> Research assistant, Helsinki University of Technology
>> Telecommunications Software and Multimedia Laboratory
>> P.O.Box 5400, FIN-02015 HUT, FINLAND
>> Mobile. +358-50-565 8179 (Finland)
>> Mobile.  +64-21-037 3605 (New Zealand, 01 Oct - 21 Dec,  
>> 2007)<OFSession.war>
>> --
>> 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
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>
> --
> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
> http://www.orbeon.com/
>
--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: submitting with method "post" and loosing session attributes

Markku Laine
Hi Erik,


Firstly, thanks for solving the problem!

Secondly, your solution seems to be reasonable and workable so at least
I'm happy with it :) I'm also using Tomcat (version 5.5.23) at the moment.
I haven't tried to use other servlet containers with Orbeon Forms so I
really can't tell whether this is a Tomcat only issue.

Could you inform me when the fix has been checked in and included to the
newest Orbeon Forms Nightly Build version? Once again, thanks a lot! Great
work!

Regards


-Markku


On Mon, 10 Dec 2007, Erik Bruchez wrote:

> A quick follow-up: I experimented a bit and implemented the solution below.
> It seems to do the trick and solve the problem, but I haven't checked it in
> yet as I am wondering if it could break with other servlet containers.
>
> Thoughts on this welcome.
>
> -Erik
>
> On Dec 10, 2007, at 4:44 PM, Erik Bruchez wrote:
>
>> Markku,
>>
>> I investigated this a bit. Thanks for the reproducible case. It does seem
>> to be a little tricky!
>>
>> Here are my findings:
>>
>> 1. Web browser initially doesn't send any session cooke
>> 2. /OFSession servlet creates session with id FOO
>> 3. XForms filter cross-context forwards request to /ops servlet with XForms
>> content
>> 4. Orbeon Forms processes XForms content and performs submission upon
>> xforms-ready
>> 5. Submission attempts to forward JSESSION cookie but doesn't find any so
>> none is forwarded
>> 6. Submission request hits /OFSession again, and since there is no JSESSION
>> id cookie, a new session BAR is created
>> 7. Problem!
>>
>> The main issue is with #5 above. The session created in /OFSession is new,
>> and Tomcat doesn't create the session cookie at that point, so /ops doesn't
>> get any cookie from the forwarded request. What's more troubling though is
>> that if you call request.getSession(false), no session object is returned
>> either. However, if you call request.getSession(true), you get a session
>> with id "FOO", which is what we want.
>>
>> So we could in theory force the creation of a session, get the session id,
>> and use this id to create a new JSESSIONID cookie to forward during
>> submission if we don't find one in the first place. However this is not
>> great because we may create a session needlessly.
>>
>> Another solution would be for the XForms filter to store the session id
>> into the request, and then the XForms submission could use that session id.
>> Or, similarly, simply information that a session is available. Then the
>> XForms submission would know that it must call request.getSession(true).
>> This code could actually be hidden in ServletExternalContext.
>>
>> The latter possibility sounds reasonably good. The only drag, besides the
>> relative complexity of the code, is that it's not clear to me whether this
>> is a Tomcat-only issue and/or solution.
>>
>> I entered a bug to track this:
>>
>> http://forge.objectweb.org/tracker/index.php?func=detail&aid=308023&group_id=168&atid=350207
>>
>> Any thoughts on the above?
>>
>> -Erik
>>
>> On Nov 28, 2007, at 3:24 AM, .::: Markku :::. wrote:
>>
>> > Hi Erik,
>> >
>> >
>> > I have also faced the same problem before, i.e. loosing session
>> > attributes when submitting with method "post" (on the first submission
>> > only), but unfortunately I haven't found a working solution yet.
>> >
>> > I attached a simple example web application (servlet) which reproduces
>> > the problem. When the servlet is requested (e.g.,
>> > http://localhost:8080/OFSession), the doGet() method responses with a
>> > generated XHTML+XForms page. The generated page contains the following
>> > data:
>> > *Current (at the time when doGet() method was being processed) session ID
>> > *Current (at the time when doGet() method was being processed) & stored
>> > attribute value (i.e. session ID)
>> >
>> >
>> > The generated page also contains XForms markup, which submits a request
>> > with method "post" to the servlet. The servlet responses with an XML
>> > document. The XML document contains the following data:
>> > *Current (at the time when doPost() method was being processed) session
>> > ID
>> > *Current (at the time when doPost() method was being processed) & stored
>> > attribute value (i.e. session ID)
>> >
>> >
>> > Logically, all four values ought to be same, right?. However, if the
>> > XForms request is submitted automatically upon the "xforms-ready" event,
>> > then on the first time/submission the session ID has changed and,
>> > therefore, also the stored session attribute value is null (cannot be
>> > found from this session because it is the same session where to the
>> > attribute was set). If the request is submitted again (CTRL+F5 in
>> > Firefox), then the values match.
>> >
>> > If the XForms request is submitted manually, i.e. by clicking a
>> > button/trigger, then all four values are the same even on the first
>> > time/submission. In addition, the example works fine also when used
>> > without Orbeon Forms XForms Engine (ops xforms filter turned off and
>> > using Mozilla XForms plug-in).
>> >
>> > I'm using Orbeon Forms 3.6.0rc1 (filter set the the URL "/*") with
>> > standard configurations. You can test the example/behaviour with
>> > manual/automatic submission by commenting two lines (marked) in the
>> > servlet.SessionTesterServlet.java class (lines 56 and 67.
>> >
>> > Is this a bug in Oreon Forms? If not, how do I need to modify my example
>> > web application to make it work also on the first time/submission?
>> >
>> > Best regards
>> >
>> >
>> > -Markku Laine
>> >
>> > On Fri, 16 Nov 2007, Erik Bruchez wrote:
>> >
>> > > Gerrit,
>> > >
>> > > This is not just one way of using XForms or Orbeon Forms, so don't
>> > > worry about doing something wrong. If the solution works for you, then
>> > > that's great. So thanks for sharing it on the list!
>> > >
>> > > -Erik
>> > >
>> > >
>> > > On Nov 16, 2007, at 11:43 AM, Gerrit Germis wrote:
>> > >
>> > > > Hi Chaminda,
>> > > > I'm also new to orbeon and xforms, so this might not be (most
>> > > > probably)
>> > > > the correct way to do it, but it seems to be working for us so far.
>> > > > Here's how we set things up:
>> > > > - Our webapp is at /umadmin
>> > > > - Separate deployment to /ops
>> > > > - In the /umadmin context, the /umadmin/xforms-jsp/* is filtered by
>> > > > OPS,
>> > > > so this is where we put the .jsp file that generates the XHTML/Xforms
>> > > > output (or in your case, you could simply put the .xhtml file
>> > > > somewhere
>> > > > in that directory). As a side-note, maybe also tell you that you
>> > > > shouldn't put the .xml files that you load from the xform itself in
>> > > > any
>> > > > directory in /umadmin/xforms-jsp/*.. I've lost a lot of time being
>> > > > puzzled by why it wasn't working...
>> > > > - We created a HttpServletResponseWrapper object to be able to
>> > > > capture
>> > > > the output of the page generated by Xforms (see later)
>> > > > - We add a cookie (JSESSIONID) with a path of "/" to that response
>> > > > object so it is accessible by both contexts and we don't loose our
>> > > > profile information put in the session during login
>> > > > - From within the servlet, we do a forward to the /xforms-jsp/* URL
>> > > > that
>> > > > generates the actual form and capture the output generated by OPS:
>> > > > RequestDispatcher rd =
>> > > > servlet.getServletContext().getRequestDispatcher("/xforms-jsp/our-app/in
>> > > > dex.xhtml");
>> > > > rd.forward(request, new MyHttpServletResponseWrapper(response));
>> > > > form.setHTML(response.toString());
>> > > > return mapping.findForward("success");
>> > > > - This way, we can create a .jsp file and use "<%= form.getHTML() %>"
>> > > > in
>> > > > the JSP file to actually include the generated form wherever we want
>> > > > in
>> > > > the page.
>> > > > - As an additional benefit, this way of doing it allows us to use
>> > > > tiles
>> > > > too
>> > > > - Next problem was when submitting the data in the form, this would
>> > > > give
>> > > > us a URL like: http://localhost:8080/ops/xforms-server-submit which
>> > > > we
>> > > > didn't want, so here's how we "fixed" this:
>> > > > The target of the submission defined in the xform is another struts
>> > > > action. We defined a global forward in the struts-config.xml having
>> > > > the
>> > > > 'redirect="true"' attribute pointing to the first action again. After
>> > > > doing the processing on the submitted data (by processing the
>> > > > request.getInputStream()), we simply do a
>> > > > 'mapping.findForward("ourforward");' which makes the client
>> > > > re-request
>> > > > the original .jsp file generating the form again...
>> > > > Again, I emphasise that this is probably not the way of working with
>> > > > Xforms, so any suggestions or remarks are most welcome..
>> > > > Hope this helps,
>> > > > Gerrit
>> > > > -----Original Message-----
>> > > > From: Chaminda [mailto:[hidden email]]
>> > > > Sent: Friday, November 16, 2007 10:34 AM
>> > > > To: [hidden email]
>> > > > Subject: Re: [ops-users] submitting with method "post" and loosing
>> > > > session attributes
>> > > > Hi Gerrit,
>> > > > Sorry for replying your thread to, This is not an answer for you
>> > > > problem.
>> > > > According to your problem I guess you are familiar with this. Thats
>> > > > why
>> > > > Im
>> > > > posing my problem here,
>> > > > I want to send request to a servlet and in the servlet set a request
>> > > > attribute. Upto that part I know. But I  dont know how to dispatch
>> > > > the
>> > > > request to XHTML other that JSP.
>> > > > In JSP we do like this
>> > > > dispatcher.forward("/WEB-INF/Jsp/my.jsp");
>> > > > How can I do this for xhtml,
>> > > > Thanks, Sorry again for posing to here
>> > > > Gerrit Germis-2 wrote:
>> > > > > >  Hi,
>> > > > > >  I'm using struts/tiles with the nightly build of xforms
>> > > > > >  (separartely
>> > > > >  deployed). I have successfully created and populated my xform, but
>> > > > now,
>> > > > >  when I try to submit the results back to another action using the
>> > > > "post"
>> > > > >  method, I loose my profile information that was stored in the
>> > > > >  session.
>> > > > >  This is what my submission looks like:
>> > > > > >    <xforms:submission id="test-submit"
>> > > > >        action="http://localhost:8080/umadmin/someAction"
>> > > > >        method="post"
>> > > > >        ref="instance('document-instance')/data/DocumentRevision"
>> > > > >  replace="all"/>
>> > > > > >    <xforms:submit submission="test-submit">
>> > > > >        <xforms:label>Go to action!</xforms:label>
>> > > > >    </xforms:submit>
>> > > > > >  The complete flow is like this:
>> > > > > >  - setup: /xforms-jsp/* is setup to be filtered by OPS
>> > > > >  - User logs into the website, profile information is stored in
>> > > > session
>> > > > >  - form is generated by navigating to URL:
>> > > > >  http://localhost:8080/umadmin/xforms-jsp/some-app
>> > > > >  - User fills in data
>> > > > >  - User presses the submit button labeled "Go to action!" mentioned
>> > > > >  above
>> > > > >  - PROBLEM: user is prompted for login again since no profile
>> > > > >  information was found in session
>> > > > > >  How can I make sure the profile information is not lost on
>> > > > > >  submission?
>> > > > > >  Sincerely
>> > > > >  Gerrit
>> > > > > > > >  --
>> > > > >  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
>> > > > >  OW2 mailing lists service home page: http://www.ow2.org/wws
>> > > > > >  --
>> > > > View this message in context:
>> > > > http://www.nabble.com/submitting-with-method-%22post%22-and-loosing-sess
>> > > > ion-attributes-tf4803253.html#a13790034
>> > > > 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
>> > > > OW2 mailing lists service home page: http://www.ow2.org/wws
>> > >
>> > > --
>> > > Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>> > > http://www.orbeon.com/
>> > >
>> > >
>> >
>> > --
>> > Markku Laine <[hidden email]>
>> > Research assistant, Helsinki University of Technology
>> > Telecommunications Software and Multimedia Laboratory
>> > P.O.Box 5400, FIN-02015 HUT, FINLAND
>> > Mobile. +358-50-565 8179 (Finland)
>> > Mobile.  +64-21-037 3605 (New Zealand, 01 Oct - 21 Dec,
>> > 2007)<OFSession.war>
>> > --
>> > 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
>> > OW2 mailing lists service home page: http://www.ow2.org/wws
>>
>> --
>> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>> http://www.orbeon.com/
>>
>
> --
> 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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: submitting with method "post" and loosing session attributes

Erik Bruchez
Administrator
Markku,

I have now committed this code. Please let us know if 1) it fixes the  
problem and/or 2) it causes any other problems.

-Erik

On Dec 10, 2007, at 6:11 PM, .::: Markku :::. wrote:

> Hi Erik,
>
>
> Firstly, thanks for solving the problem!
>
> Secondly, your solution seems to be reasonable and workable so at  
> least I'm happy with it :) I'm also using Tomcat (version 5.5.23) at  
> the moment. I haven't tried to use other servlet containers with  
> Orbeon Forms so I really can't tell whether this is a Tomcat only  
> issue.
>
> Could you inform me when the fix has been checked in and included to  
> the newest Orbeon Forms Nightly Build version? Once again, thanks a  
> lot! Great work!
>
> Regards
>
>
> -Markku
>
>
> On Mon, 10 Dec 2007, Erik Bruchez wrote:
>
>> A quick follow-up: I experimented a bit and implemented the  
>> solution below. It seems to do the trick and solve the problem, but  
>> I haven't checked it in yet as I am wondering if it could break  
>> with other servlet containers.
>>
>> Thoughts on this welcome.
>>
>> -Erik
>>
>> On Dec 10, 2007, at 4:44 PM, Erik Bruchez wrote:
>>
>>> Markku,
>>> I investigated this a bit. Thanks for the reproducible case. It  
>>> does seem to be a little tricky!
>>> Here are my findings:
>>> 1. Web browser initially doesn't send any session cooke
>>> 2. /OFSession servlet creates session with id FOO
>>> 3. XForms filter cross-context forwards request to /ops servlet  
>>> with XForms content
>>> 4. Orbeon Forms processes XForms content and performs submission  
>>> upon xforms-ready
>>> 5. Submission attempts to forward JSESSION cookie but doesn't find  
>>> any so none is forwarded
>>> 6. Submission request hits /OFSession again, and since there is no  
>>> JSESSION id cookie, a new session BAR is created
>>> 7. Problem!
>>> The main issue is with #5 above. The session created in /OFSession  
>>> is new, and Tomcat doesn't create the session cookie at that  
>>> point, so /ops doesn't get any cookie from the forwarded request.  
>>> What's more troubling though is that if you call  
>>> request.getSession(false), no session object is returned either.  
>>> However, if you call request.getSession(true), you get a session  
>>> with id "FOO", which is what we want.
>>> So we could in theory force the creation of a session, get the  
>>> session id, and use this id to create a new JSESSIONID cookie to  
>>> forward during submission if we don't find one in the first place.  
>>> However this is not great because we may create a session  
>>> needlessly.
>>> Another solution would be for the XForms filter to store the  
>>> session id into the request, and then the XForms submission could  
>>> use that session id. Or, similarly, simply information that a  
>>> session is available. Then the XForms submission would know that  
>>> it must call request.getSession(true). This code could actually be  
>>> hidden in ServletExternalContext.
>>> The latter possibility sounds reasonably good. The only drag,  
>>> besides the relative complexity of the code, is that it's not  
>>> clear to me whether this is a Tomcat-only issue and/or solution.
>>> I entered a bug to track this:
>>> http://forge.objectweb.org/tracker/index.php?func=detail&aid=308023&group_id=168&atid=350207
>>> Any thoughts on the above?
>>> -Erik
>>> On Nov 28, 2007, at 3:24 AM, .::: Markku :::. wrote:
>>> > Hi Erik,
>>> > > > I have also faced the same problem before, i.e. loosing  
>>> session > attributes when submitting with method "post" (on the  
>>> first submission > only), but unfortunately I haven't found a  
>>> working solution yet.
>>> > > I attached a simple example web application (servlet) which  
>>> reproduces > the problem. When the servlet is requested (e.g., > http://localhost:8080/OFSession)
>>> , the doGet() method responses with a > generated XHTML+XForms  
>>> page. The generated page contains the following > data:
>>> > *Current (at the time when doGet() method was being processed)  
>>> session ID
>>> > *Current (at the time when doGet() method was being processed) &  
>>> stored > attribute value (i.e. session ID)
>>> > > > The generated page also contains XForms markup, which  
>>> submits a request > with method "post" to the servlet. The servlet  
>>> responses with an XML > document. The XML document contains the  
>>> following data:
>>> > *Current (at the time when doPost() method was being processed)  
>>> session > ID
>>> > *Current (at the time when doPost() method was being processed)  
>>> & stored > attribute value (i.e. session ID)
>>> > > > Logically, all four values ought to be same, right?.  
>>> However, if the > XForms request is submitted automatically upon  
>>> the "xforms-ready" event, > then on the first time/submission the  
>>> session ID has changed and, > therefore, also the stored session  
>>> attribute value is null (cannot be > found from this session  
>>> because it is the same session where to the > attribute was set).  
>>> If the request is submitted again (CTRL+F5 in > Firefox), then the  
>>> values match.
>>> > > If the XForms request is submitted manually, i.e. by clicking  
>>> a > button/trigger, then all four values are the same even on the  
>>> first > time/submission. In addition, the example works fine also  
>>> when used > without Orbeon Forms XForms Engine (ops xforms filter  
>>> turned off and > using Mozilla XForms plug-in).
>>> > > I'm using Orbeon Forms 3.6.0rc1 (filter set the the URL "/*")  
>>> with > standard configurations. You can test the example/behaviour  
>>> with > manual/automatic submission by commenting two lines  
>>> (marked) in the > servlet.SessionTesterServlet.java class (lines  
>>> 56 and 67.
>>> > > Is this a bug in Oreon Forms? If not, how do I need to modify  
>>> my example > web application to make it work also on the first  
>>> time/submission?
>>> > > Best regards
>>> > > > -Markku Laine
>>> > > On Fri, 16 Nov 2007, Erik Bruchez wrote:
>>> > > > Gerrit,
>>> > > > > This is not just one way of using XForms or Orbeon Forms,  
>>> so don't > > worry about doing something wrong. If the solution  
>>> works for you, then > > that's great. So thanks for sharing it on  
>>> the list!
>>> > > > > -Erik
>>> > > > > > > On Nov 16, 2007, at 11:43 AM, Gerrit Germis wrote:
>>> > > > > > Hi Chaminda,
>>> > > > I'm also new to orbeon and xforms, so this might not be  
>>> (most > > > probably)
>>> > > > the correct way to do it, but it seems to be working for us  
>>> so far.
>>> > > > Here's how we set things up:
>>> > > > - Our webapp is at /umadmin
>>> > > > - Separate deployment to /ops
>>> > > > - In the /umadmin context, the /umadmin/xforms-jsp/* is  
>>> filtered by > > > OPS,
>>> > > > so this is where we put the .jsp file that generates the  
>>> XHTML/Xforms
>>> > > > output (or in your case, you could simply put the .xhtml  
>>> file > > > somewhere
>>> > > > in that directory). As a side-note, maybe also tell you that  
>>> you
>>> > > > shouldn't put the .xml files that you load from the xform  
>>> itself in > > > any
>>> > > > directory in /umadmin/xforms-jsp/*.. I've lost a lot of time  
>>> being
>>> > > > puzzled by why it wasn't working...
>>> > > > - We created a HttpServletResponseWrapper object to be able  
>>> to > > > capture
>>> > > > the output of the page generated by Xforms (see later)
>>> > > > - We add a cookie (JSESSIONID) with a path of "/" to that  
>>> response
>>> > > > object so it is accessible by both contexts and we don't  
>>> loose our
>>> > > > profile information put in the session during login
>>> > > > - From within the servlet, we do a forward to the /xforms-
>>> jsp/* URL > > > that
>>> > > > generates the actual form and capture the output generated  
>>> by OPS:
>>> > > > RequestDispatcher rd =
>>> > > > servlet.getServletContext().getRequestDispatcher("/xforms-
>>> jsp/our-app/in
>>> > > > dex.xhtml");
>>> > > > rd.forward(request, new  
>>> MyHttpServletResponseWrapper(response));
>>> > > > form.setHTML(response.toString());
>>> > > > return mapping.findForward("success");
>>> > > > - This way, we can create a .jsp file and use "<%=  
>>> form.getHTML() %>" > > > in
>>> > > > the JSP file to actually include the generated form wherever  
>>> we want > > > in
>>> > > > the page.
>>> > > > - As an additional benefit, this way of doing it allows us  
>>> to use > > > tiles
>>> > > > too
>>> > > > - Next problem was when submitting the data in the form,  
>>> this would > > > give
>>> > > > us a URL like: http://localhost:8080/ops/xforms-server- 
>>> submit which > > > we
>>> > > > didn't want, so here's how we "fixed" this:
>>> > > > The target of the submission defined in the xform is another  
>>> struts
>>> > > > action. We defined a global forward in the struts-config.xml  
>>> having > > > the
>>> > > > 'redirect="true"' attribute pointing to the first action  
>>> again. After
>>> > > > doing the processing on the submitted data (by processing the
>>> > > > request.getInputStream()), we simply do a
>>> > > > 'mapping.findForward("ourforward");' which makes the client  
>>> > > > re-request
>>> > > > the original .jsp file generating the form again...
>>> > > > Again, I emphasise that this is probably not the way of  
>>> working with
>>> > > > Xforms, so any suggestions or remarks are most welcome..
>>> > > > Hope this helps,
>>> > > > Gerrit
>>> > > > -----Original Message-----
>>> > > > From: Chaminda [mailto:[hidden email]]
>>> > > > Sent: Friday, November 16, 2007 10:34 AM
>>> > > > To: [hidden email]
>>> > > > Subject: Re: [ops-users] submitting with method "post" and  
>>> loosing
>>> > > > session attributes
>>> > > > Hi Gerrit,
>>> > > > Sorry for replying your thread to, This is not an answer for  
>>> you
>>> > > > problem.
>>> > > > According to your problem I guess you are familiar with  
>>> this. Thats > > > why
>>> > > > Im
>>> > > > posing my problem here,
>>> > > > I want to send request to a servlet and in the servlet set a  
>>> request
>>> > > > attribute. Upto that part I know. But I  dont know how to  
>>> dispatch > > > the
>>> > > > request to XHTML other that JSP.
>>> > > > In JSP we do like this
>>> > > > dispatcher.forward("/WEB-INF/Jsp/my.jsp");
>>> > > > How can I do this for xhtml,
>>> > > > Thanks, Sorry again for posing to here
>>> > > > Gerrit Germis-2 wrote:
>>> > > > > >  Hi,
>>> > > > > >  I'm using struts/tiles with the nightly build of xforms  
>>> > > > > >  (separartely
>>> > > > >  deployed). I have successfully created and populated my  
>>> xform, but
>>> > > > now,
>>> > > > >  when I try to submit the results back to another action  
>>> using the
>>> > > > "post"
>>> > > > >  method, I loose my profile information that was stored in  
>>> the > > > >  session.
>>> > > > >  This is what my submission looks like:
>>> > > > > >    <xforms:submission id="test-submit"
>>> > > > >        action="http://localhost:8080/umadmin/someAction" >  
>>> > > >        method="post"
>>> > > > >        ref="instance('document-instance')/data/
>>> DocumentRevision"
>>> > > > >  replace="all"/>
>>> > > > > >    <xforms:submit submission="test-submit">
>>> > > > >        <xforms:label>Go to action!</xforms:label>
>>> > > > >    </xforms:submit>
>>> > > > > >  The complete flow is like this:
>>> > > > > >  - setup: /xforms-jsp/* is setup to be filtered by OPS
>>> > > > >  - User logs into the website, profile information is  
>>> stored in
>>> > > > session
>>> > > > >  - form is generated by navigating to URL:
>>> > > > >  http://localhost:8080/umadmin/xforms-jsp/some-app
>>> > > > >  - User fills in data
>>> > > > >  - User presses the submit button labeled "Go to action!"  
>>> mentioned
>>> > > > >  above
>>> > > > >  - PROBLEM: user is prompted for login again since no  
>>> profile
>>> > > > >  information was found in session
>>> > > > > >  How can I make sure the profile information is not lost  
>>> on > > > > >  submission?
>>> > > > > >  Sincerely
>>> > > > >  Gerrit
>>> > > > > > > >  --
>>> > > > >  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
>>> > > > >  OW2 mailing lists service home page: http://www.ow2.org/wws
>>> > > > > >  --
>>> > > > View this message in context:
>>> > > > http://www.nabble.com/submitting-with-method-%22post%22-and-loosing-sess
>>> > > > ion-attributes-tf4803253.html#a13790034
>>> > > > 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
>>> > > > OW2 mailing lists service home page: http://www.ow2.org/wws
>>> > > > > --
>>> > > Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>>> > > http://www.orbeon.com/
>>> > > > > > > --
>>> > Markku Laine <[hidden email]>
>>> > Research assistant, Helsinki University of Technology
>>> > Telecommunications Software and Multimedia Laboratory
>>> > P.O.Box 5400, FIN-02015 HUT, FINLAND
>>> > Mobile. +358-50-565 8179 (Finland)
>>> > Mobile.  +64-21-037 3605 (New Zealand, 01 Oct - 21 Dec, >  
>>> 2007)<OFSession.war>
>>> > --
>>> > You receive this message as a subscriber of the ops-
>>> [hidden email] mailing > list.
>>> > To unsubscribe: mailto:[hidden email]
>>> > For general help: mailto:[hidden email]?subject=help
>>> > OW2 mailing lists service home page: http://www.ow2.org/wws
>>> --
>>> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>>> http://www.orbeon.com/
>>
>> --
>> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: submitting with method "post" and loosing session attributes

Markku Laine
Hi Erik,


Hmm... I just downloaded the newest version of Orbeon Forms
(3.6.0.200712180008) and ran my web apps plus the reproducable test
case using that Orbeon Forms' version. The problem is still exists. Is it
working properly for you? Or is the fix committed to the Nightly
Builds/Orbeon Forms version I'm using?

I'm using Apache Tomcat 5.5.23 as a servlet container.

Regards


-Markku

On Mon, 17 Dec 2007, Erik Bruchez wrote:

> Markku,
>
> I have now committed this code. Please let us know if 1) it fixes the problem
> and/or 2) it causes any other problems.
>
> -Erik
>
> On Dec 10, 2007, at 6:11 PM, .::: Markku :::. wrote:
>
>> Hi Erik,
>>
>>
>> Firstly, thanks for solving the problem!
>>
>> Secondly, your solution seems to be reasonable and workable so at least I'm
>> happy with it :) I'm also using Tomcat (version 5.5.23) at the moment. I
>> haven't tried to use other servlet containers with Orbeon Forms so I really
>> can't tell whether this is a Tomcat only issue.
>>
>> Could you inform me when the fix has been checked in and included to the
>> newest Orbeon Forms Nightly Build version? Once again, thanks a lot! Great
>> work!
>>
>> Regards
>>
>>
>> -Markku
>>
>>
>> On Mon, 10 Dec 2007, Erik Bruchez wrote:
>>
>> > A quick follow-up: I experimented a bit and implemented the solution
>> > below. It seems to do the trick and solve the problem, but I haven't
>> > checked it in yet as I am wondering if it could break with other servlet
>> > containers.
>> >
>> > Thoughts on this welcome.
>> >
>> > -Erik
>> >
>> > On Dec 10, 2007, at 4:44 PM, Erik Bruchez wrote:
>> >
>> > > Markku,
>> > > I investigated this a bit. Thanks for the reproducible case. It does
>> > > seem to be a little tricky!
>> > > Here are my findings:
>> > > 1. Web browser initially doesn't send any session cooke
>> > > 2. /OFSession servlet creates session with id FOO
>> > > 3. XForms filter cross-context forwards request to /ops servlet with
>> > > XForms content
>> > > 4. Orbeon Forms processes XForms content and performs submission upon
>> > > xforms-ready
>> > > 5. Submission attempts to forward JSESSION cookie but doesn't find any
>> > > so none is forwarded
>> > > 6. Submission request hits /OFSession again, and since there is no
>> > > JSESSION id cookie, a new session BAR is created
>> > > 7. Problem!
>> > > The main issue is with #5 above. The session created in /OFSession is
>> > > new, and Tomcat doesn't create the session cookie at that point, so
>> > > /ops doesn't get any cookie from the forwarded request. What's more
>> > > troubling though is that if you call request.getSession(false), no
>> > > session object is returned either. However, if you call
>> > > request.getSession(true), you get a session with id "FOO", which is
>> > > what we want.
>> > > So we could in theory force the creation of a session, get the session
>> > > id, and use this id to create a new JSESSIONID cookie to forward during
>> > > submission if we don't find one in the first place. However this is not
>> > > great because we may create a session needlessly.
>> > > Another solution would be for the XForms filter to store the session id
>> > > into the request, and then the XForms submission could use that session
>> > > id. Or, similarly, simply information that a session is available. Then
>> > > the XForms submission would know that it must call
>> > > request.getSession(true). This code could actually be hidden in
>> > > ServletExternalContext.
>> > > The latter possibility sounds reasonably good. The only drag, besides
>> > > the relative complexity of the code, is that it's not clear to me
>> > > whether this is a Tomcat-only issue and/or solution.
>> > > I entered a bug to track this:
>> > > http://forge.objectweb.org/tracker/index.php?func=detail&aid=308023&group_id=168&atid=350207
>> > > Any thoughts on the above?
>> > > -Erik
>> > > On Nov 28, 2007, at 3:24 AM, .::: Markku :::. wrote:
>> > > >  Hi Erik,
>> > > > > >  I have also faced the same problem before, i.e. loosing session
>> > > > > >  > attributes when submitting with method "post" (on the first
>> > > > > >  submission > only), but unfortunately I haven't found a working
>> > > > > >  solution yet.
>> > > > >  I attached a simple example web application (servlet) which
>> > > > >  reproduces > the problem. When the servlet is requested (e.g., >
>> > > > >  http://localhost:8080/OFSession), the doGet() method responses
>> > > > >  with a > generated XHTML+XForms page. The generated page contains
>> > > > >  the following > data:
>> > > >  *Current (at the time when doGet() method was being processed)
>> > > >  session ID
>> > > >  *Current (at the time when doGet() method was being processed) &
>> > > >  stored > attribute value (i.e. session ID)
>> > > > > >  The generated page also contains XForms markup, which submits a
>> > > > > >  request > with method "post" to the servlet. The servlet
>> > > > > >  responses with an XML > document. The XML document contains the
>> > > > > >  following data:
>> > > >  *Current (at the time when doPost() method was being processed)
>> > > >  session > ID
>> > > >  *Current (at the time when doPost() method was being processed) &
>> > > >  stored > attribute value (i.e. session ID)
>> > > > > >  Logically, all four values ought to be same, right?. However, if
>> > > > > >  the > XForms request is submitted automatically upon the
>> > > > > >  "xforms-ready" event, > then on the first time/submission the
>> > > > > >  session ID has changed and, > therefore, also the stored session
>> > > > > >  attribute value is null (cannot be > found from this session
>> > > > > >  because it is the same session where to the > attribute was
>> > > > > >  set). If the request is submitted again (CTRL+F5 in > Firefox),
>> > > > > >  then the values match.
>> > > > >  If the XForms request is submitted manually, i.e. by clicking a >
>> > > > >  button/trigger, then all four values are the same even on the
>> > > > >  first > time/submission. In addition, the example works fine also
>> > > > >  when used > without Orbeon Forms XForms Engine (ops xforms filter
>> > > > >  turned off and > using Mozilla XForms plug-in).
>> > > > >  I'm using Orbeon Forms 3.6.0rc1 (filter set the the URL "/*") with
>> > > > >  > standard configurations. You can test the example/behaviour with
>> > > > >  > manual/automatic submission by commenting two lines (marked) in
>> > > > >  the > servlet.SessionTesterServlet.java class (lines 56 and 67.
>> > > > >  Is this a bug in Oreon Forms? If not, how do I need to modify my
>> > > > >  example > web application to make it work also on the first
>> > > > >  time/submission?
>> > > > >  Best regards
>> > > > > >  -Markku Laine
>> > > > >  On Fri, 16 Nov 2007, Erik Bruchez wrote:
>> > > > > >  Gerrit,
>> > > > > > >  This is not just one way of using XForms or Orbeon Forms, so
>> > > > > > >  don't > > worry about doing something wrong. If the solution
>> > > > > > >  works for you, then > > that's great. So thanks for sharing it
>> > > > > > >  on the list!
>> > > > > > >  -Erik
>> > > > > > > > >  On Nov 16, 2007, at 11:43 AM, Gerrit Germis wrote:
>> > > > > > > >  Hi Chaminda,
>> > > > > >  I'm also new to orbeon and xforms, so this might not be (most >
>> > > > > >  > > probably)
>> > > > > >  the correct way to do it, but it seems to be working for us so
>> > > > > >  far.
>> > > > > >  Here's how we set things up:
>> > > > > >  - Our webapp is at /umadmin
>> > > > > >  - Separate deployment to /ops
>> > > > > >  - In the /umadmin context, the /umadmin/xforms-jsp/* is filtered
>> > > > > >  by > > > OPS,
>> > > > > >  so this is where we put the .jsp file that generates the
>> > > > > >  XHTML/Xforms
>> > > > > >  output (or in your case, you could simply put the .xhtml file >
>> > > > > >  > > somewhere
>> > > > > >  in that directory). As a side-note, maybe also tell you that you
>> > > > > >  shouldn't put the .xml files that you load from the xform itself
>> > > > > >  in > > > any
>> > > > > >  directory in /umadmin/xforms-jsp/*.. I've lost a lot of time
>> > > > > >  being
>> > > > > >  puzzled by why it wasn't working...
>> > > > > >  - We created a HttpServletResponseWrapper object to be able to >
>> > > > > >  > > capture
>> > > > > >  the output of the page generated by Xforms (see later)
>> > > > > >  - We add a cookie (JSESSIONID) with a path of "/" to that
>> > > > > >  response
>> > > > > >  object so it is accessible by both contexts and we don't loose
>> > > > > >  our
>> > > > > >  profile information put in the session during login
>> > > > > >  - From within the servlet, we do a forward to the /xforms-jsp/*
>> > > > > >  URL > > > that
>> > > > > >  generates the actual form and capture the output generated by
>> > > > > >  OPS:
>> > > > > >  RequestDispatcher rd =
>> > > > > >  servlet.getServletContext().getRequestDispatcher("/xforms-jsp/our-app/in
>> > > > > >  dex.xhtml");
>> > > > > >  rd.forward(request, new MyHttpServletResponseWrapper(response));
>> > > > > >  form.setHTML(response.toString());
>> > > > > >  return mapping.findForward("success");
>> > > > > >  - This way, we can create a .jsp file and use "<%=
>> > > > > >  form.getHTML() %>" > > > in
>> > > > > >  the JSP file to actually include the generated form wherever we
>> > > > > >  want > > > in
>> > > > > >  the page.
>> > > > > >  - As an additional benefit, this way of doing it allows us to
>> > > > > >  use > > > tiles
>> > > > > >  too
>> > > > > >  - Next problem was when submitting the data in the form, this
>> > > > > >  would > > > give
>> > > > > >  us a URL like: http://localhost:8080/ops/xforms-server-submit 
>> > > > > >  which > > > we
>> > > > > >  didn't want, so here's how we "fixed" this:
>> > > > > >  The target of the submission defined in the xform is another
>> > > > > >  struts
>> > > > > >  action. We defined a global forward in the struts-config.xml
>> > > > > >  having > > > the
>> > > > > >  'redirect="true"' attribute pointing to the first action again.
>> > > > > >  After
>> > > > > >  doing the processing on the submitted data (by processing the
>> > > > > >  request.getInputStream()), we simply do a
>> > > > > >  'mapping.findForward("ourforward");' which makes the client > >
>> > > > > >  > re-request
>> > > > > >  the original .jsp file generating the form again...
>> > > > > >  Again, I emphasise that this is probably not the way of working
>> > > > > >  with
>> > > > > >  Xforms, so any suggestions or remarks are most welcome..
>> > > > > >  Hope this helps,
>> > > > > >  Gerrit
>> > > > > >  -----Original Message-----
>> > > > > >  From: Chaminda [mailto:[hidden email]]
>> > > > > >  Sent: Friday, November 16, 2007 10:34 AM
>> > > > > >  To: [hidden email]
>> > > > > >  Subject: Re: [ops-users] submitting with method "post" and
>> > > > > >  loosing
>> > > > > >  session attributes
>> > > > > >  Hi Gerrit,
>> > > > > >  Sorry for replying your thread to, This is not an answer for you
>> > > > > >  problem.
>> > > > > >  According to your problem I guess you are familiar with this.
>> > > > > >  Thats > > > why
>> > > > > >  Im
>> > > > > >  posing my problem here,
>> > > > > >  I want to send request to a servlet and in the servlet set a
>> > > > > >  request
>> > > > > >  attribute. Upto that part I know. But I  dont know how to
>> > > > > >  dispatch > > > the
>> > > > > >  request to XHTML other that JSP.
>> > > > > >  In JSP we do like this
>> > > > > >  dispatcher.forward("/WEB-INF/Jsp/my.jsp");
>> > > > > >  How can I do this for xhtml,
>> > > > > >  Thanks, Sorry again for posing to here
>> > > > > >  Gerrit Germis-2 wrote:
>> > > > > > > >   Hi,
>> > > > > > > >   I'm using struts/tiles with the nightly build of xforms > >
>> > > > > > > >   > > >  (separartely
>> > > > > > >   deployed). I have successfully created and populated my
>> > > > > > >   xform, but
>> > > > > >  now,
>> > > > > > >   when I try to submit the results back to another action using
>> > > > > > >   the
>> > > > > >  "post"
>> > > > > > >   method, I loose my profile information that was stored in the
>> > > > > > >   > > > >  session.
>> > > > > > >   This is what my submission looks like:
>> > > > > > > >     <xforms:submission id="test-submit"
>> > > > > > >         action="http://localhost:8080/umadmin/someAction" > > >
>> > > > > > >         >        method="post"
>> > > > > > >         ref="instance('document-instance')/data/DocumentRevision"
>> > > > > > >   replace="all"/>
>> > > > > > > >     <xforms:submit submission="test-submit">
>> > > > > > >         <xforms:label>Go to action!</xforms:label>
>> > > > > > >     </xforms:submit>
>> > > > > > > >   The complete flow is like this:
>> > > > > > > >   - setup: /xforms-jsp/* is setup to be filtered by OPS
>> > > > > > >   - User logs into the website, profile information is stored
>> > > > > > >   in
>> > > > > >  session
>> > > > > > >   - form is generated by navigating to URL:
>> > > > > > >   http://localhost:8080/umadmin/xforms-jsp/some-app
>> > > > > > >   - User fills in data
>> > > > > > >   - User presses the submit button labeled "Go to action!"
>> > > > > > >   mentioned
>> > > > > > >   above
>> > > > > > >   - PROBLEM: user is prompted for login again since no profile
>> > > > > > >   information was found in session
>> > > > > > > >   How can I make sure the profile information is not lost on
>> > > > > > > >   > > > > >  submission?
>> > > > > > > >   Sincerely
>> > > > > > >   Gerrit
>> > > > > > > > > >   --
>> > > > > > >   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
>> > > > > > >   OW2 mailing lists service home page: http://www.ow2.org/wws
>> > > > > > > >   --
>> > > > > >  View this message in context:
>> > > > > >  http://www.nabble.com/submitting-with-method-%22post%22-and-loosing-sess
>> > > > > >  ion-attributes-tf4803253.html#a13790034
>> > > > > >  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
>> > > > > >  OW2 mailing lists service home page: http://www.ow2.org/wws
>> > > > > > >  --
>> > > > >  Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>> > > > >  http://www.orbeon.com/
>> > > > > > > > >  --
>> > > >  Markku Laine <[hidden email]>
>> > > >  Research assistant, Helsinki University of Technology
>> > > >  Telecommunications Software and Multimedia Laboratory
>> > > >  P.O.Box 5400, FIN-02015 HUT, FINLAND
>> > > >  Mobile. +358-50-565 8179 (Finland)
>> > > >  Mobile.  +64-21-037 3605 (New Zealand, 01 Oct - 21 Dec, >
>> > > >  2007)<OFSession.war>
>> > > >  --
>> > > >  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
>> > > >  OW2 mailing lists service home page: http://www.ow2.org/wws
>> > > --
>> > > Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>> > > http://www.orbeon.com/
>> >
>> > --
>> > 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
>> OW2 mailing lists service home page: http://www.ow2.org/wws
>
> --
> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
> http://www.orbeon.com/
>
>
--
Markku Laine <[hidden email]>
Research assistant, Helsinki University of Technology
Telecommunications Software and Multimedia Laboratory
P.O.Box 5400, FIN-02015 HUT, FINLAND
Mobile. +358-50-565 8179 (Finland)
Mobile.  +64-21-037 3605 (New Zealand, 01 Oct - 21 Dec, 2007)


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: submitting with method "post" and loosing session attributes

Erik Bruchez
Administrator
Markku,

I checked in all the code should be checked in and present in the  
build you got.

You wouln't have both an ops.jar and an orbeon.jar in your WEB-INF/
lib, by any chance?

-Erik

On Dec 17, 2007, at 5:43 PM, .::: Markku :::. wrote:

> Hi Erik,
>
>
> Hmm... I just downloaded the newest version of Orbeon Forms  
> (3.6.0.200712180008) and ran my web apps plus the reproducable test  
> case using that Orbeon Forms' version. The problem is still exists.  
> Is it working properly for you? Or is the fix committed to the  
> Nightly Builds/Orbeon Forms version I'm using?
>
> I'm using Apache Tomcat 5.5.23 as a servlet container.
>
> Regards
>
>
> -Markku
>
> On Mon, 17 Dec 2007, Erik Bruchez wrote:
>
>> Markku,
>>
>> I have now committed this code. Please let us know if 1) it fixes  
>> the problem and/or 2) it causes any other problems.
>>
>> -Erik
>>
>> On Dec 10, 2007, at 6:11 PM, .::: Markku :::. wrote:
>>
>>> Hi Erik,
>>> Firstly, thanks for solving the problem!
>>> Secondly, your solution seems to be reasonable and workable so at  
>>> least I'm happy with it :) I'm also using Tomcat (version 5.5.23)  
>>> at the moment. I haven't tried to use other servlet containers  
>>> with Orbeon Forms so I really can't tell whether this is a Tomcat  
>>> only issue.
>>> Could you inform me when the fix has been checked in and included  
>>> to the newest Orbeon Forms Nightly Build version? Once again,  
>>> thanks a lot! Great work!
>>> Regards
>>> -Markku
>>> On Mon, 10 Dec 2007, Erik Bruchez wrote:
>>> > A quick follow-up: I experimented a bit and implemented the  
>>> solution > below. It seems to do the trick and solve the problem,  
>>> but I haven't > checked it in yet as I am wondering if it could  
>>> break with other servlet > containers.
>>> > > Thoughts on this welcome.
>>> > > -Erik
>>> > > On Dec 10, 2007, at 4:44 PM, Erik Bruchez wrote:
>>> > > > Markku,
>>> > > I investigated this a bit. Thanks for the reproducible case.  
>>> It does > > seem to be a little tricky!
>>> > > Here are my findings:
>>> > > 1. Web browser initially doesn't send any session cooke
>>> > > 2. /OFSession servlet creates session with id FOO
>>> > > 3. XForms filter cross-context forwards request to /ops  
>>> servlet with > > XForms content
>>> > > 4. Orbeon Forms processes XForms content and performs  
>>> submission upon > > xforms-ready
>>> > > 5. Submission attempts to forward JSESSION cookie but doesn't  
>>> find any > > so none is forwarded
>>> > > 6. Submission request hits /OFSession again, and since there  
>>> is no > > JSESSION id cookie, a new session BAR is created
>>> > > 7. Problem!
>>> > > The main issue is with #5 above. The session created in /
>>> OFSession is > > new, and Tomcat doesn't create the session cookie  
>>> at that point, so > > /ops doesn't get any cookie from the  
>>> forwarded request. What's more > > troubling though is that if you  
>>> call request.getSession(false), no > > session object is returned  
>>> either. However, if you call > > request.getSession(true), you get  
>>> a session with id "FOO", which is > > what we want.
>>> > > So we could in theory force the creation of a session, get the  
>>> session > > id, and use this id to create a new JSESSIONID cookie  
>>> to forward during > > submission if we don't find one in the first  
>>> place. However this is not > > great because we may create a  
>>> session needlessly.
>>> > > Another solution would be for the XForms filter to store the  
>>> session id > > into the request, and then the XForms submission  
>>> could use that session > > id. Or, similarly, simply information  
>>> that a session is available. Then > > the XForms submission would  
>>> know that it must call > > request.getSession(true). This code  
>>> could actually be hidden in > > ServletExternalContext.
>>> > > The latter possibility sounds reasonably good. The only drag,  
>>> besides > > the relative complexity of the code, is that it's not  
>>> clear to me > > whether this is a Tomcat-only issue and/or solution.
>>> > > I entered a bug to track this:
>>> > > http://forge.objectweb.org/tracker/index.php?func=detail&aid=308023&group_id=168&atid=350207
>>> > > Any thoughts on the above?
>>> > > -Erik
>>> > > On Nov 28, 2007, at 3:24 AM, .::: Markku :::. wrote:
>>> > > >  Hi Erik,
>>> > > > > >  I have also faced the same problem before, i.e. loosing  
>>> session > > > > >  > attributes when submitting with method  
>>> "post" (on the first > > > > >  submission > only), but  
>>> unfortunately I haven't found a working > > > > >  solution yet.
>>> > > > >  I attached a simple example web application (servlet)  
>>> which > > > >  reproduces > the problem. When the servlet is  
>>> requested (e.g., > > > > >  http://localhost:8080/OFSession), the  
>>> doGet() method responses > > > >  with a > generated XHTML+XForms  
>>> page. The generated page contains > > > >  the following > data:
>>> > > >  *Current (at the time when doGet() method was being  
>>> processed) > > >  session ID
>>> > > >  *Current (at the time when doGet() method was being  
>>> processed) & > > >  stored > attribute value (i.e. session ID)
>>> > > > > >  The generated page also contains XForms markup, which  
>>> submits a > > > > >  request > with method "post" to the servlet.  
>>> The servlet > > > > >  responses with an XML > document. The XML  
>>> document contains the > > > > >  following data:
>>> > > >  *Current (at the time when doPost() method was being  
>>> processed) > > >  session > ID
>>> > > >  *Current (at the time when doPost() method was being  
>>> processed) & > > >  stored > attribute value (i.e. session ID)
>>> > > > > >  Logically, all four values ought to be same, right?.  
>>> However, if > > > > >  the > XForms request is submitted  
>>> automatically upon the > > > > >  "xforms-ready" event, > then on  
>>> the first time/submission the > > > > >  session ID has changed  
>>> and, > therefore, also the stored session > > > > >  attribute  
>>> value is null (cannot be > found from this session > > > > >  
>>> because it is the same session where to the > attribute was > > >  
>>> > >  set). If the request is submitted again (CTRL+F5 in >  
>>> Firefox), > > > > >  then the values match.
>>> > > > >  If the XForms request is submitted manually, i.e. by  
>>> clicking a > > > > >  button/trigger, then all four values are the  
>>> same even on the > > > >  first > time/submission. In addition,  
>>> the example works fine also > > > >  when used > without Orbeon  
>>> Forms XForms Engine (ops xforms filter > > > >  turned off and >  
>>> using Mozilla XForms plug-in).
>>> > > > >  I'm using Orbeon Forms 3.6.0rc1 (filter set the the URL "/
>>> *") with > > > >  > standard configurations. You can test the  
>>> example/behaviour with > > > >  > manual/automatic submission by  
>>> commenting two lines (marked) in > > > >  the >  
>>> servlet.SessionTesterServlet.java class (lines 56 and 67.
>>> > > > >  Is this a bug in Oreon Forms? If not, how do I need to  
>>> modify my > > > >  example > web application to make it work also  
>>> on the first > > > >  time/submission?
>>> > > > >  Best regards
>>> > > > > >  -Markku Laine
>>> > > > >  On Fri, 16 Nov 2007, Erik Bruchez wrote:
>>> > > > > >  Gerrit,
>>> > > > > > >  This is not just one way of using XForms or Orbeon  
>>> Forms, so > > > > > >  don't > > worry about doing something  
>>> wrong. If the solution > > > > > >  works for you, then > > that's  
>>> great. So thanks for sharing it > > > > > >  on the list!
>>> > > > > > >  -Erik
>>> > > > > > > > >  On Nov 16, 2007, at 11:43 AM, Gerrit Germis wrote:
>>> > > > > > > >  Hi Chaminda,
>>> > > > > >  I'm also new to orbeon and xforms, so this might not be  
>>> (most > > > > > >  > > probably)
>>> > > > > >  the correct way to do it, but it seems to be working  
>>> for us so > > > > >  far.
>>> > > > > >  Here's how we set things up:
>>> > > > > >  - Our webapp is at /umadmin
>>> > > > > >  - Separate deployment to /ops
>>> > > > > >  - In the /umadmin context, the /umadmin/xforms-jsp/* is  
>>> filtered > > > > >  by > > > OPS,
>>> > > > > >  so this is where we put the .jsp file that generates  
>>> the > > > > >  XHTML/Xforms
>>> > > > > >  output (or in your case, you could simply put  
>>> the .xhtml file > > > > > >  > > somewhere
>>> > > > > >  in that directory). As a side-note, maybe also tell you  
>>> that you
>>> > > > > >  shouldn't put the .xml files that you load from the  
>>> xform itself > > > > >  in > > > any
>>> > > > > >  directory in /umadmin/xforms-jsp/*.. I've lost a lot of  
>>> time > > > > >  being
>>> > > > > >  puzzled by why it wasn't working...
>>> > > > > >  - We created a HttpServletResponseWrapper object to be  
>>> able to > > > > > >  > > capture
>>> > > > > >  the output of the page generated by Xforms (see later)
>>> > > > > >  - We add a cookie (JSESSIONID) with a path of "/" to  
>>> that > > > > >  response
>>> > > > > >  object so it is accessible by both contexts and we  
>>> don't loose > > > > >  our
>>> > > > > >  profile information put in the session during login
>>> > > > > >  - From within the servlet, we do a forward to the /
>>> xforms-jsp/* > > > > >  URL > > > that
>>> > > > > >  generates the actual form and capture the output  
>>> generated by > > > > >  OPS:
>>> > > > > >  RequestDispatcher rd =
>>> > > > > >  servlet.getServletContext().getRequestDispatcher("/
>>> xforms-jsp/our-app/in
>>> > > > > >  dex.xhtml");
>>> > > > > >  rd.forward(request, new  
>>> MyHttpServletResponseWrapper(response));
>>> > > > > >  form.setHTML(response.toString());
>>> > > > > >  return mapping.findForward("success");
>>> > > > > >  - This way, we can create a .jsp file and use "<%= > >  
>>> > > >  form.getHTML() %>" > > > in
>>> > > > > >  the JSP file to actually include the generated form  
>>> wherever we > > > > >  want > > > in
>>> > > > > >  the page.
>>> > > > > >  - As an additional benefit, this way of doing it allows  
>>> us to > > > > >  use > > > tiles
>>> > > > > >  too
>>> > > > > >  - Next problem was when submitting the data in the  
>>> form, this > > > > >  would > > > give
>>> > > > > >  us a URL like: http://localhost:8080/ops/xforms-server-submit 
>>>  > > > > >  which > > > we
>>> > > > > >  didn't want, so here's how we "fixed" this:
>>> > > > > >  The target of the submission defined in the xform is  
>>> another > > > > >  struts
>>> > > > > >  action. We defined a global forward in the struts-
>>> config.xml > > > > >  having > > > the
>>> > > > > >  'redirect="true"' attribute pointing to the first  
>>> action again. > > > > >  After
>>> > > > > >  doing the processing on the submitted data (by  
>>> processing the
>>> > > > > >  request.getInputStream()), we simply do a
>>> > > > > >  'mapping.findForward("ourforward");' which makes the  
>>> client > > > > > > >  > re-request
>>> > > > > >  the original .jsp file generating the form again...
>>> > > > > >  Again, I emphasise that this is probably not the way of  
>>> working > > > > >  with
>>> > > > > >  Xforms, so any suggestions or remarks are most welcome..
>>> > > > > >  Hope this helps,
>>> > > > > >  Gerrit
>>> > > > > >  -----Original Message-----
>>> > > > > >  From: Chaminda [mailto:[hidden email]]
>>> > > > > >  Sent: Friday, November 16, 2007 10:34 AM
>>> > > > > >  To: [hidden email]
>>> > > > > >  Subject: Re: [ops-users] submitting with method "post"  
>>> and > > > > >  loosing
>>> > > > > >  session attributes
>>> > > > > >  Hi Gerrit,
>>> > > > > >  Sorry for replying your thread to, This is not an  
>>> answer for you
>>> > > > > >  problem.
>>> > > > > >  According to your problem I guess you are familiar with  
>>> this. > > > > >  Thats > > > why
>>> > > > > >  Im
>>> > > > > >  posing my problem here,
>>> > > > > >  I want to send request to a servlet and in the servlet  
>>> set a > > > > >  request
>>> > > > > >  attribute. Upto that part I know. But I  dont know how  
>>> to > > > > >  dispatch > > > the
>>> > > > > >  request to XHTML other that JSP.
>>> > > > > >  In JSP we do like this
>>> > > > > >  dispatcher.forward("/WEB-INF/Jsp/my.jsp");
>>> > > > > >  How can I do this for xhtml,
>>> > > > > >  Thanks, Sorry again for posing to here
>>> > > > > >  Gerrit Germis-2 wrote:
>>> > > > > > > >   Hi,
>>> > > > > > > >   I'm using struts/tiles with the nightly build of  
>>> xforms > > > > > > > > >   > > >  (separartely
>>> > > > > > >   deployed). I have successfully created and populated  
>>> my > > > > > >   xform, but
>>> > > > > >  now,
>>> > > > > > >   when I try to submit the results back to another  
>>> action using > > > > > >   the
>>> > > > > >  "post"
>>> > > > > > >   method, I loose my profile information that was  
>>> stored in the > > > > > >   > > > >  session.
>>> > > > > > >   This is what my submission looks like:
>>> > > > > > > >     <xforms:submission id="test-submit"
>>> > > > > > >         action="http://localhost:8080/umadmin/ 
>>> someAction" > > > > > > > > >         >        method="post"
>>> > > > > > >         ref="instance('document-instance')/data/
>>> DocumentRevision"
>>> > > > > > >   replace="all"/>
>>> > > > > > > >     <xforms:submit submission="test-submit">
>>> > > > > > >         <xforms:label>Go to action!</xforms:label>
>>> > > > > > >     </xforms:submit>
>>> > > > > > > >   The complete flow is like this:
>>> > > > > > > >   - setup: /xforms-jsp/* is setup to be filtered by  
>>> OPS
>>> > > > > > >   - User logs into the website, profile information is  
>>> stored > > > > > >   in
>>> > > > > >  session
>>> > > > > > >   - form is generated by navigating to URL:
>>> > > > > > >   http://localhost:8080/umadmin/xforms-jsp/some-app
>>> > > > > > >   - User fills in data
>>> > > > > > >   - User presses the submit button labeled "Go to  
>>> action!" > > > > > >   mentioned
>>> > > > > > >   above
>>> > > > > > >   - PROBLEM: user is prompted for login again since no  
>>> profile
>>> > > > > > >   information was found in session
>>> > > > > > > >   How can I make sure the profile information is not  
>>> lost on > > > > > > >   > > > > >  submission?
>>> > > > > > > >   Sincerely
>>> > > > > > >   Gerrit
>>> > > > > > > > > >   --
>>> > > > > > >   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
>>> > > > > > >   OW2 mailing lists service home page: http://www.ow2.org/wws
>>> > > > > > > >   --
>>> > > > > >  View this message in context:
>>> > > > > >  http://www.nabble.com/submitting-with-method-%22post%22-and-loosing-sess
>>> > > > > >  ion-attributes-tf4803253.html#a13790034
>>> > > > > >  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
>>> > > > > >  OW2 mailing lists service home page: http://www.ow2.org/wws
>>> > > > > > >  --
>>> > > > >  Orbeon Forms - Web Forms for the Enterprise Done the  
>>> Right Way
>>> > > > >  http://www.orbeon.com/
>>> > > > > > > > >  --
>>> > > >  Markku Laine <[hidden email]>
>>> > > >  Research assistant, Helsinki University of Technology
>>> > > >  Telecommunications Software and Multimedia Laboratory
>>> > > >  P.O.Box 5400, FIN-02015 HUT, FINLAND
>>> > > >  Mobile. +358-50-565 8179 (Finland)
>>> > > >  Mobile.  +64-21-037 3605 (New Zealand, 01 Oct - 21 Dec, > >  
>>> > >  2007)<OFSession.war>
>>> > > >  --
>>> > > >  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
>>> > > >  OW2 mailing lists service home page: http://www.ow2.org/wws
>>> > > --
>>> > > Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>>> > > http://www.orbeon.com/
>>> > > --
>>> > 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
>>> OW2 mailing lists service home page: http://www.ow2.org/wws
>>
>> --
>> Orbeon Forms - Web Forms for the Enterprise Done the Right Way
>> http://www.orbeon.com/
>>
>>
>
> --
> Markku Laine <[hidden email]>
> Research assistant, Helsinki University of Technology
> Telecommunications Software and Multimedia Laboratory
> P.O.Box 5400, FIN-02015 HUT, FINLAND
> Mobile. +358-50-565 8179 (Finland)
> Mobile.  +64-21-037 3605 (New Zealand, 01 Oct - 21 Dec, 2007)
>
> --
> 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
> OW2 mailing lists service home page: http://www.ow2.org/wws
--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: submitting with method "post" and loosing session attributes

Markku Laine
Hi Erik,


> I checked in all the code should be checked in and present in the build you
> got.
>
> You wouln't have both an ops.jar and an orbeon.jar in your WEB-INF/lib, by
> any chance?

You were right, I had forgot to update the JAR file to my web apps. Now,
the test app and my own apps are working perfectly! Thanks heaps!!!

Btw. According to the instructions at:
http://www.orbeon.com/ops/doc/reference-xforms-java

One should copy ops-xforms-filter.jar into WEB-Inf/lib/. However, the
newest version of Orbeon Forms doesn't inlcude that file. It includes
orbeon-xforms-filter.jar which is probably equivalent to the old one,
right?

What about ops.jar and orbeon.jar you are referring to above? Should I
copy/use orbeon.jar instead of orbeon-xforms-filter.jar or what is the
purpose of that JAR file? Well... anyway, at least by using the
orbeon-xforms-filter.jar file the systme works. Maybe updating the
instructions would be a good idea, in case you have forgot to do so.

Again, thanks heaps! Finally, my own XForms-based framework and sample web
apps are working perfectly :)


-Markku


--
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
OW2 mailing lists service home page: http://www.ow2.org/wws
Reply | Threaded
Open this post in threaded view
|

Re: submitting with method "post" and loosing session attributes

Erik Bruchez
Administrator
Markku,

Phew :-) Glad it's working.

You are right, ops-xforms-filter.jar was renamed to orbeon-xforms-
filter.jar but the doc did not reflect this. I fixed this in the CVS.

Similarly, orbeon.jar replaces ops.jar. orbeon.jar contains about all  
the code for Orbeon Forms except resources. orbeon-xforms-filter.jar  
is a very small JAR containing only the filter to use in separate  
deployment.

-Erik

On Dec 18, 2007, at 2:25 PM, .::: Markku :::. wrote:

> Hi Erik,
>
>
>> I checked in all the code should be checked in and present in the  
>> build you got.
>>
>> You wouln't have both an ops.jar and an orbeon.jar in your WEB-INF/
>> lib, by any chance?
>
> You were right, I had forgot to update the JAR file to my web apps.  
> Now, the test app and my own apps are working perfectly! Thanks  
> heaps!!!
>
> Btw. According to the instructions at:
> http://www.orbeon.com/ops/doc/reference-xforms-java
>
> One should copy ops-xforms-filter.jar into WEB-Inf/lib/. However,  
> the newest version of Orbeon Forms doesn't inlcude that file. It  
> includes orbeon-xforms-filter.jar which is probably equivalent to  
> the old one, right?
>
> What about ops.jar and orbeon.jar you are referring to above? Should  
> I copy/use orbeon.jar instead of orbeon-xforms-filter.jar or what is  
> the purpose of that JAR file? Well... anyway, at least by using the  
> orbeon-xforms-filter.jar file the systme works. Maybe updating the  
> instructions would be a good idea, in case you have forgot to do so.
>
> Again, thanks heaps! Finally, my own XForms-based framework and  
> sample web apps are working perfectly :)
>
>
> -Markku
--
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
OW2 mailing lists service home page: http://www.ow2.org/wws