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 6861715
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T02:34:14+00:00 2026-05-27T02:34:14+00:00

How is the session defined in @SessionScoped CDI bean? Is this annotation valid only

  • 0

How is the session defined in @SessionScoped CDI bean?
Is this annotation valid only when called from Servlet container, where the session is well defined in form of HttpSession?

If not, than how an EJB with @Inject @SessionScoped MyBean myBean can know what the session really is? I mean, methods of this EJB could have been invoked by a standalone client, RESTful WS or by some other view.
What should happen in such case? Should the annotation have no meaning, should it inject fresh MyBean instance for each request or maybe it should retain the same instance across all requests?

  • 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-27T02:34:14+00:00Added an answer on May 27, 2026 at 2:34 am

    Taken from the @SessionScoped specification

    The session scope is active:

    during the service() method of any servlet in the web application,
    during the doFilter() method of any servlet filter and when the
    container calls any HttpSessionListener, AsyncListener or
    ServletRequestListener.

    So in short, yes. It is bound to the HttpSession. Also:

    The session context is shared between all servlet requests that occur
    in the same HTTP session. The session context is destroyed when the
    HTTPSession times out, after all HttpSessionListeners have been
    called, and at the very end of any request in which invalidate() was
    called, after all filters and ServletRequestListeners have been
    called.

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

Sidebar

Related Questions

I have a form bean defined in session scope and a controller bean defined
I defined my session variable, in my Global.asax called user like this protected void
I have JSP with calling to my Session Bean, I've implemented this via JNDI
I have a GridItemCollection defined as GridItemCollection items = (GridItemCollection) Session[driveLayout]; I want to
session.createQuery(Select attribute from GoodsSection tgs + join gs.ascendants ags join ags.attributes attribute + where
I have defined a function called is_logged_in? in a user defined library stored in
I'm developing a java servlet web application that manages information from multiple databases (all
So I have my SqlDataSource with a SelectQuery defined as follows: SELECT * FROM
Is it possible to enumerate the currently-defined session variables? I've been looking for the
I am having trouble with a session id not being defined. The session variable

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.