web.xml 4.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151
  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.util.FilterToBeanProxy</filter-class>
  32. <init-param>
  33. <param-name>targetClass</param-name>
  34. <param-value>net.sf.acegisecurity.ui.AutoIntegrationFilter</param-value>
  35. </init-param>
  36. </filter>
  37. <filter-mapping>
  38. <filter-name>Acegi HTTP BASIC Authorization Filter</filter-name>
  39. <url-pattern>/*</url-pattern>
  40. </filter-mapping>
  41. <filter-mapping>
  42. <filter-name>Acegi Security System for Spring Auto Integration Filter</filter-name>
  43. <url-pattern>/*</url-pattern>
  44. </filter-mapping>
  45. <!--
  46. - Loads the root application context of this web app at startup,
  47. - by default from "/WEB-INF/applicationContext.xml".
  48. - Use WebApplicationContextUtils.getWebApplicationContext(servletContext)
  49. - to access it anywhere in the web application, outside of the framework.
  50. -->
  51. <listener>
  52. <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
  53. </listener>
  54. <!--
  55. - Servlet that dispatches request to registered handlers (Controller implementations).
  56. - Has its own application context, by default defined in "{servlet-name}-servlet.xml",
  57. - i.e. "contacts-servlet.xml".
  58. -
  59. - A web app can contain any number of such servlets.
  60. - Note that this web app does not have a shared root application context,
  61. - therefore the DispatcherServlet contexts do not have a common parent.
  62. -->
  63. <servlet>
  64. <servlet-name>contacts</servlet-name>
  65. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  66. <load-on-startup>1</load-on-startup>
  67. </servlet>
  68. <servlet>
  69. <servlet-name>caucho</servlet-name>
  70. <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
  71. <load-on-startup>2</load-on-startup>
  72. </servlet>
  73. <!--
  74. - Maps the contacts dispatcher to /*.
  75. -
  76. -->
  77. <servlet-mapping>
  78. <servlet-name>contacts</servlet-name>
  79. <url-pattern>*.htm</url-pattern>
  80. </servlet-mapping>
  81. <!--
  82. - Dispatcher servlet mapping for HTTP remoting via the Caucho protocols,
  83. - i.e. Hessian and Burlap (see caucho-servlet.xml for the controllers).
  84. -->
  85. <servlet-mapping>
  86. <servlet-name>caucho</servlet-name>
  87. <url-pattern>/caucho/*</url-pattern>
  88. </servlet-mapping>
  89. <welcome-file-list>
  90. <welcome-file>index.jsp</welcome-file>
  91. </welcome-file-list>
  92. <taglib>
  93. <taglib-uri>/spring</taglib-uri>
  94. <taglib-location>/WEB-INF/spring.tld</taglib-location>
  95. </taglib>
  96. <security-constraint>
  97. <display-name>Secured Area Security Constraint</display-name>
  98. <web-resource-collection>
  99. <web-resource-name>Secured Area</web-resource-name>
  100. <url-pattern>/secure/*</url-pattern>
  101. </web-resource-collection>
  102. <auth-constraint>
  103. <role-name>ROLE_TELLER</role-name>
  104. <role-name>ROLE_SUPERVISOR</role-name>
  105. </auth-constraint>
  106. </security-constraint>
  107. <!-- Default login configuration using BASIC authentication -->
  108. <!--
  109. <login-config>
  110. <auth-method>BASIC</auth-method>
  111. <realm-name>Spring Powered Realm</realm-name>
  112. </login-config>
  113. -->
  114. <!-- Default login configuration using form-based authentication -->
  115. <login-config>
  116. <auth-method>FORM</auth-method>
  117. <realm-name>Spring Powered Realm</realm-name>
  118. <form-login-config>
  119. <form-login-page>/login.jsp</form-login-page>
  120. <form-error-page>/login.jsp?login_error=1</form-error-page>
  121. </form-login-config>
  122. </login-config>
  123. <!-- Security roles referenced by this web application -->
  124. <security-role>
  125. <role-name>ROLE_SUPERVISOR</role-name>
  126. </security-role>
  127. <security-role>
  128. <role-name>ROLE_TELLER</role-name>
  129. </security-role>
  130. </web-app>