diff --git a/appengine/helloworld/pom.xml b/appengine/helloworld/pom.xml new file mode 100644 index 00000000000..4f994c0ed39 --- /dev/null +++ b/appengine/helloworld/pom.xml @@ -0,0 +1,64 @@ + + + + 4.0.0 + war + 1.0-SNAPSHOT + com.example.appengine.gettingstartedjava + helloworld + + + javax.servlet + javax.servlet-api + 3.1.0 + jar + provided + + + + + ${project.build.directory}/${project.build.finalName}/WEB-INF/classes + + + org.apache.maven.plugins + maven-war-plugin + 2.6 + + false + + + + org.apache.maven.plugins + 3.3 + maven-compiler-plugin + + 1.7 + 1.7 + + + + com.google.appengine + gcloud-maven-plugin + 2.0.9.84.v20151031 + + true + + + + + diff --git a/appengine/helloworld/src/main/java/com/example/appengine/gettingstartedjava/helloworld/HelloServlet.java b/appengine/helloworld/src/main/java/com/example/appengine/gettingstartedjava/helloworld/HelloServlet.java new file mode 100644 index 00000000000..6a3b3dcb4ec --- /dev/null +++ b/appengine/helloworld/src/main/java/com/example/appengine/gettingstartedjava/helloworld/HelloServlet.java @@ -0,0 +1,39 @@ +/** + * Copyright 2015 Google Inc. All Rights Reserved. + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ + +package com.example.appengine.gettingstartedjava.helloworld; + +import java.io.IOException; +import java.io.PrintWriter; + +import javax.servlet.annotation.WebServlet; +import javax.servlet.http.HttpServlet; +import javax.servlet.http.HttpServletRequest; +import javax.servlet.http.HttpServletResponse; + +// [START example] +@WebServlet(name = "helloworld", urlPatterns = { "/*" }) +public class HelloServlet extends HttpServlet { + + private static final long serialVersionUID = 1L; + + @Override + public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException { + PrintWriter out = resp.getWriter(); + out.println("Hello, world"); + } +} +// [END example] diff --git a/appengine/helloworld/src/main/webapp/WEB-INF/appengine-web.xml b/appengine/helloworld/src/main/webapp/WEB-INF/appengine-web.xml new file mode 100644 index 00000000000..1fe28a4f9c5 --- /dev/null +++ b/appengine/helloworld/src/main/webapp/WEB-INF/appengine-web.xml @@ -0,0 +1,8 @@ + + + true + + + + +