Java Doc for HttpSessionContextIntegrationFilter.java in  » Security » acegi-security » org » acegisecurity » context » 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 » Security » acegi security » org.acegisecurity.context 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.acegisecurity.context.HttpSessionContextIntegrationFilter

HttpSessionContextIntegrationFilter
public class HttpSessionContextIntegrationFilter implements InitializingBean,Filter(Code)
Populates the SecurityContextHolder with information obtained from the HttpSession.

The HttpSession will be queried to retrieve the SecurityContext that should be stored against the SecurityContextHolder for the duration of the web request. At the end of the web request, any updates made to the SecurityContextHolder will be persisted back to the HttpSession by this filter.

If a valid SecurityContext cannot be obtained from the HttpSession for whatever reason, a fresh SecurityContext will be created and used instead. The created object will be of the instance defined by the HttpSessionContextIntegrationFilter.setContext(Class) method (which defaults to org.acegisecurity.context.SecurityContextImpl .

No HttpSession will be created by this filter if one does not already exist. If at the end of the web request the HttpSession does not exist, a HttpSession will only be created if the current contents of the SecurityContextHolder are not java.lang.Object.equals(java.lang.Object) to a new instance of HttpSessionContextIntegrationFilter.setContext(Class) . This avoids needless HttpSession creation, but automates the storage of changes made to the SecurityContextHolder. There is one exception to this rule, that is if the HttpSessionContextIntegrationFilter.forceEagerSessionCreation property is true, in which case sessions will always be created irrespective of normal session-minimisation logic (the default is false, as this is resource intensive and not recommended).

This filter will only execute once per request, to resolve servlet container (specifically Weblogic) incompatibilities.

If for whatever reason no HttpSession should ever be created (eg this filter is only being used with Basic authentication or similar clients that will never present the same jsessionid etc), the HttpSessionContextIntegrationFilter.setAllowSessionCreation(boolean) should be set to false. Only do this if you really need to conserve server memory and ensure all classes using the SecurityContextHolder are designed to have no persistence of the SecurityContext between web requests. Please note that if HttpSessionContextIntegrationFilter.forceEagerSessionCreation is true, the allowSessionCreation must also be true (setting it to false will cause a startup time error).

This filter MUST be executed BEFORE any authentication processing mechanisms. Authentication processing mechanisms (eg BASIC, CAS processing filters etc) expect the SecurityContextHolder to contain a valid SecurityContext by the time they execute.


author:
   Ben Alex
author:
   Patrick Burleson
author:
   Luke Taylor
author:
   Martin Algesten
version:
   $Id: HttpSessionContextIntegrationFilter.java 2004 2007-09-01 14:43:09Z raykrueger $


Field Summary
final public static  StringACEGI_SECURITY_CONTEXT_KEY
    
final static  StringFILTER_APPLIED
    
final protected static  Loglogger
    

Constructor Summary
public  HttpSessionContextIntegrationFilter()
    

Method Summary
public  voidafterPropertiesSet()
    
public  voiddestroy()
     Does nothing.
public  voiddoFilter(ServletRequest req, ServletResponse res, FilterChain chain)
    
public  SecurityContextgenerateNewContext()
    
public  ClassgetContext()
    
public  voidinit(FilterConfig filterConfig)
     Does nothing.
public  booleanisAllowSessionCreation()
    
public  booleanisCloneFromHttpSession()
    
public  booleanisForceEagerSessionCreation()
    
public  voidsetAllowSessionCreation(boolean allowSessionCreation)
    
public  voidsetCloneFromHttpSession(boolean cloneFromHttpSession)
    
public  voidsetContext(Class secureContext)
    
public  voidsetForceEagerSessionCreation(boolean forceEagerSessionCreation)
    

Field Detail
ACEGI_SECURITY_CONTEXT_KEY
final public static String ACEGI_SECURITY_CONTEXT_KEY(Code)



FILTER_APPLIED
final static String FILTER_APPLIED(Code)



logger
final protected static Log logger(Code)




Constructor Detail
HttpSessionContextIntegrationFilter
public HttpSessionContextIntegrationFilter() throws ServletException(Code)




Method Detail
afterPropertiesSet
public void afterPropertiesSet() throws Exception(Code)



destroy
public void destroy()(Code)
Does nothing. We use IoC container lifecycle services instead.



doFilter
public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain) throws IOException, ServletException(Code)



generateNewContext
public SecurityContext generateNewContext() throws ServletException(Code)



getContext
public Class getContext()(Code)



init
public void init(FilterConfig filterConfig) throws ServletException(Code)
Does nothing. We use IoC container lifecycle services instead.
Parameters:
  filterConfig - ignored
throws:
  ServletException - ignored



isAllowSessionCreation
public boolean isAllowSessionCreation()(Code)



isCloneFromHttpSession
public boolean isCloneFromHttpSession()(Code)



isForceEagerSessionCreation
public boolean isForceEagerSessionCreation()(Code)



setAllowSessionCreation
public void setAllowSessionCreation(boolean allowSessionCreation)(Code)



setCloneFromHttpSession
public void setCloneFromHttpSession(boolean cloneFromHttpSession)(Code)



setContext
public void setContext(Class secureContext)(Code)



setForceEagerSessionCreation
public void setForceEagerSessionCreation(boolean forceEagerSessionCreation)(Code)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.