From: <php...@li...> - 2010-08-30 19:20:49
|
Hi Jost, My point is, is it possible to configure java_session(); such that it returns a null when no session currently exists? Or is there any function to determine whether a session already exists? Thanks. Regards, Kok Hoor Hi Kok, > I am a newbie using php-java bridge. Is there any way to make any calls > to Java to return session only if it exists, and not create a new one? If JavaBridge.war back end is running in a servlet engine or JEE server, the code: <?php require_once("java/Java.inc"); java_session(); ?> uses an existing session or creates a new one, depending on whether your browser(!) has sent a session cookie or not. > The reason I ask is because, by default, our existing Java web does not > create any session until after the user logs into our system. java_session() (or session_start(), for that matters) should be called before any response has been created. Furthermore, if an HTTP front- and a JEE back-end is used, java_session() must be the first Java statement in your PHP script. Otherwise you'll get an error message that a session cannot be allocated (you won't get a session, not even a new one). It sounds as if your browser has cookies switched off, so that the server tries to allocate a new session for each request. Regards, Jost Bökemeier |