-
1. Re: keeping context using external webapp
gavin.king Mar 29, 2007 11:34 AM (in response to ollix)Wrap your servlet in the ContextFilter, and pass the conversation id in a request parameter called "conversationId", or whatever you set it to be in components.xml.
-
2. Re: keeping context using external webapp
ollix Mar 29, 2007 12:19 PM (in response to ollix)gavin,
the problem is more complicated.
the payment server by contract reads my callback page, parses it to enter some payment provider specific information and displays it.
That means, that my server gets no jsessionId from that payment server and thus cannot assign the request to the correct session. the solution, of course is to send the jsessionId explictily to the payment server and create a callback URL that contains it ala ".../callback.seam;jsessionId=xxx?cid=3".
My problem now is how to programmatically retrieve the current jsessionId inside a helper bean.
Can you give me a hint how to get a hold on that id?
Thanks a lot
:ollix -
3. Re: keeping context using external webapp
ollix Mar 29, 2007 1:24 PM (in response to ollix)ok, i found a solution. not very elegant, but it works.
@Name("jsessionId") public class SessionIdHelper { @Override public String toString() { return ((HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest()).getSession().getId(); } }
-
4. Re: keeping context using external webapp
ollix Mar 29, 2007 4:56 PM (in response to ollix)just in case someone needs to do the same, I wrap up my last post.
I created that ugly helper, to enable to use the web container's jsessionid. I use it to create a simple link, that contains both the jsessionid and the conversation id. The remote server uses this information to setup a callback URL :.../callback.seam;#{jsessionId}?cid=#(cid)...
The cid component is a second ugly helper, that returns the current conversationId:@Name("cid") public class ConversationIdHelper { @Override public String toString() { return Conversation.instance().getId(); } }
The remote server calls this URL, retrieves the resulting HTML and injects some payment information using predefined provider specific tags. The resulting HTML is than represented to the user. The URL seen by the user will be a payment provider one, but the content looks just like the stuff from our website. The only "problem" left is the need to use absolute URLs for all Images, stylesheets etc. I used a second template for this.
If somebody knows a more elegant way to do the same, I would be happy to get some feedback. -
5. Re: keeping context using external webapp
fhh Mar 30, 2007 5:07 AM (in response to ollix)
The cid component is a second ugly helper, that returns the current conversationId
That functionality is already built into Seam. Check the examples.
Regards
Felix
BTW: Have a look at @Unwrap. It wcould simplify your code.