-
Mar 11th, 2010, 03:08 AM
#1
Scoped Beans
Hi together,
I'm using SI and need some help concerning scoped beans.
In my application I have beans which should be created and destroyed through a specific HTTP request. Each request that contains a unique conversation id should have access to these beans.
I can't use the session scope because there are several HTTP requests in different HTTP sessions.
How can I solve this?
Thanks in advance,
Thomas
-
Mar 11th, 2010, 03:16 AM
#2
Request scope
You can use the request scope
-
Mar 11th, 2010, 03:30 AM
#3
Hi,
As I undestand the request scope, the container will create a new bean for each HTTP request.
That is not what I want. I will use one bean across multiple HTTP requests from different HTTP sessions.
~Thomas
-
Mar 11th, 2010, 03:37 AM
#4
So you need a single bean for various request /sessions? Which means you need a singleton scoped bean?
-Hetal
-
Mar 11th, 2010, 03:44 AM
#5
I need a bean instance for each HTTP request with a specific conversation id.
So the container should create a new instance if a HTTP request contains a new conversation id.
~Thomas
-
Mar 11th, 2010, 04:08 AM
#6
Hi,
May be you can check the secttion 3.7.3 in ref doc http://static.springsource.org/sprin...nce/beans.html
-Hetal
-
Mar 16th, 2010, 01:24 AM
#7
You could define a custom scope, but my first advice would be not to go there. Not that the api is not clean, but if you can avoid thinking about scopes you'll save yourself (and the maintenance programmers after you) a headache.
-
Mar 16th, 2010, 02:26 AM
#8
Hi Iwein,
the reason why I'm thinking about scopes is, that my service holds a state. The additional requirement is, that the service must handle multiple sessions (no HTTP sessions). Several HTTP clients can send requests to the service. The conversation id is part of the HTTP request. So I have to decide which request is connected with which service instance.
If I define a custom scope I don't know how to signal the end of the scope.
~Thomas
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules