The Session Scope [message #67618] |
Mon, 31 December 2007 13:51 |
Eclipse User |
|
|
|
Originally posted by: manuel.weiss.googlemail.com
Hi all!
First, merry Christmas and a Happy new Year;)
I have a question, for a course in software-architecture I must do a
whitepaper about Rich Ajax Plattform. IŽm not sure about some wording in
my document.
Can I say, that Data stored in a http-session is only accessible during
the processing of a request?
Greetz
Manu
|
|
|
Re: The Session Scope [message #67941 is a reply to message #67618] |
Wed, 02 January 2008 11:24 |
Eclipse User |
|
|
|
Originally posted by: rherrmann.innoopract.com
Hi Manuel,
session-scoped data can also be accessed when there is currently no
request being processed. For example, consider a thread that is spawned
while processing a request. The session could be passed to this thread
and thus the thread could access session-data.
So far for the standard servlet senario. When doing the same with RAP,
you need to wrap access to session data, see
org.eclipse.rwt.lifecycle.UICallBack for more information.
HTH,
Rüdiger
Manuel Weiss wrote:
> Hi all!
>
> First, merry Christmas and a Happy new Year;)
> I have a question, for a course in software-architecture I must do a
> whitepaper about Rich Ajax Plattform. IŽm not sure about some wording in
> my document.
> Can I say, that Data stored in a http-session is only accessible during
> the processing of a request?
>
> Greetz
>
> Manu
>
|
|
|
Re: The Session Scope [message #68818 is a reply to message #67941] |
Fri, 04 January 2008 06:33 |
Eclipse User |
|
|
|
Originally posted by: manuel.weiss.googlemail.com
Hi Rüdiger,
thank you for you answer.
This sounds nice, I looked at the Source-Code of
UICallback.runNonUIThreadWithFakeContext(..), but it is not as easy to
understand, at least to me.
Well, I understood so far, that the session is accessed via the display,
especially itŽs displayadapter, so if I want to access the session from a
backgroundthread outside of the requestlifecycle, I need to cache the
sessiondisplay locally and pass it later to UICallback? Is this how it
should be done?
How can you access the underlying HTTP-Session? I always thought, that
this Sessionmanagement is done by the servletcontainer. So do you cache
the session and update it whenever a request comes in? or how is the
session accessed?
Thank you very much for you effort.
Manu
|
|
|
Re: The Session Scope [message #68838 is a reply to message #68818] |
Fri, 04 January 2008 08:17 |
Eclipse User |
|
|
|
Originally posted by: manuel.weiss.googlemail.com
Hi again,
one more question I forgot, why do you wrap the Session within RAP?
Thanks!
Manu
|
|
|
Re: The Session Scope [message #68897 is a reply to message #68818] |
Fri, 04 January 2008 15:35 |
Eclipse User |
|
|
|
Originally posted by: rherrmann.innoopract.com
Manu,
right, you need to pass the display (which in turn has an internal
reference to the session) to the background thread.
Code to access the session from within a background thread could look
like this:
final Display display = new Display();
final Runnable bgRunnable = new Runnable() {
public void run() {
UICallBack.runNonUIThreadWithFakeContext( display, new Runnable() {
public void run() {
Object someValue
= RWT.getSessionStore().getAttribute( "myAtt" );
System.out.println( someValue );
// access the HTTP session
RWT.getSessionStore().getHttpSession();
}
} );
}
};
Shell shell = new Shell( display );
Button button = new Button( shell, SWT.PUSH );
button.setText( "Start Background Thread" );
button.addSelectionListener( new SelectionAdapter() {
public void widgetSelected( final SelectionEvent evt ) {
RWT.getSessionStore().setAttribute( "myAtt", "someValue" );
Thread thread = new Thread( bgRunnable );
thread.setDaemon( true );
thread.start();
}
} );
Cheers,
Rüdiger
Manuel Weiss wrote:
> Hi Rüdiger,
>
> thank you for you answer.
> This sounds nice, I looked at the Source-Code of
> UICallback.runNonUIThreadWithFakeContext(..), but it is not as easy to
> understand, at least to me.
>
> Well, I understood so far, that the session is accessed via the display,
> especially itŽs displayadapter, so if I want to access the session from
> a backgroundthread outside of the requestlifecycle, I need to cache the
> sessiondisplay locally and pass it later to UICallback? Is this how it
> should be done?
> How can you access the underlying HTTP-Session? I always thought, that
> this Sessionmanagement is done by the servletcontainer. So do you cache
> the session and update it whenever a request comes in? or how is the
> session accessed?
>
> Thank you very much for you effort.
>
> Manu
>
|
|
|
Re: The Session Scope [message #69542 is a reply to message #68838] |
Wed, 09 January 2008 18:32 |
Eclipse User |
|
|
|
Originally posted by: rherrmann.innoopract.com
Manu,
see the JavaDoc on org.eclipse.rwt.service.ISessionStore.
HTH
Rüdiger
Manuel Weiss wrote:
> Hi again,
>
> one more question I forgot, why do you wrap the Session within RAP?
>
> Thanks!
>
> Manu
>
|
|
|
Powered by
FUDForum. Page generated in 0.03137 seconds