View Full Version : Accessing the PHP Session from a Servlet/Bean
05-30-2010, 10:26 PM
I need to access the PHP Session from a Servlet/Filter.
Basically I need to set two values
and in another case I have to invalidate these values/destroy the php session.
the PHP code would be
$_SESSION["userId"] = 5432;
$_SESSION["username"] = "domdorn";
how can I do that in Java in a filter?
06-10-2010, 02:15 AM
Ok, I've got it working after HOURS of work, debugging & reverse engineering.
The key was to copy the QuercusServlet and expose the QuercusContext as a Attribute in the ServletContext so its accessible in Servlets, Filters, etc.
I simply added
on line 573 of QuercusServlet.
I will blog about the exact things I've done, but it would be really a good idea to think about how to make quercus more open. Declaring stuff protected / private is fine, as long as you at least provide some getters...
06-10-2010, 10:09 AM
Good work man! (but reverse engineering? :D)
Isn't the context exposed as of version 4.0.7+?
06-10-2010, 12:28 PM
>(but reverse engineering? )
a lot of digging through the code etc.
> Isn't the context exposed as of version 4.0.7+?
at least its not documented somewhere... at least not somewhere I could find it!
If you know how to get access to it, please tell me.
06-10-2010, 04:08 PM
blog post ready:
any comments appreciated :)
vBulletin® v3.8.6, Copyright ©2000-2017, Jelsoft Enterprises Ltd.