Announcement Announcement Module
No announcement yet.
Multiple Session session scoped beans in PAR Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Multiple Session session scoped beans in PAR


    I have several bundles in my PAR. Among them I have 2 web modules:
    - the first is used as my BlazeDS controller.

    - and the second contains my domain classes and some of these classes are scoped to the session.

    Is there another way to use session scoped bean in the second bundle without declare in MANIFEST.MF Bundle-type : Web
    Because it creates 2 web application and one would have been sufficient in
    term of context path.

    [2009-03-09 17:21:49.096] nection(14)- <SPSC1000I> Creating web application '/xxx.domain'.
    [2009-03-09 17:21:49.174] nection(14)- <SPSC1000I> Creating web application '/webappName'.
    [2009-03-09 17:21:49.487] async-delivery-thread-1  <SPSC1001I> Starting web application '/xxx.domain'.
    [2009-03-09 17:21:50.049] async-delivery-thread-1  <SPSC1001I> Starting web application '/webappName'.
    If anyone has an idea ?

  • #2
    Session scope itself is only available in web applications obviously, and each bundle gets its own (Web)ApplicationContext depending on its type. So what you could do is define your classes in the non-web bundle and export their packages, but define the corresponding bean definitions in the web bundle. That seems to make sense anyway: it makes no sense otherwise to expose objects of these types as generic service instances if they require a session scope that's defined by the using bundle. Exposing their types is enough.


    • #3
      Thank you,

      it was a misconception to think about exporting domain classes as OSGi services.
      So I exported my domain packages as you said, imported them in my web module and declared a singleton bean of my domain object with session scope.
      And it works perfectly.

      I was not sure that instanciate a bean with an imported type was possible. The framework is powerful.