You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@openwebbeans.apache.org by Mike Wilson <mi...@hotmail.com> on 2009/02/19 18:21:56 UTC

session creation

I got things running with Jetty 6.1.15rc4 and now I have a question
about session creation:

Will OpenWebBeans always force a session to be created? In the 
current codebase (see below) this seems to be the case. If 
possible, it would be nice if sessions only were created on-demand
when a component needs session (or conversation) storage.
Doing it this way would make it possible to have stateless requests
that avoid the overhead of session creation when possible.

ContextFactory.java:

    public static void initRequestContext(HttpServletRequest request)
    {
        requestContext.set(new RequestContext());// set thread local
        requestContext.get().setActive(true);

        if (request != null)
        {
            HttpSession session = request.getSession();
            initSessionContext(session);
            
 
initApplicationContext(request.getSession().getServletContext());
        }
    }

Best regards
Mike Wilson


RE: session creation

Posted by Mike Wilson <mi...@hotmail.com>.
Hm, looking again I realize I may have misunderstood some phrases in the
spec. In section 8.5.4 "Conversation context lifecycle" there is mention of
behaviour for "non-faces requests" in several places, which I interpreted as
non-JSF, but looking again it is probably a subgroup of JSF requests. So you
could be right that conversations are tied to JSF in the current spec, I'm
not sure. 
 
Either way, I think an implementation could still make a lot of the
conversation support web framework-agnostic, so it could still be an
interesting thought for any refactoring activities.
 
(I'm reading what I found to be the latest spec; Public Review rev2 -
"Updated Public Review draft" - btw.)
 
Best regards
Mike


  _____  

From: Gurkan Erdogdu [mailto:gurkanerdogdu@yahoo.com] 
Sent: den 21 februari 2009 17:36
To: openwebbeans-user@incubator.apache.org
Subject: Re: session creation


Great Mike! 

I will also look into the ConversationScope section in detailed, because I
wrote that part a long ago. But I remember that I did use JSF
PhaseListeners to manage conversation contexts.

Thanks;

/Gurkan



  _____  

From: Mike Wilson <mi...@hotmail.com>
To: openwebbeans-user@incubator.apache.org
Sent: Saturday, February 21, 2009 6:03:07 PM
Subject: RE: session creation


Hi Gurkan,
 
Thanks for quick and helpful responses. It sounds great that you will look
into not forcing sessions - thanks! Hopefully it will not become too
complicated to set up the session context on demand once it is needed. I
pinged the JSR Expert Group about this as well, and it will be interesting
to see what/if they respond.
 
Regarding conversation context being tied to JSF; I had a quick look at the
spec and the conversation mechanism described there doesn't seem to
hard-wire against JSF. If I understand it correctly it goes roughly like
this:

1.	

	if the current incoming request isn't specifying a conversation id,
a new temporary conversation context is created
2.	

	this temporary conversation context "dies" with the request if not
promoted to "long-running" (and thus in practive just acts like a parallel
request context)
3.	

	if Conversation.begin() is called the conversation is promoted to
long-running, and it is registered with an id on the session (this would
also be a place to forcibly create the session)
4.	

	the conversation id is transferred to the browser by f ex
redirecting to a url that contains it as a parameter so the browser will ask
for the same conversation on subsequent requests

Points (2) and (3) have no dependency to any specific web framework, and
point (1) and (4) has specification text that says they will be taken care
of automatically if using JSF, but should be possible to handle
programatically if using another web framework.


Ideally, this would mean that all bundled contexts could actually live in
"openwebbeans-core" (talking in modularization terms again) and only the
automagic stuff in point (1) and (4) would be implemented in
"openwebbeans-jsf" (and the same goes for other web framework-specific
modules). 
 
Best regards
Mike

  _____  

From: Gurkan Erdogdu [mailto:gurkanerdogdu@yahoo.com] 
Sent: den 21 februari 2009 16:15
To: openwebbeans-user@incubator.apache.org
Subject: Re: session creation


Hi Mike,

Thanks for commenting. In the specification there are some parts that are
hardly depend on the other specification, for example : Conversation Scope
--> JSF, EntityManagers --> JPA, Session Beans --> EJB. As Mark stated, we
have been thinking and  working on the code base to divide it into the
multi-modular structure, but  it takes time.

As coming to session question, actually I use the *initSessionContext*
method in *initRequestContext* method to reconstruct the thread local ve
session scope and application scope. I am going to refactor this not to use
request.getSession(), instead use request.getSession(false);

And we are always looking for the contributions :)

Thanks again;

/Gurkan



  _____  

From: Mike Wilson <mi...@hotmail.com>
To: openwebbeans-user@incubator.apache.org
Sent: Saturday, February 21, 2009 11:49:26 AM
Subject: RE: session creation


Hi Gurkan,
 
If I understand it correctly, WebBeans is supposed to be useful for other
web frameworks than JSF. Or are you saying that the default WB context
support is hard-wired to JSF, and other web frameworks should implement
their own support for this through lower-level APIs in WB?
It would certainly be useful if the ready-made contexts were built to allow
for as much reuse as possible. Always forcing session creation makes it
harder to reuse this code for stateless scenarios.
 
Just discussing hypothetically; is there anything in the WB model that
actually requires this "early" session creation, or could it in theory be
deferred to when a request is referring to a bean on session or conversation
scope?
 
Best regards
Mike


  _____  

From: Gurkan Erdogdu [mailto:gurkanerdogdu@yahoo.com] 
Sent: den 20 februari 2009 16:03
To: openwebbeans-user@incubator.apache.org
Subject: Re: session creation


Hi;

Actually this may not be a problem. Indeed, contexts is related with JSF
semantics and session is created everytime in JSF.


Thanks;

/Gurkan



  _____  

From: Mike Wilson <mi...@hotmail.com>
To: openwebbeans-user@incubator.apache.org
Sent: Thursday, February 19, 2009 7:21:56 PM
Subject: session creation

I got things running with Jetty 6.1.15rc4 and now I have a question
about session creation:

Will OpenWebBeans always force a session to be created? In the 
current codebase (see below) this seems to be the case. If 
possible, it would be nice if sessions only were created on-demand
when a component needs session (or conversation) storage.
Doing it this way would make it possible to have stateless requests
that avoid the overhead of session creation when possible.

ContextFactory.java:

    public static void initRequestContext(HttpServletRequest request)
    {
        requestContext.set(new RequestContext());// set thread local
        requestContext.get().setActive(true);

        if (request != null)
        {
            HttpSession session = request.getSession();
            initSessionContext(session);
            

initApplicationContext(request.getSession().getServletContext());
        }
    }

Best regards
Mike Wilson







Re: session creation

Posted by Gurkan Erdogdu <gu...@yahoo.com>.
Great Mike! 

I will also look into the ConversationScope section in detailed, because I wrote that part a long ago. But I remember that I did use JSF  PhaseListeners to manage conversation contexts.

Thanks;

/Gurkan




________________________________
From: Mike Wilson <mi...@hotmail.com>
To: openwebbeans-user@incubator.apache.org
Sent: Saturday, February 21, 2009 6:03:07 PM
Subject: RE: session creation

 
Hi Gurkan,
 
Thanks for quick and helpful responses. It sounds great 
that you will look into not forcing sessions - thanks! Hopefully it will 
not become too complicated to set up the session context on demand once it is 
needed. I pinged the JSR Expert Group about this as well, and it will be 
interesting to see what/if they respond.
 
Regarding conversation context being tied to JSF; I had a 
quick look at the spec and the conversation mechanism described there doesn't 
seem to hard-wire against JSF. If I understand it correctly it goes roughly like 
this:
	1. if the current incoming request isn't specifying a  conversation id, a new temporary conversation context is created
	2. this temporary conversation context "dies" with the  request if not promoted to "long-running" (and thus in practive just acts  like a parallel request context)
	3. if Conversation.begin() is called the conversation is  promoted to long-running, and it is registered with an id on the session (this  would also be a place to forcibly create the session)
	4. the conversation id is transferred to the browser by f ex  redirecting to a url that contains it as a parameter so the browser will ask  for the same conversation on subsequent requests
Points (2) and (3) have no dependency to any specific 
web framework, and point (1) and (4) has specification text that 
says theywill be taken care of automatically if using JSF, 
but should be possible to handle programatically if using another web 
framework. 

Ideally, this would mean that all bundled contexts could actually live in 
"openwebbeans-core" (talking in modularization terms again) and only the 
automagic stuff in point (1) and (4) would be implemented in "openwebbeans-jsf" 
(and the same goes for other web framework-specific modules). 
 
Best 
regards
Mike

________________________________
 From: Gurkan Erdogdu  [mailto:gurkanerdogdu@yahoo.com] 
Sent: den 21 februari 2009  16:15
To: openwebbeans-user@incubator.apache.org
Subject: Re: session creation


Hi Mike,

Thanks for commenting. In the specification there are  some parts that are hardly depend on the other specification, for example :  Conversation Scope --> JSF, EntityManagers --> JPA, Session Beans -->  EJB. As Mark stated, we have been thinking and  working on the code base  to divide it into the multi-modular structure, but  it takes  time.

As coming to session question, actually I use the  *initSessionContext* method in *initRequestContext* method to reconstruct the  thread local ve session scope and application scope. I am going to refactor  this not to use request.getSession(), instead use  request.getSession(false);

And we are always looking for the  contributions :)

Thanks again;

/Gurkan




________________________________
 From: Mike Wilson  <mi...@hotmail.com>
To: openwebbeans-user@incubator.apache.org
Sent: Saturday, February 21, 2009  11:49:26 AM
Subject: RE:  session creation

 
Hi Gurkan,
 
If I understand it correctly, WebBeans is supposed to be  useful for other web frameworks than JSF. Or are you saying that the default  WB context support is hard-wired to JSF, and other web frameworks should  implement their own support for this through lower-level APIs in  WB?
It would certainly be useful if the ready-made contexts  were built to allow for as much reuse as possible. Always forcing session  creation makes it harder to reuse this code for stateless  scenarios.
 
Just discussing hypothetically; is there anything in the  WB model that actually requires this "early" session creation, or could it in  theory be deferred to when a request is referring to a bean on session or  conversation scope?
 
Best  regards
Mike


________________________________
 From: Gurkan Erdogdu  [mailto:gurkanerdogdu@yahoo.com] 
Sent: den 20 februari 2009  16:03
To: openwebbeans-user@incubator.apache.org
Subject: Re: session  creation


Hi;

Actually this may not be a problem. Indeed, contexts is  related with JSF semantics and session is created everytime in 
JSF.


Thanks;

/Gurkan



________________________________
 From: Mike Wilson  <mi...@hotmail.com>
To: openwebbeans-user@incubator.apache.org
Sent: Thursday, February 19, 2009  7:21:56 PM
Subject: session  creation

I got things running with Jetty 6.1.15rc4 and now I  have a question
about session creation:

Will OpenWebBeans always  force a session to be created? In the 
current codebase (see below) this  seems to be the case. If 
possible, it would be nice if sessions only  were created on-demand
when a component needs session (or conversation)  storage.
Doing it this way would make it possible to have stateless  requests
that avoid the overhead of session creation when  possible.

ContextFactory.java:

    public static  void initRequestContext(HttpServletRequest request)
     {
        requestContext.set(new RequestContext());//  set thread local
         requestContext.get().setActive(true);

        if  (request != null)
        {
             HttpSession session = request.getSession();
             initSessionContext(session);
             

initApplicationContext(request.getSession().getServletContext());
         }
    }

Best regards
Mike  Wilson


      

RE: session creation

Posted by Mike Wilson <mi...@hotmail.com>.
Hi Gurkan,
 
Thanks for quick and helpful responses. It sounds great that you will look
into not forcing sessions - thanks! Hopefully it will not become too
complicated to set up the session context on demand once it is needed. I
pinged the JSR Expert Group about this as well, and it will be interesting
to see what/if they respond.
 
Regarding conversation context being tied to JSF; I had a quick look at the
spec and the conversation mechanism described there doesn't seem to
hard-wire against JSF. If I understand it correctly it goes roughly like
this:

1.	

	if the current incoming request isn't specifying a conversation id,
a new temporary conversation context is created
2.	

	this temporary conversation context "dies" with the request if not
promoted to "long-running" (and thus in practive just acts like a parallel
request context)
3.	

	if Conversation.begin() is called the conversation is promoted to
long-running, and it is registered with an id on the session (this would
also be a place to forcibly create the session)
4.	

	the conversation id is transferred to the browser by f ex
redirecting to a url that contains it as a parameter so the browser will ask
for the same conversation on subsequent requests

Points (2) and (3) have no dependency to any specific web framework, and
point (1) and (4) has specification text that says they will be taken care
of automatically if using JSF, but should be possible to handle
programatically if using another web framework.

Ideally, this would mean that all bundled contexts could actually live in
"openwebbeans-core" (talking in modularization terms again) and only the
automagic stuff in point (1) and (4) would be implemented in
"openwebbeans-jsf" (and the same goes for other web framework-specific
modules). 
 
Best regards
Mike

  _____  

From: Gurkan Erdogdu [mailto:gurkanerdogdu@yahoo.com] 
Sent: den 21 februari 2009 16:15
To: openwebbeans-user@incubator.apache.org
Subject: Re: session creation


Hi Mike,

Thanks for commenting. In the specification there are some parts that are
hardly depend on the other specification, for example : Conversation Scope
--> JSF, EntityManagers --> JPA, Session Beans --> EJB. As Mark stated, we
have been thinking and  working on the code base to divide it into the
multi-modular structure, but  it takes time.

As coming to session question, actually I use the *initSessionContext*
method in *initRequestContext* method to reconstruct the thread local ve
session scope and application scope. I am going to refactor this not to use
request.getSession(), instead use request.getSession(false);

And we are always looking for the contributions :)

Thanks again;

/Gurkan



  _____  

From: Mike Wilson <mi...@hotmail.com>
To: openwebbeans-user@incubator.apache.org
Sent: Saturday, February 21, 2009 11:49:26 AM
Subject: RE: session creation


Hi Gurkan,
 
If I understand it correctly, WebBeans is supposed to be useful for other
web frameworks than JSF. Or are you saying that the default WB context
support is hard-wired to JSF, and other web frameworks should implement
their own support for this through lower-level APIs in WB?
It would certainly be useful if the ready-made contexts were built to allow
for as much reuse as possible. Always forcing session creation makes it
harder to reuse this code for stateless scenarios.
 
Just discussing hypothetically; is there anything in the WB model that
actually requires this "early" session creation, or could it in theory be
deferred to when a request is referring to a bean on session or conversation
scope?
 
Best regards
Mike


  _____  

From: Gurkan Erdogdu [mailto:gurkanerdogdu@yahoo.com] 
Sent: den 20 februari 2009 16:03
To: openwebbeans-user@incubator.apache.org
Subject: Re: session creation


Hi;

Actually this may not be a problem. Indeed, contexts is related with JSF
semantics and session is created everytime in JSF.


Thanks;

/Gurkan



  _____  

From: Mike Wilson <mi...@hotmail.com>
To: openwebbeans-user@incubator.apache.org
Sent: Thursday, February 19, 2009 7:21:56 PM
Subject: session creation

I got things running with Jetty 6.1.15rc4 and now I have a question
about session creation:

Will OpenWebBeans always force a session to be created? In the 
current codebase (see below) this seems to be the case. If 
possible, it would be nice if sessions only were created on-demand
when a component needs session (or conversation) storage.
Doing it this way would make it possible to have stateless requests
that avoid the overhead of session creation when possible.

ContextFactory.java:

    public static void initRequestContext(HttpServletRequest request)
    {
        requestContext.set(new RequestContext());// set thread local
        requestContext.get().setActive(true);

        if (request != null)
        {
            HttpSession session = request.getSession();
            initSessionContext(session);
            

initApplicationContext(request.getSession().getServletContext());
        }
    }

Best regards
Mike Wilson






Re: session creation

Posted by Gurkan Erdogdu <gu...@yahoo.com>.
Hi Mike,

Thanks for commenting. In the specification there are some parts that are hardly depend on the other specification, for example : Conversation Scope --> JSF, EntityManagers --> JPA, Session Beans --> EJB. As Mark stated, we have been thinking and  working on the code base to divide it into the multi-modular structure, but  it takes time.

As coming to session question, actually I use the *initSessionContext* method in *initRequestContext* method to reconstruct the thread local ve session scope and application scope. I am going to refactor this not to use request.getSession(), instead use request.getSession(false);

And we are always looking for the contributions :)

Thanks again;

/Gurkan




________________________________
From: Mike Wilson <mi...@hotmail.com>
To: openwebbeans-user@incubator.apache.org
Sent: Saturday, February 21, 2009 11:49:26 AM
Subject: RE: session creation

 
Hi Gurkan,
 
If I understand it correctly, WebBeans is supposed to be 
useful for other web frameworks than JSF. Or are you saying that the default WB 
context support is hard-wired to JSF, and other web frameworks should implement 
their own support for this through lower-level APIs in WB?
It would certainly be useful if the ready-made contexts 
were built to allow for as much reuse as possible. Always forcing session 
creation makes it harder to reuse this code for stateless 
scenarios.
 
Just discussing hypothetically; is there anything in the WB 
model that actually requires this "early" session creation, or could it in 
theory be deferred to when a request is referring to a bean on session or 
conversation scope?
 
Best 
regards
Mike


________________________________
 From: Gurkan Erdogdu  [mailto:gurkanerdogdu@yahoo.com] 
Sent: den 20 februari 2009  16:03
To: openwebbeans-user@incubator.apache.org
Subject: Re: session creation


Hi;

Actually this may not be a problem. Indeed, contexts is  related with JSF semantics and session is created everytime in JSF.


Thanks;

/Gurkan



________________________________
 From: Mike Wilson  <mi...@hotmail.com>
To: openwebbeans-user@incubator.apache.org
Sent: Thursday, February 19, 2009 7:21:56  PM
Subject: session  creation

I got things running with Jetty 6.1.15rc4 and now I  have a question
about session creation:

Will OpenWebBeans always  force a session to be created? In the 
current codebase (see below) this  seems to be the case. If 
possible, it would be nice if sessions only were  created on-demand
when a component needs session (or conversation)  storage.
Doing it this way would make it possible to have stateless  requests
that avoid the overhead of session creation when  possible.

ContextFactory.java:

    public static void  initRequestContext(HttpServletRequest request)
    {
         requestContext.set(new RequestContext());// set thread  local
         requestContext.get().setActive(true);

        if  (request != null)
        {
             HttpSession session = request.getSession();
             initSessionContext(session);
             

initApplicationContext(request.getSession().getServletContext());
         }
    }

Best regards
Mike  Wilson


      

Re: session creation

Posted by Matthias Wessendorf <ma...@apache.org>.
also,
they (resin) have some pages/wikis/blogs ...

-M

On Thu, Feb 26, 2009 at 11:00 AM, Matthias Wessendorf <ma...@apache.org> wrote:
> Hey Mike,
>
> not sure what you exactly mean.
> Perhaps we can get the Wicket folks itself to jump in here.
> I'd not mind to see a similar support for APACHE wicket
> included into Apache OpenWebBeans ;-)
>
> -M
>
> On Mon, Feb 23, 2009 at 1:29 PM, Mike Wilson <mi...@hotmail.com> wrote:
>> Thanks Matthias,
>> That's interesting! Do you have any pointers to discussions on
>> these matters, or is checking out the source code the way to
>> get enlighted? ;-)
>> Best regards
>> Mike
>>
>>> -----Original Message-----
>>> From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On
>>> Behalf Of Matthias Wessendorf
>>> Sent: den 23 februari 2009 12:27
>>> To: openwebbeans-user@incubator.apache.org
>>> Subject: Re: session creation
>>>
>>> On Sat, Feb 21, 2009 at 11:54 AM, Mark Struberg
>>> <st...@yahoo.de> wrote:
>>> > Hi Mike!
>>> >
>>> > Yes, the Spec is really heavily tied to the 'core J2EE'
>>> techniques JPA and JSF.
>>>
>>> the resin folks have some guidance on their webbeans impl and
>>> the combination
>>> with wicket.
>>>
>>> -M
>>>
>>> >
>>> > But we already discussed ways to make OWB more 'pluggable'
>>> by spliting it into
>>> >
>>> > .) webbeans-core
>>> > .) webbeans-jsf
>>> > .) webbeans-jpa
>>> > .) webbeans-ejb
>>> >
>>> > So one doesn't need to have JSF or JPA dependencies anymore
>>> if he doesn't need it, and on the other hand we may also add
>>> native support e.g. for wicket, iBatis etc.
>>> >
>>> > LieGrue,
>>> > strub
>>> >
>>> >
>>> > --- Mike Wilson <mi...@hotmail.com> schrieb am Sa, 21.2.2009:
>>> >
>>> >> Von: Mike Wilson <mi...@hotmail.com>
>>> >> Betreff: RE: session creation
>>> >> An: openwebbeans-user@incubator.apache.org
>>> >> Datum: Samstag, 21. Februar 2009, 10:49
>>> >> Hi Gurkan,
>>> >>
>>> >> If I understand it correctly, WebBeans is supposed to be
>>> >> useful for other
>>> >> web frameworks than JSF. Or are you saying that the default
>>> >> WB context
>>> >> support is hard-wired to JSF, and other web frameworks
>>> >> should implement
>>> >> their own support for this through lower-level APIs in WB?
>>> >> It would certainly be useful if the ready-made contexts
>>> >> were built to allow
>>> >> for as much reuse as possible. Always forcing session
>>> >> creation makes it
>>> >> harder to reuse this code for stateless scenarios.
>>> >>
>>> >> Just discussing hypothetically; is there anything in the WB
>>> >> model that
>>> >> actually requires this "early" session creation,
>>> >> or could it in theory be
>>> >> deferred to when a request is referring to a bean on
>>> >> session or conversation
>>> >> scope?
>>> >>
>>> >> Best regards
>>> >> Mike
>>> >>
>>> >>
>>> >>   _____
>>> >>
>>> >> From: Gurkan Erdogdu [mailto:gurkanerdogdu@yahoo.com]
>>> >> Sent: den 20 februari 2009 16:03
>>> >> To: openwebbeans-user@incubator.apache.org
>>> >> Subject: Re: session creation
>>> >>
>>> >>
>>> >> Hi;
>>> >>
>>> >> Actually this may not be a problem. Indeed, contexts is
>>> >> related with JSF
>>> >> semantics and session is created everytime in JSF.
>>> >>
>>> >>
>>> >> Thanks;
>>> >>
>>> >> /Gurkan
>>> >>
>>> >>
>>> >>
>>> >>   _____
>>> >>
>>> >> From: Mike Wilson <mi...@hotmail.com>
>>> >> To: openwebbeans-user@incubator.apache.org
>>> >> Sent: Thursday, February 19, 2009 7:21:56 PM
>>> >> Subject: session creation
>>> >>
>>> >> I got things running with Jetty 6.1.15rc4 and now I have a
>>> >> question
>>> >> about session creation:
>>> >>
>>> >> Will OpenWebBeans always force a session to be created? In
>>> >> the
>>> >> current codebase (see below) this seems to be the case. If
>>> >> possible, it would be nice if sessions only were created
>>> >> on-demand
>>> >> when a component needs session (or conversation) storage.
>>> >> Doing it this way would make it possible to have stateless
>>> >> requests
>>> >> that avoid the overhead of session creation when possible.
>>> >>
>>> >> ContextFactory.java:
>>> >>
>>> >>     public static void
>>> >> initRequestContext(HttpServletRequest request)
>>> >>     {
>>> >>         requestContext.set(new RequestContext());// set
>>> >> thread local
>>> >>         requestContext.get().setActive(true);
>>> >>
>>> >>         if (request != null)
>>> >>         {
>>> >>             HttpSession session = request.getSession();
>>> >>             initSessionContext(session);
>>> >>
>>> >>
>>> >> initApplicationContext(request.getSession().getServletContext());
>>> >>         }
>>> >>     }
>>> >>
>>> >> Best regards
>>> >> Mike Wilson
>>> >
>>> >
>>> >
>>> >
>>>
>>>
>>>
>>> --
>>> Matthias Wessendorf
>>>
>>> blog: http://matthiaswessendorf.wordpress.com/
>>> sessions: http://www.slideshare.net/mwessendorf
>>> twitter: http://twitter.com/mwessendorf
>>>
>>
>>
>
>
>
> --
> Matthias Wessendorf
>
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> twitter: http://twitter.com/mwessendorf
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf

Re: session creation

Posted by Matthias Wessendorf <ma...@apache.org>.
Hey Mike,

not sure what you exactly mean.
Perhaps we can get the Wicket folks itself to jump in here.
I'd not mind to see a similar support for APACHE wicket
included into Apache OpenWebBeans ;-)

-M

On Mon, Feb 23, 2009 at 1:29 PM, Mike Wilson <mi...@hotmail.com> wrote:
> Thanks Matthias,
> That's interesting! Do you have any pointers to discussions on
> these matters, or is checking out the source code the way to
> get enlighted? ;-)
> Best regards
> Mike
>
>> -----Original Message-----
>> From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On
>> Behalf Of Matthias Wessendorf
>> Sent: den 23 februari 2009 12:27
>> To: openwebbeans-user@incubator.apache.org
>> Subject: Re: session creation
>>
>> On Sat, Feb 21, 2009 at 11:54 AM, Mark Struberg
>> <st...@yahoo.de> wrote:
>> > Hi Mike!
>> >
>> > Yes, the Spec is really heavily tied to the 'core J2EE'
>> techniques JPA and JSF.
>>
>> the resin folks have some guidance on their webbeans impl and
>> the combination
>> with wicket.
>>
>> -M
>>
>> >
>> > But we already discussed ways to make OWB more 'pluggable'
>> by spliting it into
>> >
>> > .) webbeans-core
>> > .) webbeans-jsf
>> > .) webbeans-jpa
>> > .) webbeans-ejb
>> >
>> > So one doesn't need to have JSF or JPA dependencies anymore
>> if he doesn't need it, and on the other hand we may also add
>> native support e.g. for wicket, iBatis etc.
>> >
>> > LieGrue,
>> > strub
>> >
>> >
>> > --- Mike Wilson <mi...@hotmail.com> schrieb am Sa, 21.2.2009:
>> >
>> >> Von: Mike Wilson <mi...@hotmail.com>
>> >> Betreff: RE: session creation
>> >> An: openwebbeans-user@incubator.apache.org
>> >> Datum: Samstag, 21. Februar 2009, 10:49
>> >> Hi Gurkan,
>> >>
>> >> If I understand it correctly, WebBeans is supposed to be
>> >> useful for other
>> >> web frameworks than JSF. Or are you saying that the default
>> >> WB context
>> >> support is hard-wired to JSF, and other web frameworks
>> >> should implement
>> >> their own support for this through lower-level APIs in WB?
>> >> It would certainly be useful if the ready-made contexts
>> >> were built to allow
>> >> for as much reuse as possible. Always forcing session
>> >> creation makes it
>> >> harder to reuse this code for stateless scenarios.
>> >>
>> >> Just discussing hypothetically; is there anything in the WB
>> >> model that
>> >> actually requires this "early" session creation,
>> >> or could it in theory be
>> >> deferred to when a request is referring to a bean on
>> >> session or conversation
>> >> scope?
>> >>
>> >> Best regards
>> >> Mike
>> >>
>> >>
>> >>   _____
>> >>
>> >> From: Gurkan Erdogdu [mailto:gurkanerdogdu@yahoo.com]
>> >> Sent: den 20 februari 2009 16:03
>> >> To: openwebbeans-user@incubator.apache.org
>> >> Subject: Re: session creation
>> >>
>> >>
>> >> Hi;
>> >>
>> >> Actually this may not be a problem. Indeed, contexts is
>> >> related with JSF
>> >> semantics and session is created everytime in JSF.
>> >>
>> >>
>> >> Thanks;
>> >>
>> >> /Gurkan
>> >>
>> >>
>> >>
>> >>   _____
>> >>
>> >> From: Mike Wilson <mi...@hotmail.com>
>> >> To: openwebbeans-user@incubator.apache.org
>> >> Sent: Thursday, February 19, 2009 7:21:56 PM
>> >> Subject: session creation
>> >>
>> >> I got things running with Jetty 6.1.15rc4 and now I have a
>> >> question
>> >> about session creation:
>> >>
>> >> Will OpenWebBeans always force a session to be created? In
>> >> the
>> >> current codebase (see below) this seems to be the case. If
>> >> possible, it would be nice if sessions only were created
>> >> on-demand
>> >> when a component needs session (or conversation) storage.
>> >> Doing it this way would make it possible to have stateless
>> >> requests
>> >> that avoid the overhead of session creation when possible.
>> >>
>> >> ContextFactory.java:
>> >>
>> >>     public static void
>> >> initRequestContext(HttpServletRequest request)
>> >>     {
>> >>         requestContext.set(new RequestContext());// set
>> >> thread local
>> >>         requestContext.get().setActive(true);
>> >>
>> >>         if (request != null)
>> >>         {
>> >>             HttpSession session = request.getSession();
>> >>             initSessionContext(session);
>> >>
>> >>
>> >> initApplicationContext(request.getSession().getServletContext());
>> >>         }
>> >>     }
>> >>
>> >> Best regards
>> >> Mike Wilson
>> >
>> >
>> >
>> >
>>
>>
>>
>> --
>> Matthias Wessendorf
>>
>> blog: http://matthiaswessendorf.wordpress.com/
>> sessions: http://www.slideshare.net/mwessendorf
>> twitter: http://twitter.com/mwessendorf
>>
>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf

RE: session creation

Posted by Mike Wilson <mi...@hotmail.com>.
Thanks Matthias,
That's interesting! Do you have any pointers to discussions on
these matters, or is checking out the source code the way to
get enlighted? ;-)
Best regards
Mike 

> -----Original Message-----
> From: mwessendorf@gmail.com [mailto:mwessendorf@gmail.com] On 
> Behalf Of Matthias Wessendorf
> Sent: den 23 februari 2009 12:27
> To: openwebbeans-user@incubator.apache.org
> Subject: Re: session creation
> 
> On Sat, Feb 21, 2009 at 11:54 AM, Mark Struberg 
> <st...@yahoo.de> wrote:
> > Hi Mike!
> >
> > Yes, the Spec is really heavily tied to the 'core J2EE' 
> techniques JPA and JSF.
> 
> the resin folks have some guidance on their webbeans impl and 
> the combination
> with wicket.
> 
> -M
> 
> >
> > But we already discussed ways to make OWB more 'pluggable' 
> by spliting it into
> >
> > .) webbeans-core
> > .) webbeans-jsf
> > .) webbeans-jpa
> > .) webbeans-ejb
> >
> > So one doesn't need to have JSF or JPA dependencies anymore 
> if he doesn't need it, and on the other hand we may also add 
> native support e.g. for wicket, iBatis etc.
> >
> > LieGrue,
> > strub
> >
> >
> > --- Mike Wilson <mi...@hotmail.com> schrieb am Sa, 21.2.2009:
> >
> >> Von: Mike Wilson <mi...@hotmail.com>
> >> Betreff: RE: session creation
> >> An: openwebbeans-user@incubator.apache.org
> >> Datum: Samstag, 21. Februar 2009, 10:49
> >> Hi Gurkan,
> >>
> >> If I understand it correctly, WebBeans is supposed to be
> >> useful for other
> >> web frameworks than JSF. Or are you saying that the default
> >> WB context
> >> support is hard-wired to JSF, and other web frameworks
> >> should implement
> >> their own support for this through lower-level APIs in WB?
> >> It would certainly be useful if the ready-made contexts
> >> were built to allow
> >> for as much reuse as possible. Always forcing session
> >> creation makes it
> >> harder to reuse this code for stateless scenarios.
> >>
> >> Just discussing hypothetically; is there anything in the WB
> >> model that
> >> actually requires this "early" session creation,
> >> or could it in theory be
> >> deferred to when a request is referring to a bean on
> >> session or conversation
> >> scope?
> >>
> >> Best regards
> >> Mike
> >>
> >>
> >>   _____
> >>
> >> From: Gurkan Erdogdu [mailto:gurkanerdogdu@yahoo.com]
> >> Sent: den 20 februari 2009 16:03
> >> To: openwebbeans-user@incubator.apache.org
> >> Subject: Re: session creation
> >>
> >>
> >> Hi;
> >>
> >> Actually this may not be a problem. Indeed, contexts is
> >> related with JSF
> >> semantics and session is created everytime in JSF.
> >>
> >>
> >> Thanks;
> >>
> >> /Gurkan
> >>
> >>
> >>
> >>   _____
> >>
> >> From: Mike Wilson <mi...@hotmail.com>
> >> To: openwebbeans-user@incubator.apache.org
> >> Sent: Thursday, February 19, 2009 7:21:56 PM
> >> Subject: session creation
> >>
> >> I got things running with Jetty 6.1.15rc4 and now I have a
> >> question
> >> about session creation:
> >>
> >> Will OpenWebBeans always force a session to be created? In
> >> the
> >> current codebase (see below) this seems to be the case. If
> >> possible, it would be nice if sessions only were created
> >> on-demand
> >> when a component needs session (or conversation) storage.
> >> Doing it this way would make it possible to have stateless
> >> requests
> >> that avoid the overhead of session creation when possible.
> >>
> >> ContextFactory.java:
> >>
> >>     public static void
> >> initRequestContext(HttpServletRequest request)
> >>     {
> >>         requestContext.set(new RequestContext());// set
> >> thread local
> >>         requestContext.get().setActive(true);
> >>
> >>         if (request != null)
> >>         {
> >>             HttpSession session = request.getSession();
> >>             initSessionContext(session);
> >>
> >>
> >> initApplicationContext(request.getSession().getServletContext());
> >>         }
> >>     }
> >>
> >> Best regards
> >> Mike Wilson
> >
> >
> >
> >
> 
> 
> 
> -- 
> Matthias Wessendorf
> 
> blog: http://matthiaswessendorf.wordpress.com/
> sessions: http://www.slideshare.net/mwessendorf
> twitter: http://twitter.com/mwessendorf
> 


Re: session creation

Posted by Matthias Wessendorf <ma...@apache.org>.
On Sat, Feb 21, 2009 at 11:54 AM, Mark Struberg <st...@yahoo.de> wrote:
> Hi Mike!
>
> Yes, the Spec is really heavily tied to the 'core J2EE' techniques JPA and JSF.

the resin folks have some guidance on their webbeans impl and the combination
with wicket.

-M

>
> But we already discussed ways to make OWB more 'pluggable' by spliting it into
>
> .) webbeans-core
> .) webbeans-jsf
> .) webbeans-jpa
> .) webbeans-ejb
>
> So one doesn't need to have JSF or JPA dependencies anymore if he doesn't need it, and on the other hand we may also add native support e.g. for wicket, iBatis etc.
>
> LieGrue,
> strub
>
>
> --- Mike Wilson <mi...@hotmail.com> schrieb am Sa, 21.2.2009:
>
>> Von: Mike Wilson <mi...@hotmail.com>
>> Betreff: RE: session creation
>> An: openwebbeans-user@incubator.apache.org
>> Datum: Samstag, 21. Februar 2009, 10:49
>> Hi Gurkan,
>>
>> If I understand it correctly, WebBeans is supposed to be
>> useful for other
>> web frameworks than JSF. Or are you saying that the default
>> WB context
>> support is hard-wired to JSF, and other web frameworks
>> should implement
>> their own support for this through lower-level APIs in WB?
>> It would certainly be useful if the ready-made contexts
>> were built to allow
>> for as much reuse as possible. Always forcing session
>> creation makes it
>> harder to reuse this code for stateless scenarios.
>>
>> Just discussing hypothetically; is there anything in the WB
>> model that
>> actually requires this "early" session creation,
>> or could it in theory be
>> deferred to when a request is referring to a bean on
>> session or conversation
>> scope?
>>
>> Best regards
>> Mike
>>
>>
>>   _____
>>
>> From: Gurkan Erdogdu [mailto:gurkanerdogdu@yahoo.com]
>> Sent: den 20 februari 2009 16:03
>> To: openwebbeans-user@incubator.apache.org
>> Subject: Re: session creation
>>
>>
>> Hi;
>>
>> Actually this may not be a problem. Indeed, contexts is
>> related with JSF
>> semantics and session is created everytime in JSF.
>>
>>
>> Thanks;
>>
>> /Gurkan
>>
>>
>>
>>   _____
>>
>> From: Mike Wilson <mi...@hotmail.com>
>> To: openwebbeans-user@incubator.apache.org
>> Sent: Thursday, February 19, 2009 7:21:56 PM
>> Subject: session creation
>>
>> I got things running with Jetty 6.1.15rc4 and now I have a
>> question
>> about session creation:
>>
>> Will OpenWebBeans always force a session to be created? In
>> the
>> current codebase (see below) this seems to be the case. If
>> possible, it would be nice if sessions only were created
>> on-demand
>> when a component needs session (or conversation) storage.
>> Doing it this way would make it possible to have stateless
>> requests
>> that avoid the overhead of session creation when possible.
>>
>> ContextFactory.java:
>>
>>     public static void
>> initRequestContext(HttpServletRequest request)
>>     {
>>         requestContext.set(new RequestContext());// set
>> thread local
>>         requestContext.get().setActive(true);
>>
>>         if (request != null)
>>         {
>>             HttpSession session = request.getSession();
>>             initSessionContext(session);
>>
>>
>> initApplicationContext(request.getSession().getServletContext());
>>         }
>>     }
>>
>> Best regards
>> Mike Wilson
>
>
>
>



-- 
Matthias Wessendorf

blog: http://matthiaswessendorf.wordpress.com/
sessions: http://www.slideshare.net/mwessendorf
twitter: http://twitter.com/mwessendorf

RE: session creation

Posted by Mark Struberg <st...@yahoo.de>.
First we have to find all 'extension-points'. 

I'll try to do this for JPA things first. If this works out, we'll look at other parts.

So I think we cannot say what will be part of 'core' at the moment. There are many things which have to be considered. E.g. a 'plugable' architecture may turn out to have performance deficits.


LieGrue,
strub


--- Mike Wilson <mi...@hotmail.com> schrieb am Sa, 21.2.2009:

> Von: Mike Wilson <mi...@hotmail.com>
> Betreff: RE: session creation
> An: openwebbeans-user@incubator.apache.org
> Datum: Samstag, 21. Februar 2009, 14:57
> Certainly, I understand that the modularization is just a
> potential future activity.
> Still, what is your picture of on how much of your codebase
> would go into "core" and "jsf",
> respectively, if doing this
> activity?
> 
> Best regards
> Mike 
> 
> > -----Original Message-----
> > From: Mark Struberg [mailto:struberg@yahoo.de] 
> > Sent: den 21 februari 2009 13:16
> > To: openwebbeans-user@incubator.apache.org
> > Subject: RE: session creation
> > 
> > Mike, all this is currently only in an evaluation
> phase. 
> > We had the idea, and now let's see how we can
> implement it.
> > Based on this knowledge, we will decide if and how we
> will do it.
> > But don't expect this to be available before M3 ;)
> > 
> > I will think about the session creation too, but
> I'm not an 
> > expert in this area.
> > 
> > LieGrue,
> > strub
> > 
> > --- Mike Wilson <mi...@hotmail.com> schrieb am
> Sa, 21.2.2009:
> > 
> > > Von: Mike Wilson <mi...@hotmail.com>
> > > Betreff: RE: session creation
> > > An: openwebbeans-user@incubator.apache.org
> > > Datum: Samstag, 21. Februar 2009, 12:24
> > > Thanks Mark, 
> > > 
> > > > Yes, the Spec is really heavily tied to the
> 'core
> > > J2EE' 
> > > > techniques JPA and JSF.
> > > > 
> > > > But we already discussed ways to make OWB
> more
> > > 'pluggable' by 
> > > > spliting it into
> > > > 
> > > > .) webbeans-core
> > > > .) webbeans-jsf
> > > > .) webbeans-jpa
> > > > .) webbeans-ejb
> > > 
> > > Ok, that's interesting. I take it that
> > > request/session/conversation
> > > contexts would be implemented in jsf and not core
> then?
> > > With your knowledge about the current codebase,
> how much
> > > code would
> > > you reckon be needed to create a "custom
> module"
> > > with support for
> > > these contexts in a non-JSF web framework? (and
> also
> > > solving the
> > > "don't force session" problem etc)
> > > I guess another way to ask the question is to ask
> how much
> > > of the
> > > current codebase would end up in webbeans-core
> and
> > > webbeans-jsf
> > > respectively, when splitting the codebase. A new
> web
> > > framework
> > > integration would probably be analogous in size
> to the jsf
> > > module.
> > > 
> > > Best regards
> > > Mike
> > > 
> > > > --- Mike Wilson <mi...@hotmail.com>
> schrieb am
> > > Sa, 21.2.2009:
> > > > 
> > > > > Von: Mike Wilson
> <mi...@hotmail.com>
> > > > > Betreff: RE: session creation
> > > > > An:
> openwebbeans-user@incubator.apache.org
> > > > > Datum: Samstag, 21. Februar 2009, 10:49
> > > > > Hi Gurkan,
> > > > >  
> > > > > If I understand it correctly, WebBeans
> is
> > > supposed to be
> > > > > useful for other
> > > > > web frameworks than JSF. Or are you
> saying that
> > > the default
> > > > > WB context
> > > > > support is hard-wired to JSF, and other
> web
> > > frameworks
> > > > > should implement
> > > > > their own support for this through
> lower-level
> > > APIs in WB?
> > > > > It would certainly be useful if the
> ready-made
> > > contexts
> > > > > were built to allow
> > > > > for as much reuse as possible. Always
> forcing
> > > session
> > > > > creation makes it
> > > > > harder to reuse this code for stateless
> > > scenarios.
> > > > >  
> > > > > Just discussing hypothetically; is
> there anything
> > > in the WB
> > > > > model that
> > > > > actually requires this
> "early" session
> > > creation,
> > > > > or could it in theory be
> > > > > deferred to when a request is referring
> to a bean
> > > on
> > > > > session or conversation
> > > > > scope?
> > > > >  
> > > > > Best regards
> > > > > Mike
> > > > > 
> > > > > 
> > > > >   _____  
> > > > > 
> > > > > From: Gurkan Erdogdu
> > > [mailto:gurkanerdogdu@yahoo.com] 
> > > > > Sent: den 20 februari 2009 16:03
> > > > > To:
> openwebbeans-user@incubator.apache.org
> > > > > Subject: Re: session creation
> > > > > 
> > > > > 
> > > > > Hi;
> > > > > 
> > > > > Actually this may not be a problem.
> Indeed,
> > > contexts is
> > > > > related with JSF
> > > > > semantics and session is created
> everytime in
> > > JSF.
> > > > > 
> > > > > 
> > > > > Thanks;
> > > > > 
> > > > > /Gurkan
> > > > > 
> > > > > 
> > > > > 
> > > > >   _____  
> > > > > 
> > > > > From: Mike Wilson
> <mi...@hotmail.com>
> > > > > To:
> openwebbeans-user@incubator.apache.org
> > > > > Sent: Thursday, February 19, 2009
> 7:21:56 PM
> > > > > Subject: session creation
> > > > > 
> > > > > I got things running with Jetty
> 6.1.15rc4 and now
> > > I have a
> > > > > question
> > > > > about session creation:
> > > > > 
> > > > > Will OpenWebBeans always force a
> session to be
> > > created? In
> > > > > the 
> > > > > current codebase (see below) this seems
> to be the
> > > case. If 
> > > > > possible, it would be nice if sessions
> only were
> > > created
> > > > > on-demand
> > > > > when a component needs session (or
> conversation)
> > > storage.
> > > > > Doing it this way would make it
> possible to have
> > > stateless
> > > > > requests
> > > > > that avoid the overhead of session
> creation when
> > > possible.
> > > > > 
> > > > > ContextFactory.java:
> > > > > 
> > > > >     public static void
> > > > > initRequestContext(HttpServletRequest
> request)
> > > > >     {
> > > > >         requestContext.set(new
> > > RequestContext());// set
> > > > > thread local
> > > > >        
> requestContext.get().setActive(true);
> > > > > 
> > > > >         if (request != null)
> > > > >         {
> > > > >             HttpSession session =
> > > request.getSession();
> > > > >            
> initSessionContext(session);
> > > > >             
> > > > > 
> > > > >
> > >
> initApplicationContext(request.getSession().getServletContext());
> > > > >         }
> > > > >     }
> > > > > 
> > > > > Best regards
> > > > > Mike Wilson
> > > > 
> > > > 
> > > >       
> > > >
> > 
> > 
> >       
> >


      

RE: session creation

Posted by Mike Wilson <mi...@hotmail.com>.
Certainly, I understand that the modularization is just a
potential future activity.
Still, what is your picture of on how much of your codebase
would go into "core" and "jsf", respectively, if doing this
activity?

Best regards
Mike 

> -----Original Message-----
> From: Mark Struberg [mailto:struberg@yahoo.de] 
> Sent: den 21 februari 2009 13:16
> To: openwebbeans-user@incubator.apache.org
> Subject: RE: session creation
> 
> Mike, all this is currently only in an evaluation phase. 
> We had the idea, and now let's see how we can implement it.
> Based on this knowledge, we will decide if and how we will do it.
> But don't expect this to be available before M3 ;)
> 
> I will think about the session creation too, but I'm not an 
> expert in this area.
> 
> LieGrue,
> strub
> 
> --- Mike Wilson <mi...@hotmail.com> schrieb am Sa, 21.2.2009:
> 
> > Von: Mike Wilson <mi...@hotmail.com>
> > Betreff: RE: session creation
> > An: openwebbeans-user@incubator.apache.org
> > Datum: Samstag, 21. Februar 2009, 12:24
> > Thanks Mark, 
> > 
> > > Yes, the Spec is really heavily tied to the 'core
> > J2EE' 
> > > techniques JPA and JSF.
> > > 
> > > But we already discussed ways to make OWB more
> > 'pluggable' by 
> > > spliting it into
> > > 
> > > .) webbeans-core
> > > .) webbeans-jsf
> > > .) webbeans-jpa
> > > .) webbeans-ejb
> > 
> > Ok, that's interesting. I take it that
> > request/session/conversation
> > contexts would be implemented in jsf and not core then?
> > With your knowledge about the current codebase, how much
> > code would
> > you reckon be needed to create a "custom module"
> > with support for
> > these contexts in a non-JSF web framework? (and also
> > solving the
> > "don't force session" problem etc)
> > I guess another way to ask the question is to ask how much
> > of the
> > current codebase would end up in webbeans-core and
> > webbeans-jsf
> > respectively, when splitting the codebase. A new web
> > framework
> > integration would probably be analogous in size to the jsf
> > module.
> > 
> > Best regards
> > Mike
> > 
> > > --- Mike Wilson <mi...@hotmail.com> schrieb am
> > Sa, 21.2.2009:
> > > 
> > > > Von: Mike Wilson <mi...@hotmail.com>
> > > > Betreff: RE: session creation
> > > > An: openwebbeans-user@incubator.apache.org
> > > > Datum: Samstag, 21. Februar 2009, 10:49
> > > > Hi Gurkan,
> > > >  
> > > > If I understand it correctly, WebBeans is
> > supposed to be
> > > > useful for other
> > > > web frameworks than JSF. Or are you saying that
> > the default
> > > > WB context
> > > > support is hard-wired to JSF, and other web
> > frameworks
> > > > should implement
> > > > their own support for this through lower-level
> > APIs in WB?
> > > > It would certainly be useful if the ready-made
> > contexts
> > > > were built to allow
> > > > for as much reuse as possible. Always forcing
> > session
> > > > creation makes it
> > > > harder to reuse this code for stateless
> > scenarios.
> > > >  
> > > > Just discussing hypothetically; is there anything
> > in the WB
> > > > model that
> > > > actually requires this "early" session
> > creation,
> > > > or could it in theory be
> > > > deferred to when a request is referring to a bean
> > on
> > > > session or conversation
> > > > scope?
> > > >  
> > > > Best regards
> > > > Mike
> > > > 
> > > > 
> > > >   _____  
> > > > 
> > > > From: Gurkan Erdogdu
> > [mailto:gurkanerdogdu@yahoo.com] 
> > > > Sent: den 20 februari 2009 16:03
> > > > To: openwebbeans-user@incubator.apache.org
> > > > Subject: Re: session creation
> > > > 
> > > > 
> > > > Hi;
> > > > 
> > > > Actually this may not be a problem. Indeed,
> > contexts is
> > > > related with JSF
> > > > semantics and session is created everytime in
> > JSF.
> > > > 
> > > > 
> > > > Thanks;
> > > > 
> > > > /Gurkan
> > > > 
> > > > 
> > > > 
> > > >   _____  
> > > > 
> > > > From: Mike Wilson <mi...@hotmail.com>
> > > > To: openwebbeans-user@incubator.apache.org
> > > > Sent: Thursday, February 19, 2009 7:21:56 PM
> > > > Subject: session creation
> > > > 
> > > > I got things running with Jetty 6.1.15rc4 and now
> > I have a
> > > > question
> > > > about session creation:
> > > > 
> > > > Will OpenWebBeans always force a session to be
> > created? In
> > > > the 
> > > > current codebase (see below) this seems to be the
> > case. If 
> > > > possible, it would be nice if sessions only were
> > created
> > > > on-demand
> > > > when a component needs session (or conversation)
> > storage.
> > > > Doing it this way would make it possible to have
> > stateless
> > > > requests
> > > > that avoid the overhead of session creation when
> > possible.
> > > > 
> > > > ContextFactory.java:
> > > > 
> > > >     public static void
> > > > initRequestContext(HttpServletRequest request)
> > > >     {
> > > >         requestContext.set(new
> > RequestContext());// set
> > > > thread local
> > > >         requestContext.get().setActive(true);
> > > > 
> > > >         if (request != null)
> > > >         {
> > > >             HttpSession session =
> > request.getSession();
> > > >             initSessionContext(session);
> > > >             
> > > > 
> > > >
> > initApplicationContext(request.getSession().getServletContext());
> > > >         }
> > > >     }
> > > > 
> > > > Best regards
> > > > Mike Wilson
> > > 
> > > 
> > >       
> > >
> 
> 
>       
> 


RE: session creation

Posted by Mark Struberg <st...@yahoo.de>.
Mike, all this is currently only in an evaluation phase. 
We had the idea, and now let's see how we can implement it.
Based on this knowledge, we will decide if and how we will do it.
But don't expect this to be available before M3 ;)

I will think about the session creation too, but I'm not an expert in this area.

LieGrue,
strub

--- Mike Wilson <mi...@hotmail.com> schrieb am Sa, 21.2.2009:

> Von: Mike Wilson <mi...@hotmail.com>
> Betreff: RE: session creation
> An: openwebbeans-user@incubator.apache.org
> Datum: Samstag, 21. Februar 2009, 12:24
> Thanks Mark, 
> 
> > Yes, the Spec is really heavily tied to the 'core
> J2EE' 
> > techniques JPA and JSF.
> > 
> > But we already discussed ways to make OWB more
> 'pluggable' by 
> > spliting it into
> > 
> > .) webbeans-core
> > .) webbeans-jsf
> > .) webbeans-jpa
> > .) webbeans-ejb
> 
> Ok, that's interesting. I take it that
> request/session/conversation
> contexts would be implemented in jsf and not core then?
> With your knowledge about the current codebase, how much
> code would
> you reckon be needed to create a "custom module"
> with support for
> these contexts in a non-JSF web framework? (and also
> solving the
> "don't force session" problem etc)
> I guess another way to ask the question is to ask how much
> of the
> current codebase would end up in webbeans-core and
> webbeans-jsf
> respectively, when splitting the codebase. A new web
> framework
> integration would probably be analogous in size to the jsf
> module.
> 
> Best regards
> Mike
> 
> > --- Mike Wilson <mi...@hotmail.com> schrieb am
> Sa, 21.2.2009:
> > 
> > > Von: Mike Wilson <mi...@hotmail.com>
> > > Betreff: RE: session creation
> > > An: openwebbeans-user@incubator.apache.org
> > > Datum: Samstag, 21. Februar 2009, 10:49
> > > Hi Gurkan,
> > >  
> > > If I understand it correctly, WebBeans is
> supposed to be
> > > useful for other
> > > web frameworks than JSF. Or are you saying that
> the default
> > > WB context
> > > support is hard-wired to JSF, and other web
> frameworks
> > > should implement
> > > their own support for this through lower-level
> APIs in WB?
> > > It would certainly be useful if the ready-made
> contexts
> > > were built to allow
> > > for as much reuse as possible. Always forcing
> session
> > > creation makes it
> > > harder to reuse this code for stateless
> scenarios.
> > >  
> > > Just discussing hypothetically; is there anything
> in the WB
> > > model that
> > > actually requires this "early" session
> creation,
> > > or could it in theory be
> > > deferred to when a request is referring to a bean
> on
> > > session or conversation
> > > scope?
> > >  
> > > Best regards
> > > Mike
> > > 
> > > 
> > >   _____  
> > > 
> > > From: Gurkan Erdogdu
> [mailto:gurkanerdogdu@yahoo.com] 
> > > Sent: den 20 februari 2009 16:03
> > > To: openwebbeans-user@incubator.apache.org
> > > Subject: Re: session creation
> > > 
> > > 
> > > Hi;
> > > 
> > > Actually this may not be a problem. Indeed,
> contexts is
> > > related with JSF
> > > semantics and session is created everytime in
> JSF.
> > > 
> > > 
> > > Thanks;
> > > 
> > > /Gurkan
> > > 
> > > 
> > > 
> > >   _____  
> > > 
> > > From: Mike Wilson <mi...@hotmail.com>
> > > To: openwebbeans-user@incubator.apache.org
> > > Sent: Thursday, February 19, 2009 7:21:56 PM
> > > Subject: session creation
> > > 
> > > I got things running with Jetty 6.1.15rc4 and now
> I have a
> > > question
> > > about session creation:
> > > 
> > > Will OpenWebBeans always force a session to be
> created? In
> > > the 
> > > current codebase (see below) this seems to be the
> case. If 
> > > possible, it would be nice if sessions only were
> created
> > > on-demand
> > > when a component needs session (or conversation)
> storage.
> > > Doing it this way would make it possible to have
> stateless
> > > requests
> > > that avoid the overhead of session creation when
> possible.
> > > 
> > > ContextFactory.java:
> > > 
> > >     public static void
> > > initRequestContext(HttpServletRequest request)
> > >     {
> > >         requestContext.set(new
> RequestContext());// set
> > > thread local
> > >         requestContext.get().setActive(true);
> > > 
> > >         if (request != null)
> > >         {
> > >             HttpSession session =
> request.getSession();
> > >             initSessionContext(session);
> > >             
> > > 
> > >
> initApplicationContext(request.getSession().getServletContext());
> > >         }
> > >     }
> > > 
> > > Best regards
> > > Mike Wilson
> > 
> > 
> >       
> >


      

RE: session creation

Posted by Mike Wilson <mi...@hotmail.com>.
Thanks Mark, 

> Yes, the Spec is really heavily tied to the 'core J2EE' 
> techniques JPA and JSF.
> 
> But we already discussed ways to make OWB more 'pluggable' by 
> spliting it into
> 
> .) webbeans-core
> .) webbeans-jsf
> .) webbeans-jpa
> .) webbeans-ejb

Ok, that's interesting. I take it that request/session/conversation
contexts would be implemented in jsf and not core then?
With your knowledge about the current codebase, how much code would
you reckon be needed to create a "custom module" with support for
these contexts in a non-JSF web framework? (and also solving the
"don't force session" problem etc)
I guess another way to ask the question is to ask how much of the
current codebase would end up in webbeans-core and webbeans-jsf
respectively, when splitting the codebase. A new web framework
integration would probably be analogous in size to the jsf module.

Best regards
Mike

> --- Mike Wilson <mi...@hotmail.com> schrieb am Sa, 21.2.2009:
> 
> > Von: Mike Wilson <mi...@hotmail.com>
> > Betreff: RE: session creation
> > An: openwebbeans-user@incubator.apache.org
> > Datum: Samstag, 21. Februar 2009, 10:49
> > Hi Gurkan,
> >  
> > If I understand it correctly, WebBeans is supposed to be
> > useful for other
> > web frameworks than JSF. Or are you saying that the default
> > WB context
> > support is hard-wired to JSF, and other web frameworks
> > should implement
> > their own support for this through lower-level APIs in WB?
> > It would certainly be useful if the ready-made contexts
> > were built to allow
> > for as much reuse as possible. Always forcing session
> > creation makes it
> > harder to reuse this code for stateless scenarios.
> >  
> > Just discussing hypothetically; is there anything in the WB
> > model that
> > actually requires this "early" session creation,
> > or could it in theory be
> > deferred to when a request is referring to a bean on
> > session or conversation
> > scope?
> >  
> > Best regards
> > Mike
> > 
> > 
> >   _____  
> > 
> > From: Gurkan Erdogdu [mailto:gurkanerdogdu@yahoo.com] 
> > Sent: den 20 februari 2009 16:03
> > To: openwebbeans-user@incubator.apache.org
> > Subject: Re: session creation
> > 
> > 
> > Hi;
> > 
> > Actually this may not be a problem. Indeed, contexts is
> > related with JSF
> > semantics and session is created everytime in JSF.
> > 
> > 
> > Thanks;
> > 
> > /Gurkan
> > 
> > 
> > 
> >   _____  
> > 
> > From: Mike Wilson <mi...@hotmail.com>
> > To: openwebbeans-user@incubator.apache.org
> > Sent: Thursday, February 19, 2009 7:21:56 PM
> > Subject: session creation
> > 
> > I got things running with Jetty 6.1.15rc4 and now I have a
> > question
> > about session creation:
> > 
> > Will OpenWebBeans always force a session to be created? In
> > the 
> > current codebase (see below) this seems to be the case. If 
> > possible, it would be nice if sessions only were created
> > on-demand
> > when a component needs session (or conversation) storage.
> > Doing it this way would make it possible to have stateless
> > requests
> > that avoid the overhead of session creation when possible.
> > 
> > ContextFactory.java:
> > 
> >     public static void
> > initRequestContext(HttpServletRequest request)
> >     {
> >         requestContext.set(new RequestContext());// set
> > thread local
> >         requestContext.get().setActive(true);
> > 
> >         if (request != null)
> >         {
> >             HttpSession session = request.getSession();
> >             initSessionContext(session);
> >             
> > 
> > initApplicationContext(request.getSession().getServletContext());
> >         }
> >     }
> > 
> > Best regards
> > Mike Wilson
> 
> 
>       
> 


RE: session creation

Posted by Mark Struberg <st...@yahoo.de>.
Hi Mike!

Yes, the Spec is really heavily tied to the 'core J2EE' techniques JPA and JSF.

But we already discussed ways to make OWB more 'pluggable' by spliting it into

.) webbeans-core
.) webbeans-jsf
.) webbeans-jpa
.) webbeans-ejb

So one doesn't need to have JSF or JPA dependencies anymore if he doesn't need it, and on the other hand we may also add native support e.g. for wicket, iBatis etc.

LieGrue,
strub


--- Mike Wilson <mi...@hotmail.com> schrieb am Sa, 21.2.2009:

> Von: Mike Wilson <mi...@hotmail.com>
> Betreff: RE: session creation
> An: openwebbeans-user@incubator.apache.org
> Datum: Samstag, 21. Februar 2009, 10:49
> Hi Gurkan,
>  
> If I understand it correctly, WebBeans is supposed to be
> useful for other
> web frameworks than JSF. Or are you saying that the default
> WB context
> support is hard-wired to JSF, and other web frameworks
> should implement
> their own support for this through lower-level APIs in WB?
> It would certainly be useful if the ready-made contexts
> were built to allow
> for as much reuse as possible. Always forcing session
> creation makes it
> harder to reuse this code for stateless scenarios.
>  
> Just discussing hypothetically; is there anything in the WB
> model that
> actually requires this "early" session creation,
> or could it in theory be
> deferred to when a request is referring to a bean on
> session or conversation
> scope?
>  
> Best regards
> Mike
> 
> 
>   _____  
> 
> From: Gurkan Erdogdu [mailto:gurkanerdogdu@yahoo.com] 
> Sent: den 20 februari 2009 16:03
> To: openwebbeans-user@incubator.apache.org
> Subject: Re: session creation
> 
> 
> Hi;
> 
> Actually this may not be a problem. Indeed, contexts is
> related with JSF
> semantics and session is created everytime in JSF.
> 
> 
> Thanks;
> 
> /Gurkan
> 
> 
> 
>   _____  
> 
> From: Mike Wilson <mi...@hotmail.com>
> To: openwebbeans-user@incubator.apache.org
> Sent: Thursday, February 19, 2009 7:21:56 PM
> Subject: session creation
> 
> I got things running with Jetty 6.1.15rc4 and now I have a
> question
> about session creation:
> 
> Will OpenWebBeans always force a session to be created? In
> the 
> current codebase (see below) this seems to be the case. If 
> possible, it would be nice if sessions only were created
> on-demand
> when a component needs session (or conversation) storage.
> Doing it this way would make it possible to have stateless
> requests
> that avoid the overhead of session creation when possible.
> 
> ContextFactory.java:
> 
>     public static void
> initRequestContext(HttpServletRequest request)
>     {
>         requestContext.set(new RequestContext());// set
> thread local
>         requestContext.get().setActive(true);
> 
>         if (request != null)
>         {
>             HttpSession session = request.getSession();
>             initSessionContext(session);
>             
> 
> initApplicationContext(request.getSession().getServletContext());
>         }
>     }
> 
> Best regards
> Mike Wilson


      

RE: session creation

Posted by Mike Wilson <mi...@hotmail.com>.
Hi Gurkan,
 
If I understand it correctly, WebBeans is supposed to be useful for other
web frameworks than JSF. Or are you saying that the default WB context
support is hard-wired to JSF, and other web frameworks should implement
their own support for this through lower-level APIs in WB?
It would certainly be useful if the ready-made contexts were built to allow
for as much reuse as possible. Always forcing session creation makes it
harder to reuse this code for stateless scenarios.
 
Just discussing hypothetically; is there anything in the WB model that
actually requires this "early" session creation, or could it in theory be
deferred to when a request is referring to a bean on session or conversation
scope?
 
Best regards
Mike


  _____  

From: Gurkan Erdogdu [mailto:gurkanerdogdu@yahoo.com] 
Sent: den 20 februari 2009 16:03
To: openwebbeans-user@incubator.apache.org
Subject: Re: session creation


Hi;

Actually this may not be a problem. Indeed, contexts is related with JSF
semantics and session is created everytime in JSF.


Thanks;

/Gurkan



  _____  

From: Mike Wilson <mi...@hotmail.com>
To: openwebbeans-user@incubator.apache.org
Sent: Thursday, February 19, 2009 7:21:56 PM
Subject: session creation

I got things running with Jetty 6.1.15rc4 and now I have a question
about session creation:

Will OpenWebBeans always force a session to be created? In the 
current codebase (see below) this seems to be the case. If 
possible, it would be nice if sessions only were created on-demand
when a component needs session (or conversation) storage.
Doing it this way would make it possible to have stateless requests
that avoid the overhead of session creation when possible.

ContextFactory.java:

    public static void initRequestContext(HttpServletRequest request)
    {
        requestContext.set(new RequestContext());// set thread local
        requestContext.get().setActive(true);

        if (request != null)
        {
            HttpSession session = request.getSession();
            initSessionContext(session);
            

initApplicationContext(request.getSession().getServletContext());
        }
    }

Best regards
Mike Wilson





Re: session creation

Posted by Gurkan Erdogdu <gu...@yahoo.com>.
Hi;

Actually this may not be a problem. Indeed, contexts is related with JSF semantics and session is created everytime in JSF.


Thanks;

/Gurkan



________________________________
From: Mike Wilson <mi...@hotmail.com>
To: openwebbeans-user@incubator.apache.org
Sent: Thursday, February 19, 2009 7:21:56 PM
Subject: session creation

I got things running with Jetty 6.1.15rc4 and now I have a question
about session creation:

Will OpenWebBeans always force a session to be created? In the 
current codebase (see below) this seems to be the case. If 
possible, it would be nice if sessions only were created on-demand
when a component needs session (or conversation) storage.
Doing it this way would make it possible to have stateless requests
that avoid the overhead of session creation when possible.

ContextFactory.java:

    public static void initRequestContext(HttpServletRequest request)
    {
        requestContext.set(new RequestContext());// set thread local
        requestContext.get().setActive(true);

        if (request != null)
        {
            HttpSession session = request.getSession();
            initSessionContext(session);
            

initApplicationContext(request.getSession().getServletContext());
        }
    }

Best regards
Mike Wilson