Note that there are some explanatory texts on larger screens.

plurals
  1. POJetty 8 WebSocket and Session timeout
    primarykey
    data
    text
    <p>Im new in jetty and i try do develop a little application that uses different servlets. One of this servlets is a WebSocketServlet. Now im trying to build an authentication mechanism and my basic idea is to use jetty's default HttpSession implementation, which can be accessed by HttpServletRequest.getSession();</p> <p>So lets say I want to create a little chat application (im talking only about the server side), and lets say that there are just two servlets:</p> <ul> <li>a WebSocketServlet for receiving and forwarding chat messages to the other users that are in the same chat room. This has the URL /servlets/chat</li> <li>In addition, there is second "normal" HttpServlet called AvatarServlet. The functionality of this servlet is quite simple: This servlet handles HTTP POST events to allow the current user to upload and change his own avatar profile picture. The URL is /servlets/avatar</li> </ul> <p>So the avatar servlet should only handle HTTP POST if the user is logged in, which means to me, that the user has a valid HttpSession (of course the same HttpSession as the chat servlet).</p> <p>My question: lets say a user chats for 1 hour via the chat servlet and decides after this hour to change his avatar picture via my avatar servlet. Since im working with websockets the page is never reloaded and the chat servlet was only invoked at the beginning (1 hour ago) to etablish the websocket connection.</p> <p><strong>So i guess</strong>, even if the user was online and active all the time, the session would be expired, when the user try to use the avatar servlet (after 1 hour).</p> <p>Does my assumption is correct? Does anyone has experience with this topic or know a better solution?</p> <p>Thank you</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload