web.xml 4.5 KB

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