Get Java Session Values from PHP

74 views
Skip to first unread message

austin...@gmail.com

unread,
Sep 16, 2015, 1:32:00 PM9/16/15
to Quercus
I'm trying to get Java session values from within PHP:

$request = quercus_servlet_request();
$username = $request->getAttribute("SPRING_SECURITY_LAST_USERNAME");

But it comes up empty.

I'm using Quercus 4.0.39 and Tomcat 8.0.26.

I'm able to get the same session value under Tomcat 7 using PHP Java Bridge, with:
$javasession = java_session();
$request = java_context()->getHttpServletRequest();
$requestedsessionid = $request->getRequestedSessionId();
$requestsession = $request->getSession();
$requestsessionid = java_values($requestsession->getId());
$userName = trim(java_values($javasession->get("SPRING_SECURITY_LAST_USERNAME")));

I tried seeing all of the session variables with:
$request = quercus_servlet_request();
$vars = $request->getAttributeNames();
print_r($vars, true);

But that came up empty.

How can I read Java session variables from within PHP using Quercus?

Thanks!

Kaz Nishimura

unread,
Sep 16, 2015, 8:22:24 PM9/16/15
to Quercus

How about $request->getSession()->getAttribute?


2015年9月17日(木) 2:32  <austin...@gmail.com>:
--
You received this message because you are subscribed to the Google Groups "Quercus" group.
To unsubscribe from this group and stop receiving emails from it, send an email to caucho-quercu...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

austin...@gmail.com

unread,
Sep 17, 2015, 12:24:27 AM9/17/15
to Quercus
Thank you! That works.
Reply all
Reply to author
Forward
0 new messages