Juplo-Cachecontrol-Filter konfiguriert
authorKai Moritz <kai@coolibri.de>
Thu, 8 Mar 2012 23:08:49 +0000 (00:08 +0100)
committerKai Moritz <kai@coolibri.de>
Thu, 2 Aug 2012 07:03:26 +0000 (09:03 +0200)
cachecontrol-example-jsp/pom.xml
cachecontrol-example-jsp/src/main/resources/config.xml [new file with mode: 0644]
cachecontrol-example-jsp/src/main/resources/log4j.xml
cachecontrol-example-jsp/src/main/webapp/WEB-INF/web.xml

index 16cc163..1b78cb5 100644 (file)
 
   <dependencies>
 
+    <!-- Juplo -->
+    <dependency>
+      <groupId>${pom.parent.groupId}</groupId>
+      <artifactId>${pom.parent.artifactId}-cachecontrol</artifactId>
+      <version>${pom.parent.version}</version>
+      <scope>runtime</scope>
+    </dependency>
+
     <!-- JSP-Stuff... -->
     <dependency>
       <groupId>javax.servlet</groupId>
       <scope>runtime</scope>
     </dependency>
 
+    <!--  Spring -->
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-webmvc</artifactId>
+      <version>${springframework.version}</version>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-context</artifactId>
+      <version>${springframework.version}</version>
+      <scope>runtime</scope>
+      <exclusions>
+        <!-- Exclude Commons Logging in favor of SLF4j -->
+        <exclusion>
+          <groupId>commons-logging</groupId>
+          <artifactId>commons-logging</artifactId>
+        </exclusion>
+      </exclusions>
+    </dependency>
+    <dependency>
+      <groupId>org.springframework</groupId>
+      <artifactId>spring-aspects</artifactId>
+      <version>${springframework.version}</version>
+      <scope>runtime</scope>
+    </dependency>
+    <dependency>
+      <groupId>org.aspectj</groupId>
+      <artifactId>aspectjrt</artifactId>
+      <version>${aspectj.version}</version>
+      <scope>runtime</scope>
+    </dependency>
+
     <!-- Logging -->
     <dependency>
       <groupId>org.slf4j</groupId>
@@ -32,6 +73,7 @@
       <scope>runtime</scope>
     </dependency>
 
+
     <!-- Test -->
     <dependency>
       <groupId>${pom.parent.groupId}</groupId>
diff --git a/cachecontrol-example-jsp/src/main/resources/config.xml b/cachecontrol-example-jsp/src/main/resources/config.xml
new file mode 100644 (file)
index 0000000..951402f
--- /dev/null
@@ -0,0 +1,33 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<beans xmlns="http://www.springframework.org/schema/beans"
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xmlns:context="http://www.springframework.org/schema/context"
+       xsi:schemaLocation="
+           http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans-3.0.xsd
+           http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context-3.0.xsd">
+
+  <!-- Activates the AspectJ-Weaver -->
+  <context:component-scan base-package="de.halbekunst"/>
+  <context:spring-configured/>
+
+  <bean id="buffer" class="java.lang.Integer">
+    <constructor-arg value="1024"/>
+  </bean>
+
+  <bean id="eTag" class="java.lang.String">
+    <constructor-arg value="Hallo Welt!"/>
+  </bean>
+
+  <bean id="weak" class="java.lang.Boolean">
+    <constructor-arg value="true"/>
+  </bean>
+
+  <bean id="lastModified" class="java.lang.Long">
+    <constructor-arg value="0"/>
+  </bean>
+
+  <bean id="cacheSeconds" class="java.lang.Integer">
+    <constructor-arg value="3600"/>
+  </bean>
+
+</beans>
index 91fb330..d3414bd 100644 (file)
@@ -14,7 +14,7 @@
   </logger>
 
   <root>
-    <level value="DEBUG"/>
+    <level value="info"/>
     <appender-ref ref="CONSOLE"/>
   </root>
 
index 0143a84..3ca24fa 100644 (file)
@@ -3,4 +3,24 @@
          xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
          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>
+    <listener-class>org.springframework.web.context.ContextLoaderListener</listener-class>
+  </listener>
+
+  <filter>
+    <filter-name>accelerator</filter-name>
+    <filter-class>de.halbekunst.juplo.cachecontrol.AcceleratorFilter</filter-class>
+  </filter>
+
+  <filter-mapping>
+    <filter-name>accelerator</filter-name>
+    <url-pattern>*.jsp</url-pattern>
+  </filter-mapping>
+
 </web-app>