Source Code Cross Referenced for SessionScope.java in  » J2EE » spring-framework-2.0.6 » org » springframework » web » context » request » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » J2EE » spring framework 2.0.6 » org.springframework.web.context.request 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:         * Copyright 2002-2007 the original author or authors.
003:         *
004:         * Licensed under the Apache License, Version 2.0 (the "License");
005:         * you may not use this file except in compliance with the License.
006:         * You may obtain a copy of the License at
007:         *
008:         *      http://www.apache.org/licenses/LICENSE-2.0
009:         *
010:         * Unless required by applicable law or agreed to in writing, software
011:         * distributed under the License is distributed on an "AS IS" BASIS,
012:         * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
013:         * See the License for the specific language governing permissions and
014:         * limitations under the License.
015:         */
016:
017:        package org.springframework.web.context.request;
018:
019:        import org.springframework.beans.factory.ObjectFactory;
020:
021:        /**
022:         * Session-backed {@link org.springframework.beans.factory.config.Scope}
023:         * implementation.
024:         *
025:         * <p>Relies on a thread-bound {@link RequestAttributes} instance, which
026:         * can be exported through {@link RequestContextListener},
027:         * {@link org.springframework.web.filter.RequestContextFilter} or
028:         * {@link org.springframework.web.servlet.DispatcherServlet}.
029:         *
030:         * <p>This <code>Scope</code> will also work for Portlet environments,
031:         * through an alternate <code>RequestAttributes</code> implementation
032:         * (as exposed out-of-the-box by Spring's
033:         * {@link org.springframework.web.portlet.DispatcherPortlet}.
034:         *
035:         * @author Rod Johnson
036:         * @author Juergen Hoeller
037:         * @author Rob Harrop
038:         * @since 2.0
039:         * @see RequestContextHolder#currentRequestAttributes()
040:         * @see RequestAttributes#SCOPE_SESSION
041:         * @see RequestAttributes#SCOPE_GLOBAL_SESSION
042:         * @see RequestContextListener
043:         * @see org.springframework.web.filter.RequestContextFilter
044:         * @see org.springframework.web.servlet.DispatcherServlet
045:         * @see org.springframework.web.portlet.DispatcherPortlet
046:         */
047:        public class SessionScope extends AbstractRequestAttributesScope {
048:
049:            private final int scope;
050:
051:            /**
052:             * Create a new SessionScope, storing attributes in a locally
053:             * isolated session (or default session, if there is no distinction
054:             * between a global session and a component-specific session).
055:             */
056:            public SessionScope() {
057:                this .scope = RequestAttributes.SCOPE_SESSION;
058:            }
059:
060:            /**
061:             * Create a new SessionScope, specifying whether to store attributes
062:             * in the global session, provided that such a distinction is available.
063:             * <p>This distinction is important for Portlet environments, where there
064:             * are two notions of a session: "portlet scope" and "application scope".
065:             * If this flag is on, objects will be put into the "application scope" session;
066:             * else they will end up in the "portlet scope" session (the typical default).
067:             * <p>In a Servlet environment, this flag is effectively ignored.
068:             * @param globalSession <code>true</code> in case of the global session as target;
069:             * <code>false</code> in case of a component-specific session as target
070:             * @see org.springframework.web.portlet.context.PortletRequestAttributes
071:             * @see org.springframework.web.context.request.ServletRequestAttributes
072:             */
073:            public SessionScope(boolean globalSession) {
074:                this .scope = (globalSession ? RequestAttributes.SCOPE_GLOBAL_SESSION
075:                        : RequestAttributes.SCOPE_SESSION);
076:            }
077:
078:            protected int getScope() {
079:                return this .scope;
080:            }
081:
082:            public String getConversationId() {
083:                return RequestContextHolder.currentRequestAttributes()
084:                        .getSessionId();
085:            }
086:
087:            public Object get(String name, ObjectFactory objectFactory) {
088:                Object mutex = RequestContextHolder.currentRequestAttributes()
089:                        .getSessionMutex();
090:                synchronized (mutex) {
091:                    return super .get(name, objectFactory);
092:                }
093:            }
094:
095:            public Object remove(String name) {
096:                Object mutex = RequestContextHolder.currentRequestAttributes()
097:                        .getSessionMutex();
098:                synchronized (mutex) {
099:                    return super.remove(name);
100:                }
101:            }
102:
103:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.