Results 1 to 3 of 3

Thread: Multiple Session session scoped beans in PAR

  1. #1
    Join Date
    Jan 2009
    Posts
    7

    Default Multiple Session session scoped beans in PAR

    Hello,

    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.

    Code:
    [2009-03-09 17:21:49.096] nection(14)-192.168.1.21 <SPSC1000I> Creating web application '/xxx.domain'.
    [2009-03-09 17:21:49.174] nection(14)-192.168.1.21 <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. #2
    Join Date
    Mar 2005
    Location
    The Netherlands
    Posts
    121

    Default

    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. #3
    Join Date
    Jan 2009
    Posts
    7

    Default

    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.

    Mickaël.

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •