codeuniv

web.xml - Deployment Descriptor

Mar 29th, 2022 (edited)
860
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
XML 3.46 KB | None | 0 0
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <web-app id="WebApp_9" version="3.0" xmlns="http://java.sun.com/xml/ns/javaee"
  3.     xmlns:xsi="https://www.w3.org/2001/XMLSchema-instance"
  4.     xsi:schemaLocation="http://java.sun.com/xml/ns/javaee
  5.  http://java.sun.com/xml/ns/javaee/web-app_3_0.xsd">
  6.    
  7.     <display-name>Servlet 3.0 application</display-name>
  8.  
  9. https://www.baeldung.com/spring-security-expressions
  10. override 30 min default - to maintain Session
  11.     <session-config>
  12.         <session-timeout>10</session-timeout>
  13.     </session-config>
  14.    
  15.     <filter>
  16.         <filter-name>ServletMappedDoFilter_Filter</filter-name>
  17.         <filter-class>tests.Filter.DoFilter_Filter</filter-class>
  18.     <init-param>
  19.       <param-name>attribute</param-name>
  20.       <param-value>tests.Filter.DoFilter_Filter.SERVLET_MAPPED</param-value>
  21.     </init-param>
  22.   </filter>
  23.    
  24.     <filter-mapping>
  25.         <filter-name>ServletMappedDoFilter_Filter</filter-name>
  26.         <url-pattern>/DoFilterTest</url-pattern>
  27.         <dispatcher>REQUEST</dispatcher>
  28.     </filter-mapping>
  29.        
  30.     <listener>
  31.         <listener-class>tests.ContextListener</listener-class>
  32.     </listener>
  33.        
  34.     <servlet>
  35.         <servlet-name>welcome</servlet-name>
  36.         <servlet-class>WelcomeServlet</servlet-class>
  37.     </servlet>
  38.    
  39.     <servlet-mapping>
  40.         <servlet-name>welcome</servlet-name>
  41.         <url-pattern>/hello.welcome</url-pattern>
  42.     </servlet-mapping>
  43.    
  44.     <servlet>
  45.         <servlet-name>redteam</servlet-name>
  46.         <servlet-class>mysite.server.TeamServlet</servlet-class>
  47.         <init-param>
  48.             <param-name>teamColor</param-name>
  49.             <param-value>red</param-value>
  50.         </init-param>
  51.         <init-param>
  52.             <param-name>bgColor</param-name>
  53.             <param-value>#CC0000</param-value>
  54.         </init-param>
  55.     </servlet>
  56.        
  57.     <welcome-file-list>
  58.         <welcome-file>hello.welcome</welcome-file>
  59.     </welcome-file-list>
  60.    
  61.     <error-page>
  62.         <exception-type>java.lang.ArrayIndexOutOfBoundsException</exception-type>
  63.         <location>/ServletErrorPage</location>
  64.     </error-page>
  65.    
  66.   <error-page>
  67.       <error-code>404</error-code>
  68.       <location>/error404.html</location>
  69.   </error-page>
  70.    
  71.     <taglib>
  72.         <taglib-uri>/i18ntaglib</taglib-uri>
  73.         <taglib-location>/WEB-INF/tlds/i18ntaglib.tld </taglib-location>
  74.   </taglib>
  75.    
  76.     <servlet>
  77.         <servlet-name>register</servlet-name>
  78.         <jsp-file>/register/start.jsp</jsp-file>
  79.     </servlet>
  80.  
  81.  
  82.     App Engine supports automatic compilation and URL mapping for JSPs. A JSP file in the application's WAR (outside of WEB-INF/) whose filename ends in .jsp is compiled into a servlet class automatically, and mapped to the URL path equivalent to the path to the JSP file from the WAR root. For example, if an app has a JSP file named start.jsp in a subdirectory named register/ in its WAR, App Engine compiles it and maps it to the URL path /register/start.jsp.
  83.  
  84. If you want more control over how the JSP is mapped to a URL, you can specify the mapping explicitly by declaring it with a <servlet> element in the deployment descriptor. Instead of a <servlet-class> element, you specify a <jsp-file> element with the path to the JSP file from the WAR root. The <servlet> element for the JSP can contain initialization parameters.
  85.    
  86.     See https://cloud.google.com/appengine/docs/standard/java/config/webxml
  87.    
  88.     <servlet-mapping>
  89.         <servlet-name>register</servlet-name>
  90.         <url-pattern>/register/*</url-pattern>
  91.     </servlet-mapping>
  92.    
  93. </web-app>
Add Comment
Please, Sign In to add comment