From: <php...@li...> - 2012-04-27 11:04:58
|
Hi I am using the bridge to communicate with Spring beans on the server side : public static function loadSpringBean($name) { $session = java_session(); $ctx= java("org.springframework.web.context.support.WebApplicationContextUtils")->getWebApplicationContext($session->getServletContext()); return $ctx->getBean($name); } and then I call methods on the bean - All works ok Now I want to pass on the name of the current user, so I added : $session->put("username", $username); Now how do I get at this on the server side - I have tried ServletRequestAttributes attr = (ServletRequestAttributes) RequestContextHolder.currentRequestAttributes(); HttpSession session=attr.getRequest().getSession(false); String username= session.getAttribute("username")); but this only leads to an Exception: No thread-bound request found: Are you referring to request attributes outside of an actual web request Is there any utility method in the bridge, where I can get at the current session/request Hermod * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * This email with attachments is solely for the use of the individual or entity to whom it is addressed. Please also be aware that the DNB Group cannot accept any payment orders or other legally binding correspondence with customers as a part of an email. This email message has been virus checked by the anti virus programs used in the DNB Group. * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * |