Eine statische Spring-MVC-Seite zu den Beispielen hinzugefĆ¼gt
authorKai Moritz <kai@coolibri.de>
Sat, 2 Jun 2012 19:48:44 +0000 (21:48 +0200)
committerKai Moritz <kai@coolibri.de>
Thu, 2 Aug 2012 07:03:26 +0000 (09:03 +0200)
cachecontrol-example-jsp/src/main/resources/config.xml
cachecontrol-example-jsp/src/main/webapp/WEB-INF/views/simple-page.jsp [new file with mode: 0644]
cachecontrol-example-jsp/src/main/webapp/WEB-INF/web.xml

index e414ce9..b7a4892 100644 (file)
     <constructor-arg value="3600"/>
   </bean>
 
+  <bean id="simpleUrlHandlerMapping" class="org.springframework.web.servlet.handler.SimpleUrlHandlerMapping">
+    <property name="defaultHandler" value="urlFilenameViewController"/>
+  </bean>
+
+  <bean id="urlFilenameViewController" class="org.springframework.web.servlet.mvc.UrlFilenameViewController"/>
+
+  <!-- Resolves view names to protected .jsp resources within the /WEB-INF/views directory -->
+  <bean id="jspViewResolver" class="org.springframework.web.servlet.view.InternalResourceViewResolver">
+    <property name="prefix" value="/WEB-INF/views/"/>
+    <property name="suffix" value=".jsp"/>
+  </bean>
+
 </beans>
diff --git a/cachecontrol-example-jsp/src/main/webapp/WEB-INF/views/simple-page.jsp b/cachecontrol-example-jsp/src/main/webapp/WEB-INF/views/simple-page.jsp
new file mode 100644 (file)
index 0000000..194cac5
--- /dev/null
@@ -0,0 +1,15 @@
+<%@page contentType="text/html" pageEncoding="UTF-8" session="false" buffer="1kb" %>
+<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+
+<html>
+  <head>
+    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
+    <title>Simple Page</title>
+    <link rel="stylesheet" type="text/css" media="all" href="/default.css">
+  </head>
+  <body>
+    <h1>Hello World!</h1>
+    <p>This is a really simple page...</p>
+    <p>This version of a really simple page was delivered via SPRING!</p>
+  </body>
+</html>
index 6e004b8..64cdaf7 100644 (file)
@@ -4,15 +4,22 @@
          xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
 
   <!-- Context Configuration locations for Spring XML files -->
+
   <context-param>
     <param-name>contextConfigLocation</param-name>
     <param-value>classpath:/config.xml</param-value>
   </context-param>
 
+
+  <!-- Listener-Definitions -->
+
   <listener>
     <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
   </listener>
 
+
+  <!-- Filter-Definitions -->
+
   <filter>
     <filter-name>accelerator</filter-name>
     <filter-class>de.halbekunst.juplo.cachecontrol.AcceleratorFilter</filter-class>
@@ -23,6 +30,9 @@
     <filter-class>de.halbekunst.juplo.test.LoggingHttpServletResponseFilter</filter-class>
   </filter>
 
+
+  <!-- Filter-Mappings -->
+
   <filter-mapping>
     <filter-name>logger</filter-name>
     <url-pattern>*.jsp</url-pattern>
     <filter-name>accelerator</filter-name>
     <url-pattern>/test-servlet</url-pattern>
   </filter-mapping>
+  <filter-mapping>
+    <filter-name>accelerator</filter-name>
+    <url-pattern>/spring/*</url-pattern>
+  </filter-mapping>
+
+
+  <!-- Servlet-Definitions -->
 
   <servlet>
     <servlet-name>test-servlet</servlet-name>
     <servlet-class>de.halbekunst.juplo.test.TestServlet</servlet-class>
   </servlet>
 
+  <servlet>
+    <servlet-name>dispatcher-servlet</servlet-name>
+    <servlet-class>org.springframework.web.servlet.DispatcherServlet</servlet-class>
+    <init-param>
+      <param-name>contextConfigLocation</param-name>
+      <param-value>
+      </param-value>
+    </init-param>
+    <load-on-startup>1</load-on-startup>
+  </servlet>
+
+
+  <!-- Servlet-Mappings -->
+
   <servlet-mapping>
     <servlet-name>test-servlet</servlet-name>
     <url-pattern>/test-servlet</url-pattern>
   </servlet-mapping>
 
+  <servlet-mapping>
+    <servlet-name>dispatcher-servlet</servlet-name>
+    <url-pattern>/spring/*</url-pattern>
+  </servlet-mapping>
+
 </web-app>