Permalink
Browse files

initial commit

  • Loading branch information...
0 parents commit 6a7360ce3be7ce9327dd71b84180b9a58aa7f32a @jamesward committed Jul 18, 2011
Showing with 104 additions and 0 deletions.
  1. +1 −0 .gitignore
  2. +36 −0 pom.xml
  3. +22 −0 src/main/java/com/jamesward/HelloServlet.java
  4. +31 −0 src/main/java/com/jamesward/Main.java
  5. +14 −0 src/main/webapp/WEB-INF/web.xml
@@ -0,0 +1 @@
+target
36 pom.xml
@@ -0,0 +1,36 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+
+ <modelVersion>4.0.0</modelVersion>
+ <groupId>com.jamesward</groupId>
+ <version>1.0-SNAPSHOT</version>
+ <name>warless_java_web_app</name>
+ <artifactId>warless_java_web_app</artifactId>
+ <packaging>jar</packaging>
+
+ <properties>
+ <jettyVersion>7.3.1.v20110307</jettyVersion>
+ </properties>
+
+ <dependencies>
+
+ <dependency>
+ <groupId>org.eclipse.jetty</groupId>
+ <artifactId>jetty-webapp</artifactId>
+ <version>${jettyVersion}</version>
+ </dependency>
+ </dependencies>
+
+ <build>
+ <plugins>
+ <plugin>
+ <groupId>org.codehaus.mojo</groupId>
+ <artifactId>exec-maven-plugin</artifactId>
+ <version>1.2</version>
+ <configuration>
+ <mainClass>com.jamesward.Main</mainClass>
+ </configuration>
+ </plugin>
+ </plugins>
+ </build>
+</project>
@@ -0,0 +1,22 @@
+package com.jamesward;
+
+import java.io.IOException;
+import java.io.PrintWriter;
+
+import javax.servlet.RequestDispatcher;
+import javax.servlet.ServletException;
+import javax.servlet.http.*;
+
+public class HelloServlet extends HttpServlet
+{
+
+
+ @Override
+ protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException
+ {
+ PrintWriter out = resp.getWriter();
+ out.println("hello, world");
+ out.close();
+ }
+
+}
@@ -0,0 +1,31 @@
+package com.jamesward;
+
+import org.eclipse.jetty.server.Server;
+import org.eclipse.jetty.webapp.WebAppContext;
+
+public class Main
+{
+
+ /**
+ * @param args
+ */
+ public static void main(String[] args) throws Exception
+ {
+ String webappDirLocation = "src/main/webapp/";
+
+ Server server = new Server(8080);
+ WebAppContext root = new WebAppContext();
+
+ root.setContextPath("/");
+ root.setDescriptor(webappDirLocation + "/WEB-INF/web.xml");
+ root.setResourceBase(webappDirLocation);
+
+ root.setParentLoaderPriority(true);
+
+ server.setHandler(root);
+
+ server.start();
+ server.join();
+ }
+
+}
@@ -0,0 +1,14 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+ xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd"
+ version="2.5">
+ <servlet>
+ <servlet-name>HelloServlet</servlet-name>
+ <servlet-class>com.jamesward.HelloServlet</servlet-class>
+ </servlet>
+ <servlet-mapping>
+ <servlet-name>HelloServlet</servlet-name>
+ <url-pattern>/</url-pattern>
+ </servlet-mapping>
+</web-app>

0 comments on commit 6a7360c

Please sign in to comment.