From 5982d6d4b85931e3fa24574cdb5db9f509fe482a Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 10 Jun 2012 19:35:38 +0200 Subject: [PATCH] WIP: Examples in Unterverzeichnisse aufgeteilt --- examples/jsp/catalog.xml | 1 + examples/jsp/src/main/resources/config.xml | 12 --- .../src/main/webapp/{index.jsp => index.html} | 10 +- .../jsp/src/main/webapp/page-with-forward.jsp | 2 +- examples/jsp/src/main/webapp/simple-page.jsp | 13 +++ examples/servlet/jetty.sh | 11 +++ examples/servlet/pom.xml | 17 ++++ .../servlet/src/main/resources/config.xml | 41 ++++++++ examples/servlet/src/main/resources/log4j.xml | 21 +++++ .../servlet/src/main/webapp/WEB-INF/web.xml | 94 +++++++++++++++++++ examples/servlet/src/main/webapp/index.html | 27 ++++++ .../examples/jsp/ServletTest.java | 28 ++++++ examples/servlet/tomcat.sh | 11 +++ 13 files changed, 269 insertions(+), 19 deletions(-) rename examples/jsp/src/main/webapp/{index.jsp => index.html} (56%) create mode 100644 examples/jsp/src/main/webapp/simple-page.jsp create mode 100755 examples/servlet/jetty.sh create mode 100644 examples/servlet/pom.xml create mode 100644 examples/servlet/src/main/resources/config.xml create mode 100644 examples/servlet/src/main/resources/log4j.xml create mode 100644 examples/servlet/src/main/webapp/WEB-INF/web.xml create mode 100644 examples/servlet/src/main/webapp/index.html create mode 100644 examples/servlet/src/test/java/de/halbekunst/cachecontrol/examples/jsp/ServletTest.java create mode 100755 examples/servlet/tomcat.sh diff --git a/examples/jsp/catalog.xml b/examples/jsp/catalog.xml index 218f47c2..94e80903 100644 --- a/examples/jsp/catalog.xml +++ b/examples/jsp/catalog.xml @@ -1,4 +1,5 @@ + \ No newline at end of file diff --git a/examples/jsp/src/main/resources/config.xml b/examples/jsp/src/main/resources/config.xml index b7a4892e..e414ce93 100644 --- a/examples/jsp/src/main/resources/config.xml +++ b/examples/jsp/src/main/resources/config.xml @@ -26,16 +26,4 @@ - - - - - - - - - - - - diff --git a/examples/jsp/src/main/webapp/index.jsp b/examples/jsp/src/main/webapp/index.html similarity index 56% rename from examples/jsp/src/main/webapp/index.jsp rename to examples/jsp/src/main/webapp/index.html index 742231c3..1f4b0eb5 100644 --- a/examples/jsp/src/main/webapp/index.jsp +++ b/examples/jsp/src/main/webapp/index.html @@ -1,17 +1,15 @@ -<%@page contentType="text/html" pageEncoding="UTF-8" session="false" buffer="1kb" %> - Simple Page + JSP Examples + -

Simple Page

-

This page is a simple jsp-page

-

At the same time, it gives an overview over all tests...

+

JSP Examples

diff --git a/examples/jsp/src/main/webapp/page-with-forward.jsp b/examples/jsp/src/main/webapp/page-with-forward.jsp index da8bda0e..35e49058 100644 --- a/examples/jsp/src/main/webapp/page-with-forward.jsp +++ b/examples/jsp/src/main/webapp/page-with-forward.jsp @@ -9,6 +9,6 @@

Hello World!

This should not be seen, because the page is forwardes to /simple-page.jsp

- + diff --git a/examples/jsp/src/main/webapp/simple-page.jsp b/examples/jsp/src/main/webapp/simple-page.jsp new file mode 100644 index 00000000..99d92d73 --- /dev/null +++ b/examples/jsp/src/main/webapp/simple-page.jsp @@ -0,0 +1,13 @@ +<%@page contentType="text/html" pageEncoding="UTF-8" session="false" buffer="1kb" %> + + + + + + Simple Page + + +

Simple Page

+

This page is a simple jsp-page

+ + diff --git a/examples/servlet/jetty.sh b/examples/servlet/jetty.sh new file mode 100755 index 00000000..4950796b --- /dev/null +++ b/examples/servlet/jetty.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# + +# OutOfMemoryException beim "mvn jetty:run" umgehen und +# Parameter zum nachträglichen anhängen eines Debuggers +# setzen +export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m -XX:-UseGCOverheadLimit -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n" + +rm -v src/main/webapp/WEB-INF/lib/juplo* + +mvn jetty:run diff --git a/examples/servlet/pom.xml b/examples/servlet/pom.xml new file mode 100644 index 00000000..313fe7c1 --- /dev/null +++ b/examples/servlet/pom.xml @@ -0,0 +1,17 @@ + + + + 4.0.0 + + + de.halbekunst + juplo-examples + 2.0-SNAPSHOT + + + juplo-examples-servlet + war + Juplo - Examples: Servlet + + diff --git a/examples/servlet/src/main/resources/config.xml b/examples/servlet/src/main/resources/config.xml new file mode 100644 index 00000000..b7a4892e --- /dev/null +++ b/examples/servlet/src/main/resources/config.xml @@ -0,0 +1,41 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/servlet/src/main/resources/log4j.xml b/examples/servlet/src/main/resources/log4j.xml new file mode 100644 index 00000000..d3414bdb --- /dev/null +++ b/examples/servlet/src/main/resources/log4j.xml @@ -0,0 +1,21 @@ + + + + + + + + + + + + + + + + + + + + + diff --git a/examples/servlet/src/main/webapp/WEB-INF/web.xml b/examples/servlet/src/main/webapp/WEB-INF/web.xml new file mode 100644 index 00000000..64cdaf70 --- /dev/null +++ b/examples/servlet/src/main/webapp/WEB-INF/web.xml @@ -0,0 +1,94 @@ + + + + + + + contextConfigLocation + classpath:/config.xml + + + + + + + org.springframework.web.context.ContextLoaderListener + + + + + + + accelerator + de.halbekunst.juplo.cachecontrol.AcceleratorFilter + + + + logger + de.halbekunst.juplo.test.LoggingHttpServletResponseFilter + + + + + + + logger + *.jsp + + + + accelerator + *.html + + + accelerator + *.jsp + + + accelerator + *.css + + + accelerator + /test-servlet + + + accelerator + /spring/* + + + + + + + test-servlet + de.halbekunst.juplo.test.TestServlet + + + + dispatcher-servlet + org.springframework.web.servlet.DispatcherServlet + + contextConfigLocation + + + + 1 + + + + + + + test-servlet + /test-servlet + + + + dispatcher-servlet + /spring/* + + + diff --git a/examples/servlet/src/main/webapp/index.html b/examples/servlet/src/main/webapp/index.html new file mode 100644 index 00000000..d7f24a1a --- /dev/null +++ b/examples/servlet/src/main/webapp/index.html @@ -0,0 +1,27 @@ + + + + + + Servlet Examples + + + +

Servlet Examples

+

This page is a static HTML-page

+ + + diff --git a/examples/servlet/src/test/java/de/halbekunst/cachecontrol/examples/jsp/ServletTest.java b/examples/servlet/src/test/java/de/halbekunst/cachecontrol/examples/jsp/ServletTest.java new file mode 100644 index 00000000..f942c5bb --- /dev/null +++ b/examples/servlet/src/test/java/de/halbekunst/cachecontrol/examples/jsp/ServletTest.java @@ -0,0 +1,28 @@ +package de.halbekunst.cachecontrol.examples.jsp; + +import de.halbekunst.juplo.test.HttpTestCase; +import org.junit.Test; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * + * @author kai + */ +public class ServletTest extends HttpTestCase { + + private static final Logger log = LoggerFactory.getLogger(ServletTest.class); + + + public ServletTest() { + super("src/main/webapp/WEB-INF/web.xml"); + } + + + @Test + public void test() throws Exception { +// WebResponse response = executeRequest("http://localhost:8080/simple-page.jsp"); +// log.info("Title:\t\t{}", response.getTitle()); +// log.debug("Text:\t\t{}", response.getText()); + } +} diff --git a/examples/servlet/tomcat.sh b/examples/servlet/tomcat.sh new file mode 100755 index 00000000..4378a128 --- /dev/null +++ b/examples/servlet/tomcat.sh @@ -0,0 +1,11 @@ +#!/bin/bash +# + +# OutOfMemoryException beim "mvn jetty:run" umgehen und +# Parameter zum nachträglichen anhängen eines Debuggers +# setzen +export MAVEN_OPTS="-Xmx512m -XX:MaxPermSize=256m -XX:-UseGCOverheadLimit -Xdebug -Xnoagent -Djava.compiler=NONE -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n" + +rm -v src/main/webapp/WEB-INF/lib/juplo* + +mvn tomcat:run-war -- 2.20.1