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
|