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

  • SEARCH
  • Home
  • 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 5959277
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T18:39:43+00:00 2026-05-22T18:39:43+00:00

I can logout user after defined time of inactivity. <session-timeout>240</session-timeout> But, is there some

  • 0

I can logout user after defined time of inactivity.

<session-timeout>240</session-timeout> 

But, is there some way to logout in specified time, or better, for example until 5 minutes of inactivity after specified time.?

  • 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-22T18:39:44+00:00Added an answer on May 22, 2026 at 6:39 pm

    You can change the session timeout by HttpSession#setMaxInactiveInterval() wherein you can specify the desired timeout in seconds.

    When you want to cover a broad range of requests for this, e.g. all pages in folder /admin or something, then the best place to do this is to create a Filter which is mapped on the FacesServlet which does roughly the following job:

    @Override
    public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws ServletException, IOException {
        HttpServletRequest request = (HttpServletRequest) req;
        HttpSession session = request.getSession();
    
        if (request.getRequestURI().startsWith("/admin/")) {
            session.setMaxInactiveInterval(60 * 5); // 5 minutes.
        } else {
            session.setMaxInactiveInterval(60 * 240); // 240 minutes.
        }
    
        chain.doFilter(req, res);
    }
    

    In a JSF managed bean the session is available by ExternalContext#getSession():

    HttpSession session = (HttpSession) FacesContext.getCurrentInstance().getExternalContext().getSession();
    // ...
    

    Or when you’re already on JSF 2.1, then you can also use the new ExternalContext#setSessionMaxInactiveInterval() which delegates to exactly that method.

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

Sidebar

Related Questions

How can I logout or disconnect a Facebook user in the Facebook connect session?
I have some javascript that should log a user out after a certain period
Here is the problem that I am having. The user can log in but
My webapp has users who login. There is a timeout. Before the session expires,
Can anyone recommend a great CodeIgniter Registration/Login/Logout library for beginners to web development? I
Can someone tell me, what the href with the # means? <a id=logoutLink href=#>Logout</a>
can you recommend some good ASP.NET tutorials or a good book? Should I jump
I'm interested in disallowing the following after logout: -- no back button -- no
For some reason, my jQuery isn't working properly, and I can't spot the mistake,
Possible Duplicate: How do I expire a PHP session after 30 minutes? I am

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.