Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7011281
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:06:25+00:00 2026-05-27T22:06:25+00:00

Im new in jetty and i try do develop a little application that uses

  • 0

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();

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:

  • 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
  • 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

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).

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.

So i guess, 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).

Does my assumption is correct? Does anyone has experience with this topic or know a better solution?

Thank you

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:06:26+00:00Added an answer on May 27, 2026 at 10:06 pm

    You could send an ajax-request every x minutes that contains nothing but the session id and thus basically ‘touches’ the session. This way, as long as the user has the chat-window open, the session is kept alive. When the chat-window is closed, the session times out.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

i'm trying to develop a client-server chat application using java servlets and mysql(innoDB engine)
I have an application that is served using jetty 6.1.12 from serverA. serverA is
I want to create simple Spring MVC Hello world application that runs under Jetty
Ive had a similar question as this one before, and when that solved this
I'm new to Scala and wanting to develop a simple little Scala Wicket webapp
im trying to develop an web server by embedding jetty. So with jetty 7.3
New to javascript/jquery and having a hard time with using this or $(this) to
New to both Ruby and Rails but I'm book educated by now (which apparently
New to Linux programming in general. I am trying to communicate with a kernel
new Date(05-MAY-09 03.55.50) is any thing wrong with this ? i am getting illegalArgumentException

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.