JSF 2/Trinidad redirect to external site and back from external site, preserving view/pageflow scope

StackOverflow https://stackoverflow.com/questions/10440001

سؤال

My objective is to redirect the user to an external site and have them come back to my site but preserve the Trinidad pageFlowScope. This way I can do some processing and state saving in various pages, send them off to the external site for some external processing and then have them come back to my site to finish processing. From the users perspective they'd appear to be doing one continuous flow and possibly be doing multiple of these concurrently in different browser tabs.

The way I'm trying to transition everything, which does work fine except state is not restored, is by doing a post from a page in my flow to the external site and then the external site does a post back to my site in the next page. It's almost like a disconnected ADF task flow executing on a separate server and the returning back into my task flow.

mysite.foo/faces/summary.jsf -> POST externalappserver.foo/faces/startexternal.jsf -> another page -> POST myite/foo/faces/continue.jsf

I've looked all over the place and have found various issues surrounding javax.faces.ViewState but nothing on pulling that out, giving it to an external site, and then having an external site post it back some time later to a different (or even the same) page where it came from originally.

Any ideas on how I can manipulate the state so that I can rendezvous back to my site properly?

هل كانت مفيدة؟

المحلول

I ended up solving this by putting the Trinidad hidden form parameter on the callback URL I passed to the other service. So if my server/app is http://localhost:7001/context/pageout.jsf and it posts to another site with the callback URL, the call back URL is now:

http://localhost:7001/context/pageout.jsf?_afPfm=234z345

This allows Trinidad to restore it's page flow in conjunction with the JSESSIONID cookie provided by the browser. I didn't need to deal with the ViewState field or any other session problem. My pageFlowScope is restored all is well.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top