httpsession

Beans serialization in JSP

霸气de小男生 提交于 2019-12-06 08:07:43
Why some times tutorials make beans implement Serializable object and others do not? I know that object should be serialized when I want to send it through a network, so does that prove that each bean used in sessions should implements Serializable objects and beans defined in JSP pages should not since they are not transferred using HTTP requeset I know that object should be serialized when I want to send it through a network, so does that prove that each bean used in sessions should implements Serializable You seem to believe that objects in a session are sent to the client in the http

Is Spring session scoped bean saved in HttpSession?

烂漫一生 提交于 2019-12-06 03:45:34
问题 Since I don't have in depth knowledge of spring session scope implementation. Can anyone please tell me if it is wise to use Spring Session scoped beans, where HttpSession object is very crucial. Like a web application where thousands of users access the site simultaneously. Is spring session scoped bean saved in HttpSession object? Or even if HttpSession object only refers to the spring session scoped bean, are we not making session object heavy? How is it different form storing any bean

How can I get session from a common class in Spring Boot?

五迷三道 提交于 2019-12-06 03:43:53
I want to get session from a common class. Using @Autowired didn't work. public class TMessageHandlerFactory implements MessageHandlerFactory { @Autowired private HttpSession session; @Override public void data(InputStream data) { int userId = (int)session.getAtrribute("key"); //session null .... //do sth } } The constructor also didn't work @Component public class SMTPRunner implements ApplicationRunner { @Autowired private UserService userService; // userService can access @Autowired private HttpSession session; // session can't access @Override public void run(ApplicationArguments

Google App Engine how to track httpsession destroy

老子叫甜甜 提交于 2019-12-06 02:15:37
anybody knows how to track httpsession destroy with GAE? I've found that HttpSessionListener doesn't work properly in GAE and sessionDestroyed method never calls. To be more specific I have an information that I store in database when user logins to the application, but if some user is inactive for some time I need to remove this info from db, that will be easy if sessionDestroyed method will be invoked when such event happens, as for now I did cron job which runs each minute, the job queries all data of this kind handles in memory which data is inactive and removes it. But this is very

mvc controller test with session attribute

依然范特西╮ 提交于 2019-12-05 21:13:05
I'm trying to test a method with this signature: @Autowired HttpSession http_Session; @RequestMapping(method=RequestMethod.GET, value="/search/findByName") public @ResponseBody List<Map> search(@RequestParam(value="name", required=true) String name){ Integer user_id = http_Session.getAttribute("userinfo"); } userinfo is a class which contains informations about the user and set in session scope when the user logged in.but when I try the test : @RunWith(SpringJUnit4ClassRunner.class) @WebAppConfiguration @ContextConfiguration(locations = { "classpath:/META-INF/applicationContext.xml"}) public

Spring MVC - Session differences

梦想与她 提交于 2019-12-05 20:07:51
Are there any differences between getting session through HttpServletRequest.getSession() and HttpSession injected in controller's method? Basically there is no diffrerence between the session object injected into a Spring MVC controller: @RequestMapping(value = "/somepath", method = RequestMethod.POST) @ResponseBody public JsonResponse someMethod (HttpSession session) { // play with session attributes } And the session object retrieved from the HttpServletRequest : @RequestMapping(value = "/somepath", method = RequestMethod.POST) @ResponseBody public JsonResponse someMethod

How to obtain an HttpSession Object from SessionID?

老子叫甜甜 提交于 2019-12-05 17:50:25
I want to invalidate sessions of users based on some Event. I store their sessionID, how to get their HttpSession from this ID? The HttpSessionContext class is deprecated with no replacement. Servlet 2.2 specifically deprecated this for security reasons so there shouldn't be any official way to do this. Not recommended but you can can try to use Manager.findSession() if you use Tomcat. I just removed HttpSession from my application. It's really hard to keep sessions in sync when many servers are running. We tried to tweak it by writing our own manager but can never get it work right. Finally,

Spring Security: same SecurityContext-instance in multiple ThreadLocals, how does that work?

江枫思渺然 提交于 2019-12-05 13:33:17
Ive some questions about Spring Security 3.0.5 and the SecurityContext. First of all, Ill try to conclude what I know: SecurityContextHolder stores SecurityContext Between Request, SecurityContext is stored in HttpSession Begin of Request: SecurityContextHolder gets SecurityContext from HttpSession End of Request: SecurityContextHolder puts SecurityContext in HttpSession During the Request, on the server, SecurityContextHolder uses a ThreadLocal. Everywhere in the application (same request), the SecurityContext can be accessed Now my question.... --> Two Requests: the SecurityContext-instance

HttpSession setAttribute doesn't always insert new object

会有一股神秘感。 提交于 2019-12-05 01:52:07
问题 I am working on an upgrade from WLS10g and JavaEE6 to WLS12c and JavaEE7. I have noticed a difference on how HttpSession.setAttribute works. In WLS10, any object already stored under a certain key would always be replaced. In WLS12 the object is not replaced if newObject.equals(oldObject) . This is a problem for us, because the applications have objects like this: class ValueObject { int key; String data; @Override public int hashCode() { return key; } boolean equals(Object o) { if (o == null

Is Spring session scoped bean saved in HttpSession?

前提是你 提交于 2019-12-04 09:14:51
Since I don't have in depth knowledge of spring session scope implementation. Can anyone please tell me if it is wise to use Spring Session scoped beans, where HttpSession object is very crucial. Like a web application where thousands of users access the site simultaneously. Is spring session scoped bean saved in HttpSession object? Or even if HttpSession object only refers to the spring session scoped bean, are we not making session object heavy? How is it different form storing any bean directly in HttpSession object (making HttpSession object heavy point of view)? The object is not really