From 699b451675830da041d09a6e32045772788ad66e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Kjetil=20=C3=98rbekk?= Date: Thu, 2 Sep 2010 00:34:33 -0400 Subject: Framework for Lino Quotes --- build.xml | 130 +++++++++++++++++++++++++++++ src/META-INF/jdoconfig.xml | 14 ++++ src/WEB-INF/appengine-web.xml | 4 + src/WEB-INF/web.xml | 32 +++++++ src/log4j.properties | 24 ++++++ src/logging.properties | 27 ++++++ src/lq/Redirect.java | 23 +++++ src/lq/ViewQuotes.java | 14 ++++ src/org/example/HelloAppEngineServlet.java | 12 +++ 9 files changed, 280 insertions(+) create mode 100644 build.xml create mode 100644 src/META-INF/jdoconfig.xml create mode 100644 src/WEB-INF/appengine-web.xml create mode 100644 src/WEB-INF/web.xml create mode 100644 src/log4j.properties create mode 100644 src/logging.properties create mode 100644 src/lq/Redirect.java create mode 100644 src/lq/ViewQuotes.java create mode 100644 src/org/example/HelloAppEngineServlet.java diff --git a/build.xml b/build.xml new file mode 100644 index 0000000..c526843 --- /dev/null +++ b/build.xml @@ -0,0 +1,130 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/META-INF/jdoconfig.xml b/src/META-INF/jdoconfig.xml new file mode 100644 index 0000000..ae76ee7 --- /dev/null +++ b/src/META-INF/jdoconfig.xml @@ -0,0 +1,14 @@ + + + + + + + + + + + + diff --git a/src/WEB-INF/appengine-web.xml b/src/WEB-INF/appengine-web.xml new file mode 100644 index 0000000..d61873a --- /dev/null +++ b/src/WEB-INF/appengine-web.xml @@ -0,0 +1,4 @@ + + linoquotes + 1 + diff --git a/src/WEB-INF/web.xml b/src/WEB-INF/web.xml new file mode 100644 index 0000000..067332b --- /dev/null +++ b/src/WEB-INF/web.xml @@ -0,0 +1,32 @@ + + + Quotes fra #linux.no på freenode + + + linoquotes + lq.ViewQuotes + + + + linoquotes + /quotes + + + + redirect-to-quotes + lq.Redirect + + destination + /quotes + + + + + redirect-to-quotes + / + + diff --git a/src/log4j.properties b/src/log4j.properties new file mode 100644 index 0000000..2768524 --- /dev/null +++ b/src/log4j.properties @@ -0,0 +1,24 @@ +# This was copied from the SDK's config/user/log4j.properties file. +# +# To use this configuration, deploy it into your application's WEB-INF/classes +# directory. You are also encouraged to edit it as you like. + +# Configure the console as our one appender +log4j.appender.A1=org.apache.log4j.ConsoleAppender +log4j.appender.A1.layout=org.apache.log4j.PatternLayout +log4j.appender.A1.layout.ConversionPattern=%d{HH:mm:ss,SSS} %-5p [%c] - %m%n + +# tighten logging on the DataNucleus Categories +log4j.category.DataNucleus.JDO=WARN, A1 +log4j.category.DataNucleus.Persistence=WARN, A1 +log4j.category.DataNucleus.Cache=WARN, A1 +log4j.category.DataNucleus.MetaData=WARN, A1 +log4j.category.DataNucleus.General=WARN, A1 +log4j.category.DataNucleus.Utility=WARN, A1 +log4j.category.DataNucleus.Transaction=WARN, A1 +log4j.category.DataNucleus.Datastore=WARN, A1 +log4j.category.DataNucleus.ClassLoading=WARN, A1 +log4j.category.DataNucleus.Plugin=WARN, A1 +log4j.category.DataNucleus.ValueGeneration=WARN, A1 +log4j.category.DataNucleus.Enhancer=WARN, A1 +log4j.category.DataNucleus.SchemaTool=WARN, A1 diff --git a/src/logging.properties b/src/logging.properties new file mode 100644 index 0000000..5cf1d10 --- /dev/null +++ b/src/logging.properties @@ -0,0 +1,27 @@ +# This was copied from the SDK's config/user/logging.properties file. +# +# To use this configuration, copy it into your application's WEB-INF +# folder and add the following to your appengine-web.xml: +# +# +# +# +# + +# Set the default logging level for all loggers to WARNING +.level = WARNING + +# Set the default logging level for ORM, specifically, to WARNING +DataNucleus.JDO.level=WARNING +DataNucleus.Persistence.level=WARNING +DataNucleus.Cache.level=WARNING +DataNucleus.MetaData.level=WARNING +DataNucleus.General.level=WARNING +DataNucleus.Utility.level=WARNING +DataNucleus.Transaction.level=WARNING +DataNucleus.Datastore.level=WARNING +DataNucleus.ClassLoading.level=WARNING +DataNucleus.Plugin.level=WARNING +DataNucleus.ValueGeneration.level=WARNING +DataNucleus.Enhancer.level=WARNING +DataNucleus.SchemaTool.level=WARNING diff --git a/src/lq/Redirect.java b/src/lq/Redirect.java new file mode 100644 index 0000000..b3414bb --- /dev/null +++ b/src/lq/Redirect.java @@ -0,0 +1,23 @@ +package lq; + +import java.io.IOException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; +import javax.servlet.ServletConfig; +import javax.servlet.ServletException; + +public class Redirect extends HttpServlet { + private String destination; + + @Override + public void init(ServletConfig config) throws ServletException { + destination = config.getInitParameter("destination"); + } + + @Override + protected void doGet(HttpServletRequest req, HttpServletResponse resp) + throws IOException { + resp.sendRedirect(destination); + } +} diff --git a/src/lq/ViewQuotes.java b/src/lq/ViewQuotes.java new file mode 100644 index 0000000..cc03f51 --- /dev/null +++ b/src/lq/ViewQuotes.java @@ -0,0 +1,14 @@ +package lq; + +import java.io.IOException; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +public class ViewQuotes extends HttpServlet { + public void doGet(HttpServletRequest req, HttpServletResponse resp) + throws IOException { + resp.setContentType("text/plain"); + resp.getWriter().println("Hello, World!"); + } +} diff --git a/src/org/example/HelloAppEngineServlet.java b/src/org/example/HelloAppEngineServlet.java new file mode 100644 index 0000000..9b179fd --- /dev/null +++ b/src/org/example/HelloAppEngineServlet.java @@ -0,0 +1,12 @@ +package org.example; + +import java.io.IOException; +import javax.servlet.http.*; + +public class HelloAppEngineServlet extends HttpServlet { + public void doGet(HttpServletRequest req, HttpServletResponse resp) + throws IOException { + resp.setContentType("text/plain"); + resp.getWriter().println("Hello, world"); + } +} \ No newline at end of file -- cgit v1.2.3