Re: OpenAmf recreates sessions when cookies aren't enabled.

Will Prater <[email protected]>
Newsgroups gmane.comp.java.openamf.user
Message-ID <[email protected]>
On Jul 7, 2005, at 9:17 PM, Troy Gardner wrote:

>
>
>> This did not work for our application server.
>>
>
> I checked turning off cookies in the browser and was able to  
> replicate the
> session being recreated with every request error. It did work in  
> every other
> case (browser, projector or swf off filesystem). I don't have time  
> to fix it,
> but I looked into it for a bit, here's what I found.
>
> The cookies= false is inside server.xml not web.xml in the context  
> tag.
> http://jakarta.apache.org/tomcat/tomcat-4.0-doc/config/context.html
>
> Tomcat (ServletAPI) should use response.encodeURL() on the response  
> in order to
> do URL rewriting (putting a sessionID in the URL). This is supposed  
> to use an
> alternate URL (as far as I can tell) e.g. /openamf/someothergateway
>
> the line where the session is created in OpenAMF is the
> DefaultGateway.preInvokeService method
> httpServletRequest.getSession().getAttribute 
> (serviceInvoker.getPersistentServiceName());
> -----------------------------/\
>
> I'm imaginining but not 100% sure that the encodeURL change will  
> have to happen
> around serializeAMFMessage.

Here is what I am thinking to add:

     protected AMFMessage processMessage(
         HttpServletRequest req,
         AMFMessage message) {
         AMFMessage responseMessage = new AMFMessage();
         for (Iterator bodies = message.getBodies(); bodies.hasNext 
();) {
             AMFBody requestBody = (AMFBody) bodies.next();
             // invoke
 >            String newUrl = req.getRequestURL() + "/?JSESSIONID=" +  
req.getSession().getId();
 >            AMFHeader gatewayHeader = new AMFHeader 
("ReplaceGatewayUrl", true, newUrl);
 >            responseMessage.addHeader(gatewayHeader);
             Object serviceResult = invokeBody(req, requestBody);
             String target = getTarget(requestBody, serviceResult);
             AMFBody responseBody = new AMFBody(target, "null",  
serviceResult);
             responseMessage.addBody(responseBody);
         }
         return responseMessage;
     }


> Troy Gardner -"How you live your seconds, is how you live your  
> days, is how you live your life..."
>
> http://www.troygardner.com -my world
> http://www.troyworks.com - building Rich Internet Applications
> http://www.intrio.com -helping bridge the gap between the humans  
> and machines. Home of the Flickey™
>
>
> -------------------------------------------------------
> This SF.Net email is sponsored by the 'Do More With Dual!' webinar  
> happening
> July 14 at 8am PDT/11am EDT. We invite you to explore the latest in  
> dual
> core and dual graphics technology at this free one hour event  
> hosted by HP,
> AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
> _______________________________________________
> Openamf-user mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/openamf-user
>



-------------------------------------------------------
This SF.Net email is sponsored by the 'Do More With Dual!' webinar happening
July 14 at 8am PDT/11am EDT. We invite you to explore the latest in dual
core and dual graphics technology at this free one hour event hosted by HP, 
AMD, and NVIDIA.  To register visit http://www.hp.com/go/dualwebinar
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.