Skip to content

Commit aa25088

Browse files
committed
Merge pull request GoogleCloudPlatform#40 from GoogleCloudPlatform/helloworld
Add appengine helloworld sample
2 parents 146434a + cc5e59f commit aa25088

File tree

3 files changed

+111
-0
lines changed

3 files changed

+111
-0
lines changed

appengine/helloworld/pom.xml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
<?xml version="1.0" encoding="UTF-8"?>
2+
<!--
3+
Copyright 2015 Google Inc. All Rights Reserved.
4+
5+
Licensed under the Apache License, Version 2.0 (the "License");
6+
you may not use this file except in compliance with the License.
7+
You may obtain a copy of the License at
8+
9+
http://www.apache.org/licenses/LICENSE-2.0
10+
11+
Unless required by applicable law or agreed to in writing, software
12+
distributed under the License is distributed on an "AS IS" BASIS,
13+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14+
See the License for the specific language governing permissions and
15+
limitations under the License.
16+
-->
17+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
18+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
19+
<modelVersion>4.0.0</modelVersion>
20+
<packaging>war</packaging>
21+
<version>1.0-SNAPSHOT</version>
22+
<groupId>com.example.appengine.gettingstartedjava</groupId>
23+
<artifactId>helloworld</artifactId>
24+
<dependencies>
25+
<dependency>
26+
<groupId>javax.servlet</groupId>
27+
<artifactId>javax.servlet-api</artifactId>
28+
<version>3.1.0</version>
29+
<type>jar</type>
30+
<scope>provided</scope>
31+
</dependency>
32+
</dependencies>
33+
<build>
34+
<!-- for hot reload of the web application -->
35+
<outputDirectory>${project.build.directory}/${project.build.finalName}/WEB-INF/classes</outputDirectory>
36+
<plugins>
37+
<plugin>
38+
<groupId>org.apache.maven.plugins</groupId>
39+
<artifactId>maven-war-plugin</artifactId>
40+
<version>2.6</version>
41+
<configuration>
42+
<failOnMissingWebXml>false</failOnMissingWebXml>
43+
</configuration>
44+
</plugin>
45+
<plugin>
46+
<groupId>org.apache.maven.plugins</groupId>
47+
<version>3.3</version>
48+
<artifactId>maven-compiler-plugin</artifactId>
49+
<configuration>
50+
<source>1.7</source>
51+
<target>1.7</target>
52+
</configuration>
53+
</plugin>
54+
<plugin>
55+
<groupId>com.google.appengine</groupId>
56+
<artifactId>gcloud-maven-plugin</artifactId>
57+
<version>2.0.9.84.v20151031</version>
58+
<configuration>
59+
<set_default>true</set_default>
60+
</configuration>
61+
</plugin>
62+
</plugins>
63+
</build>
64+
</project>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
/**
2+
* Copyright 2015 Google Inc. All Rights Reserved.
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.example.appengine.gettingstartedjava.helloworld;
18+
19+
import java.io.IOException;
20+
import java.io.PrintWriter;
21+
22+
import javax.servlet.annotation.WebServlet;
23+
import javax.servlet.http.HttpServlet;
24+
import javax.servlet.http.HttpServletRequest;
25+
import javax.servlet.http.HttpServletResponse;
26+
27+
// [START example]
28+
@WebServlet(name = "helloworld", urlPatterns = { "/*" })
29+
public class HelloServlet extends HttpServlet {
30+
31+
private static final long serialVersionUID = 1L;
32+
33+
@Override
34+
public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOException {
35+
PrintWriter out = resp.getWriter();
36+
out.println("Hello, world");
37+
}
38+
}
39+
// [END example]
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<appengine-web-app xmlns="http://appengine.google.com/ns/1.0">
3+
<threadsafe>true</threadsafe>
4+
<!-- TODO remove beta-settings -->
5+
<beta-settings>
6+
<setting name="java_quickstart" value="true" />
7+
</beta-settings>
8+
</appengine-web-app>

0 commit comments

Comments
 (0)