web.xml 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!DOCTYPE web-app PUBLIC '-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN' 'http://java.sun.com/dtd/web-app_2_3.dtd'>
  3. <!--
  4. - Contacts web application
  5. - $Id$
  6. - File will be copied into WAR's WEB-INF directory if using container adapter
  7. -->
  8. <web-app>
  9. <display-name>Contacts Sample Application</display-name>
  10. <description>
  11. Example of an application secured using Acegi Security System for Spring.
  12. </description>
  13. <!--
  14. - Location of the XML file that defines the root application context
  15. - Applied by ContextLoaderListener.
  16. -->
  17. <context-param>
  18. <param-name>contextConfigLocation</param-name>
  19. <param-value>/WEB-INF/applicationContext.xml</param-value>
  20. </context-param>
  21. <filter>
  22. <filter-name>Acegi HTTP BASIC Authorization Filter</filter-name>
  23. <filter-class>net.sf.acegisecurity.util.FilterToBeanProxy</filter-class>
  24. <init-param>
  25. <param-name>targetClass</param-name>
  26. <param-value>net.sf.acegisecurity.ui.basicauth.BasicProcessingFilter</param-value>
  27. </init-param>
  28. </filter>
  29. <filter>
  30. <filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
  31. <filter-class>net.sf.acegisecurity.ui.AutoIntegrationFilter</filter-class>
  32. </filter>
  33. <filter-mapping>
  34. <filter-name>Acegi HTTP BASIC Authorization Filter</filter-name>
  35. <url-pattern>/*</url-pattern>
  36. </filter-mapping>
  37. <filter-mapping>
  38. <filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
  39. <url-pattern>/*</url-pattern>
  40. </filter-mapping>
  41. <!--
  42. - Loads the root application context of this web app at startup,
  43. - by default from "/WEB-INF/applicationContext.xml".
  44. - Use WebApplicationContextUtils.getWebApplicationContext(servletContext)
  45. - to access it anywhere in the web application, outside of the framework.
  46. -->
  47. <listener>
  48. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  49. </listener>
  50. <!--
  51. - Servlet that dispatches request to registered handlers (Controller implementations).
  52. - Has its own application context, by default defined in "{servlet-name}-servlet.xml",
  53. - i.e. "contacts-servlet.xml".
  54. -
  55. - A web app can contain any number of such servlets.
  56. - Note that this web app does not have a shared root application context,
  57. - therefore the DispatcherServlet contexts do not have a common parent.
  58. -->
  59. <servlet>
  60. <servlet-name>contacts</servlet-name>
  61. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  62. <load-on-startup>1</load-on-startup>
  63. </servlet>
  64. <servlet>
  65. <servlet-name>caucho</servlet-name>
  66. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  67. <load-on-startup>2</load-on-startup>
  68. </servlet>
  69. <!--
  70. - Maps the contacts dispatcher to /*.
  71. -
  72. -->
  73. <servlet-mapping>
  74. <servlet-name>contacts</servlet-name>
  75. <url-pattern>*.htm</url-pattern>
  76. </servlet-mapping>
  77. <!--
  78. - Dispatcher servlet mapping for HTTP remoting via the Caucho protocols,
  79. - i.e. Hessian and Burlap (see caucho-servlet.xml for the controllers).
  80. -->
  81. <servlet-mapping>
  82. <servlet-name>caucho</servlet-name>
  83. <url-pattern>/caucho/*</url-pattern>
  84. </servlet-mapping>
  85. <welcome-file-list>
  86. <welcome-file>index.jsp</welcome-file>
  87. </welcome-file-list>
  88. <taglib>
  89. <taglib-uri>/spring</taglib-uri>
  90. <taglib-location>/WEB-INF/spring.tld</taglib-location>
  91. </taglib>
  92. <security-constraint>
  93. <display-name>Secured Area Security Constraint</display-name>
  94. <web-resource-collection>
  95. <web-resource-name>Secured Area</web-resource-name>
  96. <url-pattern>/secure/*</url-pattern>
  97. </web-resource-collection>
  98. <auth-constraint>
  99. <role-name>ROLE_TELLER</role-name>
  100. <role-name>ROLE_SUPERVISOR</role-name>
  101. </auth-constraint>
  102. </security-constraint>
  103. <!-- Default login configuration using BASIC authentication -->
  104. <!--
  105. <login-config>
  106. <auth-method>BASIC</auth-method>
  107. <realm-name>Spring Powered Realm</realm-name>
  108. </login-config>
  109. -->
  110. <!-- Default login configuration using form-based authentication -->
  111. <login-config>
  112. <auth-method>FORM</auth-method>
  113. <realm-name>Spring Powered Realm</realm-name>
  114. <form-login-config>
  115. <form-login-page>/login.jsp</form-login-page>
  116. <form-error-page>/login.jsp?login_error=1</form-error-page>
  117. </form-login-config>
  118. </login-config>
  119. <!-- Security roles referenced by this web application -->
  120. <security-role>
  121. <role-name>ROLE_SUPERVISOR</role-name>
  122. </security-role>
  123. <security-role>
  124. <role-name>ROLE_TELLER</role-name>
  125. </security-role>
  126. </web-app>