Skip to content

Commit

Permalink
Merge pull request GoogleCloudPlatform#41 from GoogleCloudPlatform/he…
Browse files Browse the repository at this point in the history
…lloworld

Update to conform to appengine java runtime
  • Loading branch information
Shun Fan committed Nov 25, 2015
2 parents aa25088 + bce221c commit 69a28d3
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 25 deletions.
11 changes: 11 additions & 0 deletions appengine/helloworld/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Appengine Helloworld sample for Google App Engine
This sample demonstrates how to deploy an application on Google App Engine
## Setup
1. Update the <application> tag in src/main/webapp/WEB-INF/appengine-web.xml with your project name
1. Update the <version> tag in src/main/webapp/WEB-INF/appengine-web.xml with your version name

## Running locally
$ mvn appengine:devserver

## Deploying
$ mvn appengine:update
21 changes: 5 additions & 16 deletions appengine/helloworld/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ Copyright 2015 Google Inc. All Rights Reserved.
<modelVersion>4.0.0</modelVersion>
<packaging>war</packaging>
<version>1.0-SNAPSHOT</version>
<groupId>com.example.appengine.gettingstartedjava</groupId>
<groupId>com.example.appengine</groupId>
<artifactId>helloworld</artifactId>
<dependencies>
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>javax.servlet-api</artifactId>
<version>3.1.0</version>
<artifactId>servlet-api</artifactId>
<version>2.5</version>
<type>jar</type>
<scope>provided</scope>
</dependency>
Expand All @@ -34,14 +34,6 @@ Copyright 2015 Google Inc. All Rights Reserved.
<!-- for hot reload of the web application -->
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-war-plugin</artifactId>
<version>2.6</version>
<configuration>
<failOnMissingWebXml>false</failOnMissingWebXml>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<version>3.3</version>
Expand All @@ -53,11 +45,8 @@ Copyright 2015 Google Inc. All Rights Reserved.
</plugin>
<plugin>
<groupId>com.google.appengine</groupId>
<artifactId>gcloud-maven-plugin</artifactId>
<version>2.0.9.84.v20151031</version>
<configuration>
<set_default>true</set_default>
</configuration>
<artifactId>appengine-maven-plugin</artifactId>
<version>1.9.28</version>
</plugin>
</plugins>
</build>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,22 +14,19 @@
* limitations under the License.
*/

package com.example.appengine.gettingstartedjava.helloworld;
package com.example.appengine.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 = { "/*" })
@SuppressWarnings("serial")
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();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
<application>YOUR-PROJECT-ID</application>
<version>YOUR-VERSION-ID</version>
<threadsafe>true</threadsafe>
<!-- TODO remove beta-settings -->
<beta-settings>
<setting name="java_quickstart" value="true" />
</beta-settings>
</appengine-web-app>
14 changes: 14 additions & 0 deletions appengine/helloworld/src/main/webapp/WEB-INF/web.xml
Original file line number Diff line number Diff line change
@@ -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>hello</servlet-name>
<servlet-class>com.example.appengine.helloworld.HelloServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>hello</servlet-name>
<url-pattern>/</url-pattern>
</servlet-mapping>
</web-app>

0 comments on commit 69a28d3

Please sign in to comment.