Michael Czeiszperger [EMAIL PROTECTED] wrote: > On Mar 15, 2005, at 4:34 PM, David Cooper wrote: > >I have a site built with PHP 4.3 that sends requests to a JBoss j2ee > >application using either the include() or the virtual() functions from > >php > >land. Each request from a .php file seems to get a new http session > >in the > >JBoss 4.x server. > > > >I thought if I passed the JSESSSIONID in on an http request that would > >hook > >up the request from the PHP engine to the session in the JBoss domain. > > It > >simply doesn't seem to work. Even with the JSESSIONID set on each > >request > >there seems to be a new session created for each request from a .php > >file. > > > > This would depend on the session implementation of JBoss, so you'd have > to check its source to be sure, but the way 99% of session tracking > works is the first HTTP request that lacks a valid session id creates a > new session on the server. You can't just make up a session ID and > have it accepted. I would approach this problem by first sending an > HTTP request without a session ID, grab the session ID from the > response, and place that session ID in all further requests from the > same user.
Along with this first request, JBoss is probably including a Set-Cookie command in the HTTP response for any request that does not include JSESSIONID in its cookie. If you want this cookie to be maintained from request to request, you will have to echo it in both directins. Anytime that there is a response from JBoss that includes Set-Cookie you will need to read it from the headers in the response and then set the cookie on the response that PHP builds. Keep in mind that you will need to do this before committing any output to the browser, because you cannot write HTTP headers once you have begun sending content. Likewise, anytime that a request arrives from the browser and it includes a JSESSIONID in the cookie, you will need to set that as one of the headers in the request that you send from PHP to JBoss. I think that, if you cover both those points, this should work quite cleanly. Best of luck and skill with your application. Kind regards, Justis Peters _______________________________________________ Juglist mailing list [email protected] http://trijug.org/mailman/listinfo/juglist_trijug.org
