From: <php...@li...> - 2010-09-06 16:32:39
|
Hi, > I need to access a servlet (not created by me) from a PHP script using > file_get_contents, but I need to maintain the same session Don't. Please use requestDispatcher.include() instead. You cannot re-connect to the current HTTP server. If you do, you might run into a deadlock. Imagine a HTTP server with a pool size of 1. If you invoke a script t1.php and open a URLConnection back to http://localhost/t2.php, you HTTP server will block until t1 terminates, which will never happen because it waits for the HTTP server to deliver the content of t2. Please either use the java_virtual() method or (if running in apache or iis) the virtual() method, which bypass the HTTP servers thread-/process pool. This will solve your session problem, too. :) Regards, Jost Bökemeier |