diff --git a/appengine/README.md b/appengine/README.md
index 924ef8d929a..20da9ff1bc3 100644
--- a/appengine/README.md
+++ b/appengine/README.md
@@ -4,6 +4,10 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
diff --git a/appengine/analytics/pom.xml b/appengine/analytics/pom.xml
index 8b44668c4d1..298c4c728cf 100644
--- a/appengine/analytics/pom.xml
+++ b/appengine/analytics/pom.xml
@@ -20,13 +20,15 @@
com.example.appengine
appengine-analytics
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
-
1.7
@@ -37,6 +39,7 @@
com.google.appengine
appengine-api-1.0-sdk
+ 1.9.59
org.apache.httpcomponents
@@ -55,11 +58,10 @@
${project.build.directory}/${project.build.finalName}/WEB-INF/classes
-
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/analytics/src/main/java/com/example/appengine/analytics/AnalyticsServlet.java b/appengine/analytics/src/main/java/com/example/appengine/analytics/AnalyticsServlet.java
index 4fd2d6186b6..49aecad4cdb 100644
--- a/appengine/analytics/src/main/java/com/example/appengine/analytics/AnalyticsServlet.java
+++ b/appengine/analytics/src/main/java/com/example/appengine/analytics/AnalyticsServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,18 +18,15 @@
import com.google.appengine.api.urlfetch.URLFetchService;
import com.google.appengine.api.urlfetch.URLFetchServiceFactory;
-
-import org.apache.http.client.utils.URIBuilder;
-
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.http.client.utils.URIBuilder;
// [START example]
@SuppressWarnings("serial")
diff --git a/appengine/appidentity/README.md b/appengine/appidentity/README.md
index c2bc29020a6..a4abdd19aaa 100644
--- a/appengine/appidentity/README.md
+++ b/appengine/appidentity/README.md
@@ -9,6 +9,9 @@ Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to use the [App Identity API][appid] on [Google App
Engine][ae-docs].
+
+
+
[appid]: https://cloud.google.com/appengine/docs/java/appidentity/
[ae-docs]: https://cloud.google.com/appengine/docs/java/
diff --git a/appengine/appidentity/pom.xml b/appengine/appidentity/pom.xml
index 68bca2aa360..17358c790bb 100644
--- a/appengine/appidentity/pom.xml
+++ b/appengine/appidentity/pom.xml
@@ -20,22 +20,26 @@
com.example.appengine
appengine-appidentity
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
- 1.9.60
+ 1.7
+ 1.7
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.sdk.version}
+ 1.9.59
com.google.guava
@@ -71,19 +75,19 @@
com.google.appengine
appengine-testing
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-api-stubs
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-tools-sdk
- ${appengine.sdk.version}
+ 1.9.59
test
diff --git a/appengine/appidentity/src/main/java/com/example/appengine/appidentity/IdentityServlet.java b/appengine/appidentity/src/main/java/com/example/appengine/appidentity/IdentityServlet.java
index d9d72a704c9..9d076a80be4 100644
--- a/appengine/appidentity/src/main/java/com/example/appengine/appidentity/IdentityServlet.java
+++ b/appengine/appidentity/src/main/java/com/example/appengine/appidentity/IdentityServlet.java
@@ -17,9 +17,7 @@
package com.example.appengine.appidentity;
import com.google.apphosting.api.ApiProxy;
-
import java.io.IOException;
-
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
diff --git a/appengine/appidentity/src/main/java/com/example/appengine/appidentity/SignForAppServlet.java b/appengine/appidentity/src/main/java/com/example/appengine/appidentity/SignForAppServlet.java
index 3a9df0301fe..32effb7ab28 100644
--- a/appengine/appidentity/src/main/java/com/example/appengine/appidentity/SignForAppServlet.java
+++ b/appengine/appidentity/src/main/java/com/example/appengine/appidentity/SignForAppServlet.java
@@ -19,7 +19,6 @@
import com.google.appengine.api.appidentity.AppIdentityService;
import com.google.appengine.api.appidentity.AppIdentityServiceFactory;
import com.google.appengine.api.appidentity.PublicCertificate;
-
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.io.InputStream;
@@ -34,7 +33,6 @@
import java.security.cert.CertificateFactory;
import java.util.Arrays;
import java.util.Collection;
-
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
diff --git a/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortener.java b/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortener.java
index 4ef26aa135a..8e48802cfaa 100644
--- a/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortener.java
+++ b/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortener.java
@@ -19,10 +19,6 @@
import com.google.appengine.api.appidentity.AppIdentityService;
import com.google.appengine.api.appidentity.AppIdentityServiceFactory;
import com.google.common.io.CharStreams;
-
-import org.json.JSONObject;
-import org.json.JSONTokener;
-
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
@@ -30,6 +26,8 @@
import java.net.URL;
import java.nio.charset.StandardCharsets;
import java.util.ArrayList;
+import org.json.JSONObject;
+import org.json.JSONTokener;
@SuppressWarnings("serial")
class UrlShortener {
diff --git a/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortenerServlet.java b/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortenerServlet.java
index 324b8dcd0a1..c80a9fb8ccf 100644
--- a/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortenerServlet.java
+++ b/appengine/appidentity/src/main/java/com/example/appengine/appidentity/UrlShortenerServlet.java
@@ -18,7 +18,6 @@
import java.io.IOException;
import java.io.PrintWriter;
-
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
diff --git a/appengine/appidentity/src/test/java/com/example/appengine/appidentity/IdentityServletTest.java b/appengine/appidentity/src/test/java/com/example/appengine/appidentity/IdentityServletTest.java
index 74041b24cd3..030bf73f788 100644
--- a/appengine/appidentity/src/test/java/com/example/appengine/appidentity/IdentityServletTest.java
+++ b/appengine/appidentity/src/test/java/com/example/appengine/appidentity/IdentityServletTest.java
@@ -20,7 +20,10 @@
import static org.mockito.Mockito.when;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
-
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -29,12 +32,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Unit tests for {@link IdentityServlet}.
*/
diff --git a/appengine/appidentity/src/test/java/com/example/appengine/appidentity/SignForAppServletTest.java b/appengine/appidentity/src/test/java/com/example/appengine/appidentity/SignForAppServletTest.java
index 7cc1fa5411b..00f8feabc18 100644
--- a/appengine/appidentity/src/test/java/com/example/appengine/appidentity/SignForAppServletTest.java
+++ b/appengine/appidentity/src/test/java/com/example/appengine/appidentity/SignForAppServletTest.java
@@ -20,7 +20,10 @@
import static org.mockito.Mockito.when;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
-
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -29,12 +32,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Unit tests for {@link SignForAppServlet}.
*/
diff --git a/appengine/channel/README.md b/appengine/channel/README.md
deleted file mode 100644
index 0c478d5997b..00000000000
--- a/appengine/channel/README.md
+++ /dev/null
@@ -1,5 +0,0 @@
-AppEngine Channel demo
-========
-
-# WARNING - the Channel API has been deprecated. This sample is for historical purposes only.
-
diff --git a/appengine/channel/pom.xml b/appengine/channel/pom.xml
deleted file mode 100644
index f8336e312ab..00000000000
--- a/appengine/channel/pom.xml
+++ /dev/null
@@ -1,108 +0,0 @@
-
-
- 4.0.0
- war
- 1.0-SNAPSHOT
- com.example.appengine
- appengine-channel
-
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
-
-
- 5.1.21
-
-
-
-
-
- com.google.appengine
- appengine-api-1.0-sdk
- ${appengine.sdk.version}
-
-
- javax.servlet
- servlet-api
- 2.5
- jar
- provided
-
-
- org.json
- json
- 20171018
-
-
- com.googlecode.objectify
- objectify
- ${objectify.version}
-
-
-
-
- junit
- junit
- 4.12
- test
-
-
- org.mockito
- mockito-all
- 1.10.19
- test
-
-
- com.google.appengine
- appengine-testing
- ${appengine.sdk.version}
- test
-
-
- com.google.appengine
- appengine-api-stubs
- ${appengine.sdk.version}
- test
-
-
- com.google.appengine
- appengine-tools-sdk
- ${appengine.sdk.version}
- test
-
-
- com.google.truth
- truth
- 0.37
- test
-
-
-
-
- ${project.build.directory}/${project.build.finalName}/WEB-INF/classes
-
-
-
-
- com.google.appengine
- appengine-maven-plugin
- ${appengine.sdk.version}
-
-
-
-
diff --git a/appengine/channel/src/main/java/com/example/appengine/channel/ChannelPresenceServlet.java b/appengine/channel/src/main/java/com/example/appengine/channel/ChannelPresenceServlet.java
deleted file mode 100644
index 0b806cb2d5e..00000000000
--- a/appengine/channel/src/main/java/com/example/appengine/channel/ChannelPresenceServlet.java
+++ /dev/null
@@ -1,41 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * 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.channel;
-
-import com.google.appengine.api.channel.ChannelPresence;
-import com.google.appengine.api.channel.ChannelService;
-import com.google.appengine.api.channel.ChannelServiceFactory;
-
-import java.io.IOException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-public class ChannelPresenceServlet extends HttpServlet {
- @Override
- public void doPost(HttpServletRequest req, HttpServletResponse resp)
- throws IOException {
- //[START channel_presence]
- ChannelService channelService = ChannelServiceFactory.getChannelService();
- ChannelPresence presence = channelService.parsePresence(req);
- //[END channel_presence]
-
- System.out.println("Client ID: " + presence.clientId()
- + ", Connected: " + presence.isConnected());
- resp.setStatus(HttpServletResponse.SC_OK);
- }
-}
diff --git a/appengine/channel/src/main/java/com/example/appengine/channel/Game.java b/appengine/channel/src/main/java/com/example/appengine/channel/Game.java
deleted file mode 100644
index d84ef7247e7..00000000000
--- a/appengine/channel/src/main/java/com/example/appengine/channel/Game.java
+++ /dev/null
@@ -1,182 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * 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.channel;
-
-import com.google.appengine.api.channel.ChannelMessage;
-import com.google.appengine.api.channel.ChannelService;
-import com.google.appengine.api.channel.ChannelServiceFactory;
-import com.googlecode.objectify.annotation.Entity;
-import com.googlecode.objectify.annotation.Id;
-import org.json.JSONObject;
-
-import java.util.HashMap;
-import java.util.Map;
-import java.util.UUID;
-import java.util.regex.Pattern;
-
-@Entity
-public class Game {
- static final Pattern[] XWins =
- {Pattern.compile("XXX......"), Pattern.compile("...XXX..."), Pattern.compile("......XXX"),
- Pattern.compile("X..X..X.."), Pattern.compile(".X..X..X."),
- Pattern.compile("..X..X..X"), Pattern.compile("X...X...X"),
- Pattern.compile("..X.X.X..")};
- static final Pattern[] OWins =
- {Pattern.compile("OOO......"), Pattern.compile("...OOO..."), Pattern.compile("......OOO"),
- Pattern.compile("O..O..O.."), Pattern.compile(".O..O..O."),
- Pattern.compile("..O..O..O"), Pattern.compile("O...O...O"),
- Pattern.compile("..O.O.O..")};
-
- @Id
- public String id;
- private String userX;
- private String userO;
- private String board;
- private Boolean moveX;
- private String winner;
- private String winningBoard;
-
- Game() {
- }
-
- Game(String userX, String userO, String board, boolean moveX) {
- this.id = UUID.randomUUID().toString();
- this.userX = userX;
- this.userO = userO;
- this.board = board;
- this.moveX = moveX;
- }
-
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getUserX() {
- return userX;
- }
-
- public String getUserO() {
- return userO;
- }
-
- public void setUserO(String userO) {
- this.userO = userO;
- }
-
- public String getBoard() {
- return board;
- }
-
- public void setBoard(String board) {
- this.board = board;
- }
-
- public boolean getMoveX() {
- return moveX;
- }
-
- public void setMoveX(boolean moveX) {
- this.moveX = moveX;
- }
-
- public String getMessageString() {
- Map state = new HashMap();
- state.put("userX", userX);
- if (userO == null) {
- state.put("userO", "");
- } else {
- state.put("userO", userO);
- }
- state.put("board", board);
- state.put("moveX", moveX.toString());
- state.put("winner", winner);
- if (winner != null && winner != "") {
- state.put("winningBoard", winningBoard);
- }
- JSONObject message = new JSONObject(state);
- return message.toString();
- }
-
- //[START send_updates]
- public String getChannelKey(String user) {
- return user + "." + id;
- }
-
- private void sendUpdateToUser(String user) {
- if (user != null) {
- ChannelService channelService = ChannelServiceFactory.getChannelService();
- String channelKey = getChannelKey(user);
- channelService.sendMessage(new ChannelMessage(channelKey, getMessageString()));
- }
- }
-
- public void sendUpdateToClients() {
- sendUpdateToUser(userX);
- sendUpdateToUser(userO);
- }
- //[END send_updates]
-
- public void checkWin() {
- final Pattern[] wins;
- if (moveX) {
- wins = XWins;
- } else {
- wins = OWins;
- }
-
- for (Pattern winPattern : wins) {
- if (winPattern.matcher(board).matches()) {
- if (moveX) {
- winner = userX;
- } else {
- winner = userO;
- }
- winningBoard = winPattern.toString();
- }
- }
- }
-
- //[START make_move]
- public boolean makeMove(int position, String user) {
- String currentMovePlayer;
- char value;
- if (getMoveX()) {
- value = 'X';
- currentMovePlayer = getUserX();
- } else {
- value = 'O';
- currentMovePlayer = getUserO();
- }
-
- if (currentMovePlayer.equals(user)) {
- char[] boardBytes = getBoard().toCharArray();
- boardBytes[position] = value;
- setBoard(new String(boardBytes));
- checkWin();
- setMoveX(!getMoveX());
- sendUpdateToClients();
- return true;
- }
-
- return false;
- }
- //[END make_move]
-}
diff --git a/appengine/channel/src/main/java/com/example/appengine/channel/GetTokenServlet.java b/appengine/channel/src/main/java/com/example/appengine/channel/GetTokenServlet.java
deleted file mode 100644
index c0fb1ac0b2a..00000000000
--- a/appengine/channel/src/main/java/com/example/appengine/channel/GetTokenServlet.java
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * 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.channel;
-
-import com.google.appengine.api.channel.ChannelService;
-import com.google.appengine.api.channel.ChannelServiceFactory;
-import com.google.appengine.api.users.UserService;
-import com.google.appengine.api.users.UserServiceFactory;
-import com.googlecode.objectify.Objectify;
-import com.googlecode.objectify.ObjectifyService;
-
-import java.io.IOException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-public class GetTokenServlet extends HttpServlet {
- @Override
- public void doPost(HttpServletRequest req, HttpServletResponse resp)
- throws IOException {
- UserService userService = UserServiceFactory.getUserService();
- String gameId = req.getParameter("gamekey");
- Objectify ofy = ObjectifyService.ofy();
- Game game = ofy.load().type(Game.class).id(gameId).safe();
-
- String currentUserId = userService.getCurrentUser().getUserId();
- if (currentUserId.equals(game.getUserX()) || currentUserId.equals(game.getUserO())) {
- String channelKey = game.getChannelKey(currentUserId);
- ChannelService channelService = ChannelServiceFactory.getChannelService();
- resp.setContentType("text/plain");
- resp.getWriter().println(channelService.createChannel(channelKey));
- return;
- }
- resp.setStatus(HttpServletResponse.SC_FORBIDDEN);
- }
-}
diff --git a/appengine/channel/src/main/java/com/example/appengine/channel/MoveServlet.java b/appengine/channel/src/main/java/com/example/appengine/channel/MoveServlet.java
deleted file mode 100644
index e3aa47ab4dd..00000000000
--- a/appengine/channel/src/main/java/com/example/appengine/channel/MoveServlet.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * 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.channel;
-
-import com.google.appengine.api.users.UserService;
-import com.google.appengine.api.users.UserServiceFactory;
-import com.googlecode.objectify.Objectify;
-import com.googlecode.objectify.ObjectifyService;
-
-import java.io.IOException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-public class MoveServlet extends HttpServlet {
- @Override
- public void doPost(HttpServletRequest req, HttpServletResponse resp)
- throws IOException {
- UserService userService = UserServiceFactory.getUserService();
- String gameId = req.getParameter("gamekey");
- int piece = new Integer(req.getParameter("i"));
- Objectify ofy = ObjectifyService.ofy();
- Game game = ofy.load().type(Game.class).id(gameId).safe();
-
- String currentUserId = userService.getCurrentUser().getUserId();
- if (!game.makeMove(piece, currentUserId)) {
- resp.setStatus(HttpServletResponse.SC_FORBIDDEN);
- } else {
- ofy.save().entity(game).now();
- }
- }
-}
diff --git a/appengine/channel/src/main/java/com/example/appengine/channel/OfyHelper.java b/appengine/channel/src/main/java/com/example/appengine/channel/OfyHelper.java
deleted file mode 100644
index 8574aa2655c..00000000000
--- a/appengine/channel/src/main/java/com/example/appengine/channel/OfyHelper.java
+++ /dev/null
@@ -1,37 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * 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.channel;
-
-import com.googlecode.objectify.ObjectifyService;
-
-import javax.servlet.ServletContextEvent;
-import javax.servlet.ServletContextListener;
-
-/**
- * OfyHelper, a ServletContextListener, is setup in web.xml to run before a JSP is run. This is
- * required to let JSP's access Ofy.
- **/
-public class OfyHelper implements ServletContextListener {
- public void contextInitialized(ServletContextEvent event) {
- // This will be invoked as part of a warmup request, or the first user request if no warmup
- // request.
- ObjectifyService.register(Game.class);
- }
-
- public void contextDestroyed(ServletContextEvent event) {
- // App Engine does not currently invoke this method.
- }
-}
diff --git a/appengine/channel/src/main/java/com/example/appengine/channel/OpenedServlet.java b/appengine/channel/src/main/java/com/example/appengine/channel/OpenedServlet.java
deleted file mode 100644
index 6e4a2088fe6..00000000000
--- a/appengine/channel/src/main/java/com/example/appengine/channel/OpenedServlet.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * 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.channel;
-
-import com.googlecode.objectify.NotFoundException;
-import com.googlecode.objectify.Objectify;
-import com.googlecode.objectify.ObjectifyService;
-
-import java.io.IOException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-public class OpenedServlet extends HttpServlet {
- @Override
- public void doPost(HttpServletRequest req, HttpServletResponse resp)
- throws IOException {
- String gameId = req.getParameter("gamekey");
- Objectify ofy = ObjectifyService.ofy();
- try {
- Game game = ofy.load().type(Game.class).id(gameId).safe();
- if (gameId != null && req.getUserPrincipal() != null) {
- game.sendUpdateToClients();
- resp.setContentType("text/plain");
- resp.getWriter().println("ok");
- } else {
- resp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
- }
- } catch (NotFoundException e) {
- resp.setStatus(HttpServletResponse.SC_NOT_FOUND);
- }
- }
-}
diff --git a/appengine/channel/src/main/java/com/example/appengine/channel/TicTacToeServlet.java b/appengine/channel/src/main/java/com/example/appengine/channel/TicTacToeServlet.java
deleted file mode 100644
index 83bde707a87..00000000000
--- a/appengine/channel/src/main/java/com/example/appengine/channel/TicTacToeServlet.java
+++ /dev/null
@@ -1,103 +0,0 @@
-/*
- * Copyright 2016 Google Inc.
- *
- * 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.channel;
-
-import com.google.appengine.api.channel.ChannelService;
-import com.google.appengine.api.channel.ChannelServiceFactory;
-import com.google.appengine.api.users.UserService;
-import com.google.appengine.api.users.UserServiceFactory;
-import com.googlecode.objectify.Objectify;
-import com.googlecode.objectify.ObjectifyService;
-
-import java.io.IOException;
-import java.net.URI;
-import java.net.URISyntaxException;
-import javax.servlet.ServletException;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
-@SuppressWarnings("serial")
-public class TicTacToeServlet extends HttpServlet {
- private String getGameUriWithGameParam(HttpServletRequest req, String gameKey)
- throws IOException {
- try {
- String query;
- if (gameKey == null) {
- query = "";
- } else {
- query = "g=" + gameKey;
- }
- URI thisUri = new URI(req.getRequestURL().toString());
- URI uriWithOptionalGameParam =
- new URI(thisUri.getScheme(), thisUri.getUserInfo(), thisUri.getHost(),
- thisUri.getPort(), thisUri.getPath(), query, "");
- return uriWithOptionalGameParam.toString();
- } catch (URISyntaxException e) {
- throw new IOException(e.getMessage(), e);
- }
-
- }
-
- @Override
- public void doGet(HttpServletRequest req, HttpServletResponse resp)
- throws ServletException, IOException {
- final UserService userService = UserServiceFactory.getUserService();
- final URI uriWithOptionalGameParam;
- String gameKey = req.getParameter("g");
- if (userService.getCurrentUser() == null) {
- resp.getWriter().println("Please sign in.
");
-
- return;
- }
-
- Objectify ofy = ObjectifyService.ofy();
- Game game = null;
- String userId = userService.getCurrentUser().getUserId();
- if (gameKey != null) {
- game = ofy.load().type(Game.class).id(gameKey).safe();
- if (game.getUserO() == null && !userId.equals(game.getUserX())) {
- game.setUserO(userId);
- }
- ofy.save().entity(game).now();
- } else {
- game = new Game(userId, null, " ", true);
- ofy.save().entity(game).now();
- gameKey = game.getId();
- }
-
- //[START channel_service]
- ChannelService channelService = ChannelServiceFactory.getChannelService();
-
- // The 'Game' object exposes a method which creates a unique string based on the game's key
- // and the user's id.
- String token = channelService.createChannel(game.getChannelKey(userId));
-
- //[END channel_service]
-
- ofy.save().entity(game).now();
-
- req.setAttribute("game_key", gameKey);
- req.setAttribute("me", userId);
- req.setAttribute("token", token);
- req.setAttribute("initial_message", game.getMessageString());
- req.setAttribute("game_link", getGameUriWithGameParam(req, gameKey));
- getServletContext().getRequestDispatcher("/WEB-INF/view/index.jsp").forward(req, resp);
- }
-}
diff --git a/appengine/channel/src/main/webapp/WEB-INF/appengine-web.xml b/appengine/channel/src/main/webapp/WEB-INF/appengine-web.xml
deleted file mode 100644
index 93d1771b576..00000000000
--- a/appengine/channel/src/main/webapp/WEB-INF/appengine-web.xml
+++ /dev/null
@@ -1,33 +0,0 @@
-
-
-
- YOUR-PROJECTID-HERE
- 1
- true
-
-
-
-
-
-
-
-
- channel_presence
-
-
-
-
diff --git a/appengine/channel/src/main/webapp/WEB-INF/logging.properties b/appengine/channel/src/main/webapp/WEB-INF/logging.properties
deleted file mode 100644
index 9b29028efa7..00000000000
--- a/appengine/channel/src/main/webapp/WEB-INF/logging.properties
+++ /dev/null
@@ -1,27 +0,0 @@
-#
-# Copyright 2016 Google Inc.
-#
-# 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.
-#
-# A default java.util.logging configuration.
-# (All App Engine logging is through java.util.logging by default).
-#
-# 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
diff --git a/appengine/channel/src/main/webapp/WEB-INF/view/index.jsp b/appengine/channel/src/main/webapp/WEB-INF/view/index.jsp
deleted file mode 100644
index bd045262dc8..00000000000
--- a/appengine/channel/src/main/webapp/WEB-INF/view/index.jsp
+++ /dev/null
@@ -1,276 +0,0 @@
-<%@ page contentType="text/html;charset=UTF-8" language="java" %>
-<%--
- Copyright 2015 Google Inc.
-
- 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.
---%>
-
-
-
-
-
-
-
-
-
-
Channel-based Tic Tac Toe
-
- Waiting for another player to join.
- Send them this link to play:
-
-
-
- Your move! Click a square to place your piece.
-
-
- Waiting for other player to move...
-
-
- You won this game!
-
-
- You lost this game.
-
-
-
-
-
-
diff --git a/appengine/channel/src/main/webapp/WEB-INF/web.xml b/appengine/channel/src/main/webapp/WEB-INF/web.xml
deleted file mode 100644
index 8d1af582346..00000000000
--- a/appengine/channel/src/main/webapp/WEB-INF/web.xml
+++ /dev/null
@@ -1,69 +0,0 @@
-
-
-
-
- TicTacToeServlet
- com.example.appengine.channel.TicTacToeServlet
-
-
- TicTacToeServlet
- /
-
-
- OpenedServlet
- com.example.appengine.channel.OpenedServlet
-
-
- OpenedServlet
- /opened
-
-
- MoveServlet
- com.example.appengine.channel.MoveServlet
-
-
- MoveServlet
- /move
-
-
- ChannelPresenceServlet
- com.example.appengine.channel.ChannelPresenceServlet
-
-
- ChannelPresenceServlet
- /_ah/channel/connected/
-
-
- ChannelPresenceServlet
- /_ah/channel/disconnected/
-
-
-
- ObjectifyFilter
- com.googlecode.objectify.ObjectifyFilter
-
-
- ObjectifyFilter
- /*
-
-
- com.example.appengine.channel.OfyHelper
-
-
diff --git a/appengine/cloudsql/README.md b/appengine/cloudsql/README.md
index c3c1fda12cb..f6238d261e8 100644
--- a/appengine/cloudsql/README.md
+++ b/appengine/cloudsql/README.md
@@ -8,6 +8,9 @@ Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to use [Cloud SQL](https://cloud.google.com/sql/) on Google App Engine
+
+
+
## Setup
Before you can run or deploy the sample, you will need to create a [Cloud SQL instance)](https://cloud.google.com/sql/docs/create-instance)
diff --git a/appengine/cloudsql/pom.xml b/appengine/cloudsql/pom.xml
index 019e67d0afd..d7a706785a6 100644
--- a/appengine/cloudsql/pom.xml
+++ b/appengine/cloudsql/pom.xml
@@ -20,14 +20,17 @@
com.example.appengine
appengine-cloudsql
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
-
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ../..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
+ 1.7
+ 1.7
+
+
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.sdk.version}
+ 1.9.59
javax.servlet
@@ -56,19 +64,19 @@
com.google.appengine
appengine-testing
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-api-stubs
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-tools-sdk
- ${appengine.sdk.version}
+ 1.9.59
test
@@ -83,11 +91,10 @@
${project.build.directory}/${project.build.finalName}/WEB-INF/classes
-
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/datastore/indexes-exploding/src/main/java/com/example/appengine/IndexesServlet.java b/appengine/datastore/indexes-exploding/src/main/java/com/example/appengine/IndexesServlet.java
index 04d4fe018d4..a86287d6907 100644
--- a/appengine/datastore/indexes-exploding/src/main/java/com/example/appengine/IndexesServlet.java
+++ b/appengine/datastore/indexes-exploding/src/main/java/com/example/appengine/IndexesServlet.java
@@ -24,11 +24,9 @@
import com.google.appengine.api.datastore.Query.CompositeFilterOperator;
import com.google.appengine.api.datastore.Query.FilterOperator;
import com.google.appengine.api.datastore.Query.FilterPredicate;
-
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
diff --git a/appengine/datastore/indexes-exploding/src/main/webapp/WEB-INF/web.xml b/appengine/datastore/indexes-exploding/src/main/webapp/WEB-INF/web.xml
index 6af27edbd87..d5c2e47df49 100644
--- a/appengine/datastore/indexes-exploding/src/main/webapp/WEB-INF/web.xml
+++ b/appengine/datastore/indexes-exploding/src/main/webapp/WEB-INF/web.xml
@@ -14,10 +14,10 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
+
indexes-servlet
com.example.appengine.IndexesServlet
diff --git a/appengine/datastore/indexes-exploding/src/test/java/com/example/appengine/IndexesServletTest.java b/appengine/datastore/indexes-exploding/src/test/java/com/example/appengine/IndexesServletTest.java
index ea86f530fef..f026ffb650a 100644
--- a/appengine/datastore/indexes-exploding/src/test/java/com/example/appengine/IndexesServletTest.java
+++ b/appengine/datastore/indexes-exploding/src/test/java/com/example/appengine/IndexesServletTest.java
@@ -24,6 +24,12 @@
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Arrays;
+import java.util.Date;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -32,14 +38,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Arrays;
-import java.util.Date;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Unit tests for {@link IndexesServlet}.
*/
@@ -86,7 +84,9 @@ public void doGet_emptyDatastore_writesNoWidgets() throws Exception {
@Test
public void doGet_repeatedPropertyEntities_writesWidgets() throws Exception {
+ //CHECKSTYLE.OFF: VariableDeclarationUsageDistance - readability
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
+ //CHECKSTYLE.ON: VariableDeclarationUsageDistance
// [START exploding_index_example_3]
Entity widget = new Entity("Widget");
widget.setProperty("x", Arrays.asList(1, 2, 3, 4));
diff --git a/appengine/datastore/indexes-perfect/pom.xml b/appengine/datastore/indexes-perfect/pom.xml
index fd5064e2909..900e36c6552 100644
--- a/appengine/datastore/indexes-perfect/pom.xml
+++ b/appengine/datastore/indexes-perfect/pom.xml
@@ -20,18 +20,26 @@
com.example.appengine
appengine-datastore-indexes-perfect
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ../..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
+ 1.7
+ 1.7
+
+
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.sdk.version}
+ 1.9.59
javax.servlet
@@ -56,19 +64,19 @@
com.google.appengine
appengine-testing
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-api-stubs
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-tools-sdk
- ${appengine.sdk.version}
+ 1.9.59
test
@@ -83,11 +91,10 @@
${project.build.directory}/${project.build.finalName}/WEB-INF/classes
-
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/datastore/indexes-perfect/src/main/java/com/example/appengine/IndexesServlet.java b/appengine/datastore/indexes-perfect/src/main/java/com/example/appengine/IndexesServlet.java
index 5a01f1a53e5..c49cf8c25c5 100644
--- a/appengine/datastore/indexes-perfect/src/main/java/com/example/appengine/IndexesServlet.java
+++ b/appengine/datastore/indexes-perfect/src/main/java/com/example/appengine/IndexesServlet.java
@@ -24,11 +24,9 @@
import com.google.appengine.api.datastore.Query.CompositeFilterOperator;
import com.google.appengine.api.datastore.Query.FilterOperator;
import com.google.appengine.api.datastore.Query.FilterPredicate;
-
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
diff --git a/appengine/datastore/indexes-perfect/src/main/webapp/WEB-INF/web.xml b/appengine/datastore/indexes-perfect/src/main/webapp/WEB-INF/web.xml
index 6af27edbd87..d5c2e47df49 100644
--- a/appengine/datastore/indexes-perfect/src/main/webapp/WEB-INF/web.xml
+++ b/appengine/datastore/indexes-perfect/src/main/webapp/WEB-INF/web.xml
@@ -14,10 +14,10 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
+
indexes-servlet
com.example.appengine.IndexesServlet
diff --git a/appengine/datastore/indexes-perfect/src/test/java/com/example/appengine/IndexesServletTest.java b/appengine/datastore/indexes-perfect/src/test/java/com/example/appengine/IndexesServletTest.java
index d1816a7034d..1accfc64e13 100644
--- a/appengine/datastore/indexes-perfect/src/test/java/com/example/appengine/IndexesServletTest.java
+++ b/appengine/datastore/indexes-perfect/src/test/java/com/example/appengine/IndexesServletTest.java
@@ -21,6 +21,10 @@
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -29,12 +33,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Unit tests for {@link IndexesServlet}.
*/
diff --git a/appengine/datastore/indexes/pom.xml b/appengine/datastore/indexes/pom.xml
index f6a6575cb2c..01f4ee4d978 100644
--- a/appengine/datastore/indexes/pom.xml
+++ b/appengine/datastore/indexes/pom.xml
@@ -20,18 +20,26 @@
com.example.appengine
appengine-datastore-indexes
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ../..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
+ 1.7
+ 1.7
+
+
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.sdk.version}
+ 1.9.59
javax.servlet
@@ -56,19 +64,19 @@
com.google.appengine
appengine-testing
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-api-stubs
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-tools-sdk
- ${appengine.sdk.version}
+ 1.9.59
test
@@ -83,11 +91,10 @@
${project.build.directory}/${project.build.finalName}/WEB-INF/classes
-
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/datastore/indexes/src/main/java/com/example/appengine/IndexesServlet.java b/appengine/datastore/indexes/src/main/java/com/example/appengine/IndexesServlet.java
index 5493ce1f1a9..461e5e78d49 100644
--- a/appengine/datastore/indexes/src/main/java/com/example/appengine/IndexesServlet.java
+++ b/appengine/datastore/indexes/src/main/java/com/example/appengine/IndexesServlet.java
@@ -24,11 +24,9 @@
import com.google.appengine.api.datastore.Query.CompositeFilterOperator;
import com.google.appengine.api.datastore.Query.FilterOperator;
import com.google.appengine.api.datastore.Query.FilterPredicate;
-
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
diff --git a/appengine/datastore/indexes/src/main/webapp/WEB-INF/web.xml b/appengine/datastore/indexes/src/main/webapp/WEB-INF/web.xml
index 6af27edbd87..d5c2e47df49 100644
--- a/appengine/datastore/indexes/src/main/webapp/WEB-INF/web.xml
+++ b/appengine/datastore/indexes/src/main/webapp/WEB-INF/web.xml
@@ -14,10 +14,10 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
+
indexes-servlet
com.example.appengine.IndexesServlet
diff --git a/appengine/datastore/indexes/src/test/java/com/example/appengine/IndexesServletTest.java b/appengine/datastore/indexes/src/test/java/com/example/appengine/IndexesServletTest.java
index 83575239136..3911dde910d 100644
--- a/appengine/datastore/indexes/src/test/java/com/example/appengine/IndexesServletTest.java
+++ b/appengine/datastore/indexes/src/test/java/com/example/appengine/IndexesServletTest.java
@@ -21,6 +21,10 @@
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -29,12 +33,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Unit tests for {@link IndexesServlet}.
*/
diff --git a/appengine/datastore/pom.xml b/appengine/datastore/pom.xml
index a342ca3b265..a17fdbd53af 100644
--- a/appengine/datastore/pom.xml
+++ b/appengine/datastore/pom.xml
@@ -15,105 +15,30 @@
-->
4.0.0
- war
+ pom
1.0-SNAPSHOT
com.example.appengine
appengine-datastore
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
-
-
- com.google.appengine
- appengine-api-1.0-sdk
- ${appengine.sdk.version}
-
+
+ 1.7
+ 1.7
+
-
- javax.servlet
- servlet-api
- 2.5
- provided
-
+
+ indexes
+ indexes-exploding
+ indexes-perfect
+
-
- com.google.auto.value
- auto-value
- 1.5.3
- provided
-
-
- com.google.code.findbugs
- jsr305
- 3.0.2
-
-
-
- com.google.guava
- guava
- 20.0
-
-
-
- joda-time
- joda-time
- 2.9.9
-
-
-
-
- junit
- junit
- 4.12
- test
-
-
- org.mockito
- mockito-all
- 1.10.19
- test
-
-
- com.google.appengine
- appengine-testing
- ${appengine.sdk.version}
- test
-
-
- com.google.appengine
- appengine-api-stubs
- ${appengine.sdk.version}
- test
-
-
- com.google.appengine
- appengine-tools-sdk
- ${appengine.sdk.version}
- test
-
-
- com.google.truth
- truth
- 0.37
- test
-
-
-
-
-
- ${project.build.directory}/${project.build.finalName}/WEB-INF/classes
-
-
-
- com.google.appengine
- appengine-maven-plugin
- ${appengine.sdk.version}
-
-
-
diff --git a/appengine/datastore/src/main/java/com/example/appengine/AbstractGuestbook.java b/appengine/datastore/src/main/java/com/example/appengine/AbstractGuestbook.java
index b87edf7eeba..f3536492d57 100644
--- a/appengine/datastore/src/main/java/com/example/appengine/AbstractGuestbook.java
+++ b/appengine/datastore/src/main/java/com/example/appengine/AbstractGuestbook.java
@@ -17,7 +17,6 @@
package com.example.appengine;
import com.example.time.Clock;
-
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
@@ -25,7 +24,6 @@
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
import com.google.common.collect.ImmutableList;
-
import java.util.Date;
import java.util.List;
diff --git a/appengine/datastore/src/main/java/com/example/appengine/AbstractGuestbookServlet.java b/appengine/datastore/src/main/java/com/example/appengine/AbstractGuestbookServlet.java
index e77231497c6..77afd72de5c 100644
--- a/appengine/datastore/src/main/java/com/example/appengine/AbstractGuestbookServlet.java
+++ b/appengine/datastore/src/main/java/com/example/appengine/AbstractGuestbookServlet.java
@@ -17,7 +17,6 @@
package com.example.appengine;
import java.io.IOException;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
diff --git a/appengine/datastore/src/main/java/com/example/appengine/Greeting.java b/appengine/datastore/src/main/java/com/example/appengine/Greeting.java
index 352aa0a1dde..34c1656a105 100644
--- a/appengine/datastore/src/main/java/com/example/appengine/Greeting.java
+++ b/appengine/datastore/src/main/java/com/example/appengine/Greeting.java
@@ -19,11 +19,9 @@
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.users.User;
import com.google.auto.value.AutoValue;
-import org.joda.time.Instant;
-
import java.util.Date;
-
import javax.annotation.Nullable;
+import org.joda.time.Instant;
@AutoValue
public abstract class Greeting {
diff --git a/appengine/datastore/src/main/java/com/example/appengine/Guestbook.java b/appengine/datastore/src/main/java/com/example/appengine/Guestbook.java
index 83e984818c4..7381a0e2550 100644
--- a/appengine/datastore/src/main/java/com/example/appengine/Guestbook.java
+++ b/appengine/datastore/src/main/java/com/example/appengine/Guestbook.java
@@ -17,13 +17,11 @@
package com.example.appengine;
import com.example.time.Clock;
-
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.FetchOptions;
import com.google.appengine.api.datastore.Query;
import com.google.appengine.api.users.User;
-
import java.util.Date;
import java.util.List;
diff --git a/appengine/datastore/src/main/java/com/example/appengine/GuestbookStrong.java b/appengine/datastore/src/main/java/com/example/appengine/GuestbookStrong.java
index 5f3ad23b91d..659c98397e4 100644
--- a/appengine/datastore/src/main/java/com/example/appengine/GuestbookStrong.java
+++ b/appengine/datastore/src/main/java/com/example/appengine/GuestbookStrong.java
@@ -17,7 +17,6 @@
package com.example.appengine;
import com.example.time.Clock;
-
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.FetchOptions;
@@ -25,7 +24,6 @@
import com.google.appengine.api.datastore.KeyFactory;
import com.google.appengine.api.datastore.Query;
import com.google.appengine.api.users.User;
-
import java.util.Date;
import java.util.List;
diff --git a/appengine/datastore/src/main/java/com/example/appengine/ListPeopleServlet.java b/appengine/datastore/src/main/java/com/example/appengine/ListPeopleServlet.java
index b59aaab3aa0..05c2f51b08e 100644
--- a/appengine/datastore/src/main/java/com/example/appengine/ListPeopleServlet.java
+++ b/appengine/datastore/src/main/java/com/example/appengine/ListPeopleServlet.java
@@ -17,6 +17,7 @@
package com.example.appengine;
// [START cursors]
+
import com.google.appengine.api.datastore.Cursor;
import com.google.appengine.api.datastore.DatastoreService;
import com.google.appengine.api.datastore.DatastoreServiceFactory;
@@ -26,10 +27,8 @@
import com.google.appengine.api.datastore.Query;
import com.google.appengine.api.datastore.Query.SortDirection;
import com.google.appengine.api.datastore.QueryResultList;
-
import java.io.IOException;
import java.io.PrintWriter;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
diff --git a/appengine/datastore/src/main/java/com/example/appengine/ProjectionServlet.java b/appengine/datastore/src/main/java/com/example/appengine/ProjectionServlet.java
index 81bdaf6cf9b..3f666a51c79 100644
--- a/appengine/datastore/src/main/java/com/example/appengine/ProjectionServlet.java
+++ b/appengine/datastore/src/main/java/com/example/appengine/ProjectionServlet.java
@@ -24,12 +24,10 @@
import com.google.appengine.api.datastore.KeyFactory;
import com.google.appengine.api.datastore.PropertyProjection;
import com.google.appengine.api.datastore.Query;
-
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
import java.util.List;
-
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
diff --git a/appengine/datastore/src/main/java/com/example/appengine/StartupServlet.java b/appengine/datastore/src/main/java/com/example/appengine/StartupServlet.java
index 2c523f3db15..586f28d32aa 100644
--- a/appengine/datastore/src/main/java/com/example/appengine/StartupServlet.java
+++ b/appengine/datastore/src/main/java/com/example/appengine/StartupServlet.java
@@ -23,9 +23,7 @@
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.KeyFactory;
import com.google.common.collect.ImmutableList;
-
import java.io.IOException;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
diff --git a/appengine/datastore/src/main/java/com/example/appengine/StatsServlet.java b/appengine/datastore/src/main/java/com/example/appengine/StatsServlet.java
index b6d6925fc12..9434e521184 100644
--- a/appengine/datastore/src/main/java/com/example/appengine/StatsServlet.java
+++ b/appengine/datastore/src/main/java/com/example/appengine/StatsServlet.java
@@ -20,10 +20,8 @@
import com.google.appengine.api.datastore.DatastoreServiceFactory;
import com.google.appengine.api.datastore.Entity;
import com.google.appengine.api.datastore.Query;
-
import java.io.IOException;
import java.io.PrintWriter;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
diff --git a/appengine/datastore/src/main/java/com/example/time/testing/FakeClock.java b/appengine/datastore/src/main/java/com/example/time/testing/FakeClock.java
index 7ede635d762..de883abedc4 100644
--- a/appengine/datastore/src/main/java/com/example/time/testing/FakeClock.java
+++ b/appengine/datastore/src/main/java/com/example/time/testing/FakeClock.java
@@ -17,13 +17,11 @@
package com.example.time.testing;
import com.example.time.Clock;
-
+import java.util.concurrent.atomic.AtomicLong;
import org.joda.time.Instant;
import org.joda.time.ReadableDuration;
import org.joda.time.ReadableInstant;
-import java.util.concurrent.atomic.AtomicLong;
-
/**
* A Clock that returns a fixed Instant value as the current clock time. The
* fixed Instant is settable for testing. Test code should hold a reference to
diff --git a/appengine/datastore/src/main/webapp/WEB-INF/web.xml b/appengine/datastore/src/main/webapp/WEB-INF/web.xml
index cf06f60d61e..5a71d548fa6 100644
--- a/appengine/datastore/src/main/webapp/WEB-INF/web.xml
+++ b/appengine/datastore/src/main/webapp/WEB-INF/web.xml
@@ -14,10 +14,10 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
+
guestbook-strong
com.example.appengine.GuestbookStrongServlet
diff --git a/appengine/datastore/src/test/java/com/example/appengine/EntitiesTest.java b/appengine/datastore/src/test/java/com/example/appengine/EntitiesTest.java
index c9b7640efe4..f4157dc5e12 100644
--- a/appengine/datastore/src/test/java/com/example/appengine/EntitiesTest.java
+++ b/appengine/datastore/src/test/java/com/example/appengine/EntitiesTest.java
@@ -29,17 +29,16 @@
import com.google.appengine.api.datastore.KeyRange;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Date;
import java.util.List;
import java.util.Map;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
/**
* Unit tests to demonstrate App Engine Datastore entities.
@@ -69,6 +68,7 @@ public void tearDown() {
@Test
public void kindExample_writesEntity() throws Exception {
+ //CHECKSTYLE.OFF: VariableDeclarationUsageDistance - Increased clarity in sample
// [START kind_example]
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
@@ -80,6 +80,7 @@ public void kindExample_writesEntity() throws Exception {
datastore.put(employee);
// [END kind_example]
+ //CHECKSTYLE.ON: VariableDeclarationUsageDistance
Entity got = datastore.get(employee.getKey());
assertThat((String) got.getProperty("firstName")).named("got.firstName").isEqualTo("Antonio");
@@ -220,7 +221,9 @@ public void repeatedProperties_storesList() throws Exception {
@Test
public void embeddedEntity_fromEmbedded_embedsProperties() throws Exception {
+ //CHECKSTYLE.OFF: VariableDeclarationUsageDistance - Increased clarity in sample
Entity employee = new Entity("Employee");
+ //CHECKSTYLE.ON: VariableDeclarationUsageDistance
// [START embedded_entities_1]
// Entity employee = ...;
EmbeddedEntity embeddedContactInfo = new EmbeddedEntity();
diff --git a/appengine/datastore/src/test/java/com/example/appengine/GuestbookStrongTest.java b/appengine/datastore/src/test/java/com/example/appengine/GuestbookStrongTest.java
index dcff5595dab..ad1a167bd94 100644
--- a/appengine/datastore/src/test/java/com/example/appengine/GuestbookStrongTest.java
+++ b/appengine/datastore/src/test/java/com/example/appengine/GuestbookStrongTest.java
@@ -19,10 +19,10 @@
import static com.google.common.truth.Truth.assertThat;
import com.example.time.testing.FakeClock;
-
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
import com.google.appengine.tools.development.testing.LocalUserServiceTestConfig;
+import java.util.List;
import org.joda.time.Instant;
import org.junit.After;
import org.junit.Before;
@@ -30,8 +30,6 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import java.util.List;
-
/**
* Unit tests for {@link GuestbookStrong}.
*/
diff --git a/appengine/datastore/src/test/java/com/example/appengine/GuestbookTest.java b/appengine/datastore/src/test/java/com/example/appengine/GuestbookTest.java
index 82d5fd11204..42a5fbfc430 100644
--- a/appengine/datastore/src/test/java/com/example/appengine/GuestbookTest.java
+++ b/appengine/datastore/src/test/java/com/example/appengine/GuestbookTest.java
@@ -19,20 +19,18 @@
import static com.google.common.truth.Truth.assertThat;
import com.example.time.testing.FakeClock;
-
import com.google.appengine.api.datastore.Key;
import com.google.appengine.api.datastore.dev.HighRepJobPolicy;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
import com.google.appengine.tools.development.testing.LocalUserServiceTestConfig;
+import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import java.util.List;
-
/**
* Unit tests for {@link Guestbook}.
*/
diff --git a/appengine/datastore/src/test/java/com/example/appengine/IndexesTest.java b/appengine/datastore/src/test/java/com/example/appengine/IndexesTest.java
index 2a9284f3809..0e88a66a2f0 100644
--- a/appengine/datastore/src/test/java/com/example/appengine/IndexesTest.java
+++ b/appengine/datastore/src/test/java/com/example/appengine/IndexesTest.java
@@ -30,14 +30,13 @@
import com.google.appengine.api.datastore.Query.FilterPredicate;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import java.util.List;
-
/**
* Unit tests to demonstrate App Engine Datastore queries.
*/
diff --git a/appengine/datastore/src/test/java/com/example/appengine/ListPeopleServletTest.java b/appengine/datastore/src/test/java/com/example/appengine/ListPeopleServletTest.java
index 5ea0920a153..ef60bd902b8 100644
--- a/appengine/datastore/src/test/java/com/example/appengine/ListPeopleServletTest.java
+++ b/appengine/datastore/src/test/java/com/example/appengine/ListPeopleServletTest.java
@@ -31,6 +31,10 @@
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
import com.google.common.collect.ImmutableList;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -39,12 +43,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Unit tests for {@link ListPeopleServlet}.
*/
diff --git a/appengine/datastore/src/test/java/com/example/appengine/MetadataEntityGroupTest.java b/appengine/datastore/src/test/java/com/example/appengine/MetadataEntityGroupTest.java
index 89545c3e208..0941c93537e 100644
--- a/appengine/datastore/src/test/java/com/example/appengine/MetadataEntityGroupTest.java
+++ b/appengine/datastore/src/test/java/com/example/appengine/MetadataEntityGroupTest.java
@@ -33,16 +33,15 @@
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalMemcacheServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.io.PrintWriter;
+import java.io.Serializable;
+import java.io.StringWriter;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import java.io.PrintWriter;
-import java.io.Serializable;
-import java.io.StringWriter;
-
/**
* Unit tests to demonstrate App Engine Datastore entity group metadata.
*/
diff --git a/appengine/datastore/src/test/java/com/example/appengine/MetadataKindsTest.java b/appengine/datastore/src/test/java/com/example/appengine/MetadataKindsTest.java
index 16f3d7026d3..951b10be4e8 100644
--- a/appengine/datastore/src/test/java/com/example/appengine/MetadataKindsTest.java
+++ b/appengine/datastore/src/test/java/com/example/appengine/MetadataKindsTest.java
@@ -29,17 +29,16 @@
import com.google.appengine.api.datastore.Query.FilterPredicate;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Unit tests to demonstrate App Engine Datastore kinds metadata.
*/
diff --git a/appengine/datastore/src/test/java/com/example/appengine/MetadataNamespacesTest.java b/appengine/datastore/src/test/java/com/example/appengine/MetadataNamespacesTest.java
index 98c09d64954..80b2d3bb5fe 100644
--- a/appengine/datastore/src/test/java/com/example/appengine/MetadataNamespacesTest.java
+++ b/appengine/datastore/src/test/java/com/example/appengine/MetadataNamespacesTest.java
@@ -30,17 +30,16 @@
import com.google.appengine.api.datastore.Query.FilterPredicate;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.ArrayList;
+import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.ArrayList;
-import java.util.List;
-
/**
* Unit tests to demonstrate App Engine Datastore namespaces metadata.
*/
diff --git a/appengine/datastore/src/test/java/com/example/appengine/MetadataPropertiesTest.java b/appengine/datastore/src/test/java/com/example/appengine/MetadataPropertiesTest.java
index 64b32c6dc38..41a0c7d919c 100644
--- a/appengine/datastore/src/test/java/com/example/appengine/MetadataPropertiesTest.java
+++ b/appengine/datastore/src/test/java/com/example/appengine/MetadataPropertiesTest.java
@@ -28,12 +28,6 @@
import com.google.appengine.api.datastore.Query.SortDirection;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
-import org.junit.After;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.junit.runners.JUnit4;
-
import java.io.PrintWriter;
import java.io.StringWriter;
import java.util.ArrayList;
@@ -41,6 +35,11 @@
import java.util.Collection;
import java.util.Date;
import java.util.List;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.junit.runners.JUnit4;
/**
* Unit tests to demonstrate App Engine Datastore properties metadata.
diff --git a/appengine/datastore/src/test/java/com/example/appengine/ProjectionServletTest.java b/appengine/datastore/src/test/java/com/example/appengine/ProjectionServletTest.java
index 101abf06052..cb7a151e7cc 100644
--- a/appengine/datastore/src/test/java/com/example/appengine/ProjectionServletTest.java
+++ b/appengine/datastore/src/test/java/com/example/appengine/ProjectionServletTest.java
@@ -20,9 +20,12 @@
import static org.mockito.Mockito.when;
import com.example.time.testing.FakeClock;
-
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -31,12 +34,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Unit tests for {@link ProjectionServlet}.
*/
diff --git a/appengine/datastore/src/test/java/com/example/appengine/ProjectionTest.java b/appengine/datastore/src/test/java/com/example/appengine/ProjectionTest.java
index e8f3e81533b..1c7e0ae482b 100644
--- a/appengine/datastore/src/test/java/com/example/appengine/ProjectionTest.java
+++ b/appengine/datastore/src/test/java/com/example/appengine/ProjectionTest.java
@@ -26,14 +26,13 @@
import com.google.appengine.api.datastore.Query;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import java.util.List;
-
/**
* Unit tests to demonstrate App Engine Datastore projection queries.
*/
diff --git a/appengine/datastore/src/test/java/com/example/appengine/QueriesTest.java b/appengine/datastore/src/test/java/com/example/appengine/QueriesTest.java
index d8a2e61dd5c..f2e6f290869 100644
--- a/appengine/datastore/src/test/java/com/example/appengine/QueriesTest.java
+++ b/appengine/datastore/src/test/java/com/example/appengine/QueriesTest.java
@@ -36,17 +36,16 @@
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
import com.google.common.collect.ImmutableList;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import java.util.Arrays;
+import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import java.util.Arrays;
-import java.util.List;
-
/**
* Unit tests to demonstrate App Engine Datastore queries.
*/
diff --git a/appengine/datastore/src/test/java/com/example/appengine/ReadPolicyTest.java b/appengine/datastore/src/test/java/com/example/appengine/ReadPolicyTest.java
index 054088cd863..e89ef52f81a 100644
--- a/appengine/datastore/src/test/java/com/example/appengine/ReadPolicyTest.java
+++ b/appengine/datastore/src/test/java/com/example/appengine/ReadPolicyTest.java
@@ -28,14 +28,13 @@
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
import com.google.common.collect.ImmutableList;
+import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import java.util.List;
-
/**
* Unit tests for {@link ReadPolicy}.
*/
diff --git a/appengine/datastore/src/test/java/com/example/appengine/StartupServletTest.java b/appengine/datastore/src/test/java/com/example/appengine/StartupServletTest.java
index c6876701c1a..ac4bfdffba3 100644
--- a/appengine/datastore/src/test/java/com/example/appengine/StartupServletTest.java
+++ b/appengine/datastore/src/test/java/com/example/appengine/StartupServletTest.java
@@ -28,6 +28,10 @@
import com.google.appengine.api.datastore.Query.FilterPredicate;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -36,12 +40,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Unit tests for {@link StartupServlet}.
*/
diff --git a/appengine/datastore/src/test/java/com/example/appengine/TransactionsTest.java b/appengine/datastore/src/test/java/com/example/appengine/TransactionsTest.java
index 0b958cbf0da..a816707ca45 100644
--- a/appengine/datastore/src/test/java/com/example/appengine/TransactionsTest.java
+++ b/appengine/datastore/src/test/java/com/example/appengine/TransactionsTest.java
@@ -35,16 +35,15 @@
import com.google.appengine.api.taskqueue.TaskOptions;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.util.ConcurrentModificationException;
+import java.util.Date;
+import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import java.util.ConcurrentModificationException;
-import java.util.Date;
-import java.util.List;
-
/**
* Unit tests to demonstrate App Engine Datastore transactions.
*/
@@ -145,6 +144,7 @@ public void entityGroups() throws Exception {
public void creatingAnEntityInASpecificEntityGroup() throws Exception {
String boardName = "my-message-board";
+ //CHECKSTYLE.OFF: VariableDeclarationUsageDistance - Increased clarity in sample
// [START creating_an_entity_in_a_specific_entity_group]
DatastoreService datastore = DatastoreServiceFactory.getDatastoreService();
@@ -164,6 +164,7 @@ public void creatingAnEntityInASpecificEntityGroup() throws Exception {
txn.commit();
// [END creating_an_entity_in_a_specific_entity_group]
+ //CHECKSTYLE.ON: VariableDeclarationUsageDistance
}
@Test
diff --git a/appengine/endpoints-frameworks-v2/README.md b/appengine/endpoints-frameworks-v2/README.md
index 31682f1ed6f..76bb728d90f 100644
--- a/appengine/endpoints-frameworks-v2/README.md
+++ b/appengine/endpoints-frameworks-v2/README.md
@@ -6,6 +6,9 @@ December 13, 2017 and will be shut down entirely on January 16, 2019. It is repl
Samples for the Java 8 runtime can be found [here](/appengine-java8).
+
+
+
This directory contains Google Cloud Endpoints Frameworks for App Engine for
App Engine Standard samples. The [`backend/`](backend/) directory contains the
sample code for the [quickstart][4] for Cloud Endpoints Frameworks on App Engine
diff --git a/appengine/endpoints-frameworks-v2/backend/README.md b/appengine/endpoints-frameworks-v2/backend/README.md
index 9982f20e707..c7b197113e3 100644
--- a/appengine/endpoints-frameworks-v2/backend/README.md
+++ b/appengine/endpoints-frameworks-v2/backend/README.md
@@ -3,6 +3,10 @@
This sample demonstrates how to use Google Cloud Endpoints Frameworks using
Java on App Engine Standard.
+
+
+
+
## Build with Maven
### Adding the project ID to the sample API code
diff --git a/appengine/endpoints-frameworks-v2/backend/pom.xml b/appengine/endpoints-frameworks-v2/backend/pom.xml
index 86290fd0877..b3d4f9aab5a 100644
--- a/appengine/endpoints-frameworks-v2/backend/pom.xml
+++ b/appengine/endpoints-frameworks-v2/backend/pom.xml
@@ -21,13 +21,17 @@
com.example.echo
echo
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ../..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
UTF-8
diff --git a/appengine/endpoints-frameworks-v2/backend/src/main/java/com/example/echo/Echo.java b/appengine/endpoints-frameworks-v2/backend/src/main/java/com/example/echo/Echo.java
index 5804e86dfca..9229e060373 100644
--- a/appengine/endpoints-frameworks-v2/backend/src/main/java/com/example/echo/Echo.java
+++ b/appengine/endpoints-frameworks-v2/backend/src/main/java/com/example/echo/Echo.java
@@ -1,17 +1,17 @@
/*
- * Copyright (c) 2016 Google Inc.
+ * Copyright 2016 Google Inc.
*
- * 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
+ * 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.
+ * 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.echo;
@@ -54,10 +54,10 @@ public class Echo {
* Echoes the received message back. If n is a non-negative integer, the message is copied that
* many times in the returned message.
*
- * Note that name is specified and will override the default name of "{class name}.{method
+ * Note that name is specified and will override the default name of "{class name}.{method
* name}". For example, the default is "echo.echo".
*
- * Note that httpMethod is not specified. This will default to a reasonable HTTP method
+ *
Note that httpMethod is not specified. This will default to a reasonable HTTP method
* depending on the API method name. In this case, the HTTP method will default to POST.
*/
// [START echo_method]
@@ -71,10 +71,10 @@ public Message echo(Message message, @Named("n") @Nullable Integer n) {
* Echoes the received message back. If n is a non-negative integer, the message is copied that
* many times in the returned message.
*
- * Note that name is specified and will override the default name of "{class name}.{method
+ *
Note that name is specified and will override the default name of "{class name}.{method
* name}". For example, the default is "echo.echo".
*
- * Note that httpMethod is not specified. This will default to a reasonable HTTP method
+ *
Note that httpMethod is not specified. This will default to a reasonable HTTP method
* depending on the API method name. In this case, the HTTP method will default to POST.
*/
// [START echo_path]
@@ -88,10 +88,10 @@ public Message echoPathParameter(Message message, @Named("n") int n) {
* Echoes the received message back. If n is a non-negative integer, the message is copied that
* many times in the returned message.
*
- * Note that name is specified and will override the default name of "{class name}.{method
+ *
Note that name is specified and will override the default name of "{class name}.{method
* name}". For example, the default is "echo.echo".
*
- * Note that httpMethod is not specified. This will default to a reasonable HTTP method
+ *
Note that httpMethod is not specified. This will default to a reasonable HTTP method
* depending on the API method name. In this case, the HTTP method will default to POST.
*/
// [START echo_api_key]
@@ -119,10 +119,10 @@ private Message doEcho(Message message, Integer n) {
* Gets the authenticated user's email. If the user is not authenticated, this will return an HTTP
* 401.
*
- * Note that name is not specified. This will default to "{class name}.{method name}". For
+ *
Note that name is not specified. This will default to "{class name}.{method name}". For
* example, the default is "echo.getUserEmail".
*
- * Note that httpMethod is not required here. Without httpMethod, this will default to GET due
+ *
Note that httpMethod is not required here. Without httpMethod, this will default to GET due
* to the API method name. httpMethod is added here for example purposes.
*/
// [START google_id_token_auth]
@@ -147,10 +147,10 @@ public Email getUserEmail(User user) throws UnauthorizedException {
* Gets the authenticated user's email. If the user is not authenticated, this will return an HTTP
* 401.
*
- * Note that name is not specified. This will default to "{class name}.{method name}". For
+ *
Note that name is not specified. This will default to "{class name}.{method name}". For
* example, the default is "echo.getUserEmail".
*
- * Note that httpMethod is not required here. Without httpMethod, this will default to GET due
+ *
Note that httpMethod is not required here. Without httpMethod, this will default to GET due
* to the API method name. httpMethod is added here for example purposes.
*/
// [START firebase_auth]
diff --git a/appengine/endpoints-frameworks-v2/backend/src/main/java/com/example/echo/Email.java b/appengine/endpoints-frameworks-v2/backend/src/main/java/com/example/echo/Email.java
index e7725a9d9cc..892c003bcaa 100644
--- a/appengine/endpoints-frameworks-v2/backend/src/main/java/com/example/echo/Email.java
+++ b/appengine/endpoints-frameworks-v2/backend/src/main/java/com/example/echo/Email.java
@@ -1,17 +1,17 @@
/*
- * Copyright (c) 2016 Google Inc.
+ * Copyright 2016 Google Inc.
*
- * 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
+ * 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.
+ * 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.echo;
diff --git a/appengine/endpoints-frameworks-v2/backend/src/main/java/com/example/echo/Message.java b/appengine/endpoints-frameworks-v2/backend/src/main/java/com/example/echo/Message.java
index 64c043c8857..bcaa2967137 100644
--- a/appengine/endpoints-frameworks-v2/backend/src/main/java/com/example/echo/Message.java
+++ b/appengine/endpoints-frameworks-v2/backend/src/main/java/com/example/echo/Message.java
@@ -1,17 +1,17 @@
/*
- * Copyright (c) 2016 Google Inc.
+ * Copyright 2016 Google Inc.
*
- * 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
+ * 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.
+ * 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.echo;
diff --git a/appengine/endpoints-frameworks-v2/guice-example/README.md b/appengine/endpoints-frameworks-v2/guice-example/README.md
index 25ed1d4d77c..d3e3c90a921 100644
--- a/appengine/endpoints-frameworks-v2/guice-example/README.md
+++ b/appengine/endpoints-frameworks-v2/guice-example/README.md
@@ -3,6 +3,10 @@
This sample demonstrates how to use Google Cloud Endpoints Frameworks with Guice
on App Engine Standard.
+
+
+
+
## Build with Maven
### Adding the project ID to the sample API code
diff --git a/appengine/endpoints-frameworks-v2/guice-example/pom.xml b/appengine/endpoints-frameworks-v2/guice-example/pom.xml
index f0f8a768a55..5ffbe548e25 100644
--- a/appengine/endpoints-frameworks-v2/guice-example/pom.xml
+++ b/appengine/endpoints-frameworks-v2/guice-example/pom.xml
@@ -21,13 +21,17 @@
com.example.echo
echo-guice
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ../..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
UTF-8
diff --git a/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/Echo.java b/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/Echo.java
index 217922887e1..06fda4260c8 100644
--- a/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/Echo.java
+++ b/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/Echo.java
@@ -1,17 +1,17 @@
/*
- * Copyright (c) 2017 Google Inc.
+ * Copyright 2017 Google Inc.
*
- * 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
+ * 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.
+ * 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.echo;
@@ -54,10 +54,10 @@ public class Echo {
* Echoes the received message back. If n is a non-negative integer, the message is copied that
* many times in the returned message.
*
- * Note that name is specified and will override the default name of "{class name}.{method
+ * Note that name is specified and will override the default name of "{class name}.{method
* name}". For example, the default is "echo.echo".
*
- * Note that httpMethod is not specified. This will default to a reasonable HTTP method
+ *
Note that httpMethod is not specified. This will default to a reasonable HTTP method
* depending on the API method name. In this case, the HTTP method will default to POST.
*/
// [START echo_method]
@@ -71,10 +71,10 @@ public Message echo(Message message, @Named("n") @Nullable Integer n) {
* Echoes the received message back. If n is a non-negative integer, the message is copied that
* many times in the returned message.
*
- * Note that name is specified and will override the default name of "{class name}.{method
+ *
Note that name is specified and will override the default name of "{class name}.{method
* name}". For example, the default is "echo.echo".
*
- * Note that httpMethod is not specified. This will default to a reasonable HTTP method
+ *
Note that httpMethod is not specified. This will default to a reasonable HTTP method
* depending on the API method name. In this case, the HTTP method will default to POST.
*/
// [START echo_path]
@@ -88,10 +88,10 @@ public Message echoPathParameter(Message message, @Named("n") int n) {
* Echoes the received message back. If n is a non-negative integer, the message is copied that
* many times in the returned message.
*
- * Note that name is specified and will override the default name of "{class name}.{method
+ *
Note that name is specified and will override the default name of "{class name}.{method
* name}". For example, the default is "echo.echo".
*
- * Note that httpMethod is not specified. This will default to a reasonable HTTP method
+ *
Note that httpMethod is not specified. This will default to a reasonable HTTP method
* depending on the API method name. In this case, the HTTP method will default to POST.
*/
// [START echo_api_key]
@@ -119,10 +119,10 @@ private Message doEcho(Message message, Integer n) {
* Gets the authenticated user's email. If the user is not authenticated, this will return an HTTP
* 401.
*
- * Note that name is not specified. This will default to "{class name}.{method name}". For
+ *
Note that name is not specified. This will default to "{class name}.{method name}". For
* example, the default is "echo.getUserEmail".
*
- * Note that httpMethod is not required here. Without httpMethod, this will default to GET due
+ *
Note that httpMethod is not required here. Without httpMethod, this will default to GET due
* to the API method name. httpMethod is added here for example purposes.
*/
// [START google_id_token_auth]
@@ -147,10 +147,10 @@ public Email getUserEmail(User user) throws UnauthorizedException {
* Gets the authenticated user's email. If the user is not authenticated, this will return an HTTP
* 401.
*
- * Note that name is not specified. This will default to "{class name}.{method name}". For
+ *
Note that name is not specified. This will default to "{class name}.{method name}". For
* example, the default is "echo.getUserEmail".
*
- * Note that httpMethod is not required here. Without httpMethod, this will default to GET due
+ *
Note that httpMethod is not required here. Without httpMethod, this will default to GET due
* to the API method name. httpMethod is added here for example purposes.
*/
// [START firebase_auth]
diff --git a/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/EchoEndpointModule.java b/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/EchoEndpointModule.java
index a0b2cf7f005..3649d42e0c5 100644
--- a/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/EchoEndpointModule.java
+++ b/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/EchoEndpointModule.java
@@ -1,17 +1,17 @@
/*
- * Copyright (c) 2017 Google Inc.
+ * Copyright 2017 Google Inc.
*
- * 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
+ * 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.
+ * 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.echo;
diff --git a/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/EchoGuiceListener.java b/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/EchoGuiceListener.java
index 7de3ed6546e..a8f2fafd696 100644
--- a/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/EchoGuiceListener.java
+++ b/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/EchoGuiceListener.java
@@ -1,17 +1,17 @@
/*
- * Copyright (c) 2017 Google Inc.
+ * Copyright 2017 Google Inc.
*
- * 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
+ * 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.
+ * 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.echo;
@@ -22,9 +22,9 @@
// [START injector]
public class EchoGuiceListener extends GuiceServletContextListener {
- @Override
- protected Injector getInjector() {
- return Guice.createInjector(new EchoEndpointModule());
- }
+ @Override
+ protected Injector getInjector() {
+ return Guice.createInjector(new EchoEndpointModule());
+ }
}
// [END injector]
diff --git a/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/Email.java b/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/Email.java
index 2ecd4cf6a45..206c6c2f003 100644
--- a/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/Email.java
+++ b/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/Email.java
@@ -1,17 +1,17 @@
/*
- * Copyright (c) 2017 Google Inc.
+ * Copyright 2017 Google Inc.
*
- * 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
+ * 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.
+ * 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.echo;
diff --git a/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/Message.java b/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/Message.java
index d5ddb79d430..c5334ecd89c 100644
--- a/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/Message.java
+++ b/appengine/endpoints-frameworks-v2/guice-example/src/main/java/com/example/echo/Message.java
@@ -1,17 +1,17 @@
/*
- * Copyright (c) 2017 Google Inc.
+ * Copyright 2017 Google Inc.
*
- * 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
+ * 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.
+ * 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.echo;
diff --git a/appengine/endpoints-frameworks-v2/migration-example/README.md b/appengine/endpoints-frameworks-v2/migration-example/README.md
index a213447c5b1..752c301cc85 100644
--- a/appengine/endpoints-frameworks-v2/migration-example/README.md
+++ b/appengine/endpoints-frameworks-v2/migration-example/README.md
@@ -1,5 +1,8 @@
# Hello World Google Cloud Endpoints for App Engine
+
+
+
This sample provides an example of a [migration][7] from the prior version of
[Google Cloud Endpoints Frameworks][3] to new
[Google Cloud Endpoints Frameworks for App Engine][8] using a
diff --git a/appengine/endpoints-frameworks-v2/migration-example/pom.xml b/appengine/endpoints-frameworks-v2/migration-example/pom.xml
index 763a41a416c..d3271db15a7 100644
--- a/appengine/endpoints-frameworks-v2/migration-example/pom.xml
+++ b/appengine/endpoints-frameworks-v2/migration-example/pom.xml
@@ -22,13 +22,17 @@ limitations under the License.
com.example.helloendpoints
helloendpoints
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ../..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
1.7
1.7
diff --git a/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/Constants.java b/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/Constants.java
index 255a3dd9e25..0a018760ba0 100644
--- a/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/Constants.java
+++ b/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/Constants.java
@@ -1,18 +1,18 @@
/*
-Copyright 2017 Google Inc.
-
-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.
-*/
+ * Copyright 2017 Google Inc.
+ *
+ * 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.helloendpoints;
diff --git a/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/Greetings.java b/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/Greetings.java
index 716d2c597e1..6932a4b8d70 100644
--- a/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/Greetings.java
+++ b/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/Greetings.java
@@ -1,20 +1,22 @@
/*
-Copyright 2017 Google Inc.
-
-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
+ * Copyright 2017 Google Inc.
+ *
+ * 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.
+ */
-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.
-*/
//[START begin]
+
package com.example.helloendpoints;
import com.google.api.server.spi.config.Api;
@@ -25,6 +27,7 @@
import java.util.ArrayList;
import javax.inject.Named;
+
//[END begin]
//[START api_def]
@@ -47,9 +50,9 @@ public class Greetings {
greetings.add(new HelloGreeting("hello world!"));
greetings.add(new HelloGreeting("goodbye world!"));
}
-//[END api_def]
+ //[END api_def]
-//[START getgreetings]
+ //[START getgreetings]
public HelloGreeting getGreeting(@Named("id") Integer id) throws NotFoundException {
try {
@@ -62,9 +65,9 @@ public HelloGreeting getGreeting(@Named("id") Integer id) throws NotFoundExcepti
public ArrayList listGreeting() {
return greetings;
}
-//[END getgreetings]
+ //[END getgreetings]
-//[START multiplygreetings]
+ //[START multiplygreetings]
@ApiMethod(name = "greetings.multiply", httpMethod = "post")
public HelloGreeting insertGreeting(@Named("times") Integer times, HelloGreeting greeting) {
@@ -76,14 +79,14 @@ public HelloGreeting insertGreeting(@Named("times") Integer times, HelloGreeting
response.setMessage(responseBuilder.toString());
return response;
}
-//[END multiplygreetings]
+ //[END multiplygreetings]
-//[START auth]
+ //[START auth]
@ApiMethod(name = "greetings.authed", path = "hellogreeting/authed")
public HelloGreeting authedGreeting(User user) {
HelloGreeting response = new HelloGreeting("hello " + user.getEmail());
return response;
}
-//[END auth]
+ //[END auth]
}
diff --git a/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/HelloGreeting.java b/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/HelloGreeting.java
index 7cf19f7c482..698334776d3 100644
--- a/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/HelloGreeting.java
+++ b/appengine/endpoints-frameworks-v2/migration-example/src/main/java/com/example/helloendpoints/HelloGreeting.java
@@ -1,18 +1,19 @@
/*
-Copyright 2017 Google Inc.
+ * Copyright 2017 Google Inc.
+ *
+ * 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.
+ */
-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.helloendpoints;
diff --git a/appengine/endpoints-v1-helloworld/README.md b/appengine/endpoints-v1-helloworld/README.md
index 49e0e7d59e8..4430c5f9475 100644
--- a/appengine/endpoints-v1-helloworld/README.md
+++ b/appengine/endpoints-v1-helloworld/README.md
@@ -1,6 +1,10 @@
endpoints-skeleton
==================
+
+
+
+
# DEPRECATED
### This sample uses endpoints v1 the preferred strategy for new development is to use Endpoints v2
diff --git a/appengine/endpoints-v1-helloworld/pom.xml b/appengine/endpoints-v1-helloworld/pom.xml
index f43b4910fd3..291610527c8 100644
--- a/appengine/endpoints-v1-helloworld/pom.xml
+++ b/appengine/endpoints-v1-helloworld/pom.xml
@@ -21,18 +21,19 @@
com.example.helloworld
helloworld
-
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
-
+
+
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
+
- 1
UTF-8
-
- 1.9.60
1.7
1.7
@@ -46,12 +47,12 @@
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.plugin.version}
+ 1.9.59
com.google.appengine
appengine-endpoints
- ${appengine.plugin.version}
+ 1.9.59
javax.servlet
@@ -81,13 +82,13 @@
com.google.appengine
appengine-testing
- ${appengine.plugin.version}
+ 1.9.59
test
com.google.appengine
appengine-api-stubs
- ${appengine.plugin.version}
+ 1.9.59
test
@@ -134,7 +135,7 @@
com.google.appengine
appengine-maven-plugin
- ${appengine.plugin.version}
+ 1.9.59
false
diff --git a/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/Bar.java b/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/Bar.java
index df4dad666ed..db83b76361c 100644
--- a/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/Bar.java
+++ b/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/Bar.java
@@ -1,21 +1,25 @@
/*
- * Copyright 2016 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.
- */
+* Copyright 2016 Google Inc.
+*
+* 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.helloworld;
import com.google.api.server.spi.config.ApiTransformer;
-
+//CHECKSTYLE.OFF: MemberName - readability
// [START all]
+
@ApiTransformer(BarTransformer.class)
public class Bar {
private final int x;
@@ -34,4 +38,6 @@ public int getY() {
return y;
}
}
+
// [END all]
+//CHECKSTYLE.ON: MemberName
\ No newline at end of file
diff --git a/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/BarTransformer.java b/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/BarTransformer.java
index 2d22b4ed51d..8da1a8ef394 100644
--- a/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/BarTransformer.java
+++ b/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/BarTransformer.java
@@ -1,9 +1,11 @@
/*
- * Copyright 2016 Google Inc. All Rights Reserved.
+ * Copyright 2016 Google Inc.
*
* 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
+ * 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,
@@ -11,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.example.helloworld;
import com.google.api.server.spi.config.Transformer;
diff --git a/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/Constants.java b/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/Constants.java
index ff9f762e240..e030b39fd55 100644
--- a/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/Constants.java
+++ b/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/Constants.java
@@ -1,5 +1,5 @@
-/**
- * Copyright 2016 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+
package com.example.helloworld;
// [START all]
diff --git a/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/MyBean.java b/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/MyBean.java
index 92aef481cee..1409c2ff458 100644
--- a/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/MyBean.java
+++ b/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/MyBean.java
@@ -1,16 +1,19 @@
-/**
- * Copyright 2016 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2016 Google Inc.
*
- * 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
+ * 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.
+ * 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.helloworld;
//[START all]
diff --git a/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/RequestTimeoutException.java b/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/RequestTimeoutException.java
index a0f6ceb2482..ef44bcd5d82 100644
--- a/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/RequestTimeoutException.java
+++ b/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/RequestTimeoutException.java
@@ -1,9 +1,11 @@
/*
- * Copyright 2016 Google Inc. All Rights Reserved.
+ * Copyright 2016 Google Inc.
*
* 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
+ * 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,
@@ -11,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.example.helloworld;
// [START all]
diff --git a/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/YourFirstAPI.java b/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/YourFirstAPI.java
index 604eab29e60..32ef474eddd 100644
--- a/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/YourFirstAPI.java
+++ b/appengine/endpoints-v1-helloworld/src/main/java/com/example/helloworld/YourFirstAPI.java
@@ -1,15 +1,17 @@
-/**
- * Copyright 2016 Google Inc. All Rights Reserved.
+/*
+ * Copyright 2016 Google Inc.
*
- * 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
+ * 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.
+ * 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.helloworld;
@@ -27,8 +29,9 @@
import javax.inject.Named;
+// CHECKSTYLE.OFF: AbbreviationAsWordInName
// [START header]
-/** An endpoint class we are exposing */
+/** An endpoint class we are exposing. */
@Api(name = "myApi",
version = "v1",
namespace = @ApiNamespace(ownerDomain = "helloworld.example.com",
@@ -39,7 +42,7 @@
public class YourFirstAPI {
// [START hi]
- /** A simple endpoint method that takes a name and says Hi back */
+ /** A simple endpoint method that takes a name and says Hi back. */
@ApiMethod(name = "sayHi")
public MyBean sayHi(@Named("name") String name) {
MyBean response = new MyBean();
@@ -50,7 +53,7 @@ public MyBean sayHi(@Named("name") String name) {
//[END hi]
// [START hi_user]
- /** A simple endpoint method that takes a name and says Hi back */
+ /** A simple endpoint method that takes a name and says Hi back. */
@ApiMethod(
name = "sayHiUser",
httpMethod = ApiMethod.HttpMethod.GET)
@@ -73,6 +76,7 @@ public void insertFoo(MyBean foo) {
}
// [END post]
// [START resources]
+
class Resp {
private String foobar = "foobar";
private String bin = "bin";
@@ -102,15 +106,16 @@ public void setFoobar(String foobar) {
public Resp getResp() {
return new Resp();
}
+
// [END resources]
@SuppressWarnings("unused")
// [START lookmeup]
- /** A simple endpoint method that takes a name and says Hi back */
+ /** A simple endpoint method that takes a name and says Hi back. */
@ApiMethod(
name = "lookmeup",
httpMethod = ApiMethod.HttpMethod.GET)
- public MyBean lookMeUp( User user)
+ public MyBean lookMeUp(User user)
throws OAuthRequestException, RequestTimeoutException, NotFoundException, IOException {
MyBean response = new MyBean();
@@ -123,7 +128,7 @@ public MyBean lookMeUp( User user)
throw new NotFoundException(user.getEmail());
// [END notfound]
}
- if (true /* did we time out */ ) {
+ if (true) { /* did we time out */
// [START timeout]
throw new RequestTimeoutException("lookMeUp() timed out"); // custom timeout exception
// [END timeout]
@@ -133,3 +138,4 @@ public MyBean lookMeUp( User user)
}
// [END lookmeup]
}
+// CHECKSTYLE.ON: AbbreviationAsWordInName
\ No newline at end of file
diff --git a/appengine/firebase-event-proxy/README.md b/appengine/firebase-event-proxy/README.md
index 74c815668bc..155cd7f8311 100644
--- a/appengine/firebase-event-proxy/README.md
+++ b/appengine/firebase-event-proxy/README.md
@@ -1,4 +1,7 @@
# App Engine Firebase Event Proxy
+
+
+
**Java 7 runtime support on App Engine standard was [deprecated](https://cloud.google.com/appengine/docs/deprecations/java7) on
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
diff --git a/appengine/firebase-event-proxy/gae-firebase-event-proxy/pom.xml b/appengine/firebase-event-proxy/gae-firebase-event-proxy/pom.xml
index f8f368a03c9..150504980e7 100644
--- a/appengine/firebase-event-proxy/gae-firebase-event-proxy/pom.xml
+++ b/appengine/firebase-event-proxy/gae-firebase-event-proxy/pom.xml
@@ -20,18 +20,24 @@
com.example.gaefirebaseeventproxy
gaefirebaseeventproxy
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ../..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
gae-firebase-event-proxy
1
UTF-8
true
+ 1.7
+ 1.7
@@ -43,7 +49,7 @@
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.sdk.version}
+ 1.9.59
javax.servlet
@@ -76,13 +82,13 @@
com.google.appengine
appengine-testing
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-api-stubs
- ${appengine.sdk.version}
+ 1.9.59
test
@@ -94,7 +100,7 @@
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
false
${app.version}
diff --git a/appengine/firebase-event-proxy/gae-firebase-event-proxy/src/main/java/com/example/GaeFirebaseEventProxy/FirebaseEventProxy.java b/appengine/firebase-event-proxy/gae-firebase-event-proxy/src/main/java/com/example/gaefirebaseeventproxy/FirebaseEventProxy.java
similarity index 99%
rename from appengine/firebase-event-proxy/gae-firebase-event-proxy/src/main/java/com/example/GaeFirebaseEventProxy/FirebaseEventProxy.java
rename to appengine/firebase-event-proxy/gae-firebase-event-proxy/src/main/java/com/example/gaefirebaseeventproxy/FirebaseEventProxy.java
index 4a115b74c5d..6374b4c2e0f 100644
--- a/appengine/firebase-event-proxy/gae-firebase-event-proxy/src/main/java/com/example/GaeFirebaseEventProxy/FirebaseEventProxy.java
+++ b/appengine/firebase-event-proxy/gae-firebase-event-proxy/src/main/java/com/example/gaefirebaseeventproxy/FirebaseEventProxy.java
@@ -69,9 +69,6 @@ public void start() {
public void onDataChange(DataSnapshot snapshot) {
if (snapshot.exists()) {
try {
- // Convert value to JSON using Jackson
- String json = new ObjectMapper().writeValueAsString(snapshot.getValue(false));
-
// Replace the URL with the url of your own listener app.
URL dest = new URL("http://gae-firebase-listener-python.appspot.com/log");
HttpURLConnection connection = (HttpURLConnection) dest.openConnection();
@@ -90,6 +87,8 @@ public void onDataChange(DataSnapshot snapshot) {
// Put Firebase data into http request
StringBuilder stringBuilder = new StringBuilder();
stringBuilder.append("&fbSnapshot=");
+ // Convert value to JSON using Jackson
+ String json = new ObjectMapper().writeValueAsString(snapshot.getValue(false));
stringBuilder.append(URLEncoder.encode(json, "UTF-8"));
connection.getOutputStream().write(stringBuilder.toString().getBytes());
if (connection.getResponseCode() != 200) {
diff --git a/appengine/firebase-event-proxy/gae-firebase-event-proxy/src/main/java/com/example/GaeFirebaseEventProxy/ServletContextListenerImpl.java b/appengine/firebase-event-proxy/gae-firebase-event-proxy/src/main/java/com/example/gaefirebaseeventproxy/ServletContextListenerImpl.java
similarity index 100%
rename from appengine/firebase-event-proxy/gae-firebase-event-proxy/src/main/java/com/example/GaeFirebaseEventProxy/ServletContextListenerImpl.java
rename to appengine/firebase-event-proxy/gae-firebase-event-proxy/src/main/java/com/example/gaefirebaseeventproxy/ServletContextListenerImpl.java
diff --git a/appengine/firebase-tictactoe/README.md b/appengine/firebase-tictactoe/README.md
index 4f4dfddb6ea..9e84abf9400 100644
--- a/appengine/firebase-tictactoe/README.md
+++ b/appengine/firebase-tictactoe/README.md
@@ -1,4 +1,6 @@
# Tic Tac Toe on Google App Engine Standard using Firebase
+
+
**Java 7 runtime support on App Engine standard was [deprecated](https://cloud.google.com/appengine/docs/deprecations/java7) on
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
diff --git a/appengine/firebase-tictactoe/pom.xml b/appengine/firebase-tictactoe/pom.xml
index c6b573475f9..a3a0e3ebf1c 100644
--- a/appengine/firebase-tictactoe/pom.xml
+++ b/appengine/firebase-tictactoe/pom.xml
@@ -19,12 +19,22 @@
1.0-SNAPSHOT
com.example.appengine
appengine-firebase-tictactoe
+
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
+
+ 1.7
+ 1.7
+
+
com.googlecode.objectify
diff --git a/appengine/firebase-tictactoe/src/test/java/com/example/appengine/firetactoe/MoveServletTest.java b/appengine/firebase-tictactoe/src/test/java/com/example/appengine/firetactoe/MoveServletTest.java
index 814d7a6fc8e..843d5c5cecc 100644
--- a/appengine/firebase-tictactoe/src/test/java/com/example/appengine/firetactoe/MoveServletTest.java
+++ b/appengine/firebase-tictactoe/src/test/java/com/example/appengine/firetactoe/MoveServletTest.java
@@ -45,6 +45,7 @@
import org.junit.After;
import org.junit.Before;
import org.junit.BeforeClass;
+import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
@@ -148,6 +149,7 @@ public LowLevelHttpResponse execute() throws IOException {
eq("PATCH"), Matchers.matches(FIREBASE_DB_URL + "/channels/[\\w-]+.json$"));
}
+ @Ignore
public void doPost_notMyTurn_move() throws Exception {
// Insert a game
Objectify ofy = ObjectifyService.ofy();
diff --git a/appengine/gaeinfo/README.md b/appengine/gaeinfo/README.md
index 1da045f4831..5f1c4039b8f 100644
--- a/appengine/gaeinfo/README.md
+++ b/appengine/gaeinfo/README.md
@@ -1,4 +1,6 @@
# Google App Engine Information
+
+
**Java 7 runtime support on App Engine standard was [deprecated](https://cloud.google.com/appengine/docs/deprecations/java7) on
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
diff --git a/appengine/gaeinfo/pom.xml b/appengine/gaeinfo/pom.xml
index 5d006eb7515..89bc1ff8356 100644
--- a/appengine/gaeinfo/pom.xml
+++ b/appengine/gaeinfo/pom.xml
@@ -21,13 +21,17 @@ Copyright 2017 Google Inc.
com.example.appengine
gaeinfo
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
1.7
diff --git a/appengine/gaeinfo/src/main/java/com/example/appengine/standard/GAEInfoServlet.java b/appengine/gaeinfo/src/main/java/com/example/appengine/standard/GAEInfoServlet.java
index 2e4d2f56b34..d14963a1386 100644
--- a/appengine/gaeinfo/src/main/java/com/example/appengine/standard/GAEInfoServlet.java
+++ b/appengine/gaeinfo/src/main/java/com/example/appengine/standard/GAEInfoServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+
package com.example.appengine.standard;
import com.google.appengine.api.appidentity.AppIdentityService;
@@ -33,9 +34,9 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+//CHECKSTYLE.OFF: AbbreviationAsWordInName - readability
// [START example]
@SuppressWarnings({"serial"})
-//CHECKSTYLE:OFF
public class GAEInfoServlet extends HttpServlet {
public void table(PrintWriter p, String title, String c) {
@@ -63,16 +64,17 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
p.print("");
final AppIdentityService appIdentity = AppIdentityServiceFactory.getAppIdentityService();
- table(p, "AppIdentity",
- tr(td("ServiceAccountName") + td(appIdentity.getServiceAccountName()) ) +
- tr(td("GCS Bucket") + td( appIdentity.getDefaultGcsBucketName()))
+ table(
+ p, "AppIdentity",
+ tr(td("ServiceAccountName") + td(appIdentity.getServiceAccountName()))
+ + tr(td("GCS Bucket") + td(appIdentity.getDefaultGcsBucketName()))
);
table(p, "SystemProperties",
- tr( td( "appId") + td(SystemProperty.applicationId.get()) ) +
- tr(td("appVer") + td( SystemProperty.applicationVersion.get()) ) +
- tr(td("version") + td(SystemProperty.version.get()) ) +
- tr(td("environment") + td(SystemProperty.environment.get()) )
+ tr(td("appId") + td(SystemProperty.applicationId.get()))
+ + tr(td("appVer") + td(SystemProperty.applicationVersion.get()))
+ + tr(td("version") + td(SystemProperty.version.get()))
+ + tr(td("environment") + td(SystemProperty.environment.get()))
);
@@ -81,13 +83,14 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
Map attr = env.getAttributes();
String c = "";
- for(String key : attr.keySet()) {
+ for (String key : attr.keySet()) {
Object o = attr.get(key);
- if(o.getClass().getCanonicalName().equals("java.lang.String")) {
+ if (o.getClass().getCanonicalName().equals("java.lang.String")) {
c += tr(td(key) + td((String) o));
- } else
+ } else {
c += tr(td(key) + td(o.getClass().getCanonicalName()));
+ }
}
table(p, "Environment Attributes", c);
@@ -95,33 +98,33 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
for (Enumeration e = req.getHeaderNames(); e.hasMoreElements();) {
String key = e.nextElement();
String val = req.getHeader(key);
- c += tr(td(key) + td(val) );;
+ c += tr(td(key) + td(val));;
}
table(p, "Headers", c);
Cookie[] cookies = req.getCookies();
- if(cookies != null && cookies.length != 0) {
+ if (cookies != null && cookies.length != 0) {
c = "";
for (Cookie co : cookies) {
- c += tr( td(co.getName()) + td(co.getValue()) + td(co.getComment()) +
- td(co.getPath()) + td(Integer.toString(co.getMaxAge())) );
+ c += tr(td(co.getName()) + td(co.getValue()) + td(co.getComment())
+ + td(co.getPath()) + td(Integer.toString(co.getMaxAge())));
}
table(p, "Cookies", c);
}
Properties properties = System.getProperties();
c = "";
- for(Enumeration e = properties.propertyNames(); e.hasMoreElements();) {
+ for (Enumeration e = properties.propertyNames(); e.hasMoreElements();) {
String key = (String) e.nextElement();
- c += tr( td(key) + td((String)properties.get(key)));
+ c += tr(td(key) + td((String)properties.get(key)));
}
table(p, "Java SystemProperties", c);
Map envVar = System.getenv();
c = "";
- for(String key : envVar.keySet()) {
- c += tr(td(key)+td(envVar.get(key)));
+ for (String key : envVar.keySet()) {
+ c += tr(td(key) + td(envVar.get(key)));
}
table(p, "Envirionment Variables", c);
p.print("");
@@ -130,3 +133,4 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
}
}
// [END example]
+//CHECKSTYLE.ON: AbbreviationAsWordInName
\ No newline at end of file
diff --git a/appengine/guestbook-cloud-datastore/README.md b/appengine/guestbook-cloud-datastore/README.md
index 52ea1e13e27..5fda7039ef2 100644
--- a/appengine/guestbook-cloud-datastore/README.md
+++ b/appengine/guestbook-cloud-datastore/README.md
@@ -1,4 +1,6 @@
# appengine/guestbook-cloud-datastore
+
+
**Java 7 runtime support on App Engine standard was [deprecated](https://cloud.google.com/appengine/docs/deprecations/java7) on
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
diff --git a/appengine/guestbook-cloud-datastore/pom.xml b/appengine/guestbook-cloud-datastore/pom.xml
index 59b8dd6b236..dceb8f74530 100644
--- a/appengine/guestbook-cloud-datastore/pom.xml
+++ b/appengine/guestbook-cloud-datastore/pom.xml
@@ -22,17 +22,23 @@
war
1.0-SNAPSHOT
+
+
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
+
com.example.appengine
appengine-guestbook-cloud-datastore
19.0
+ 1.7
+ 1.7
-
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
-
@@ -45,7 +51,7 @@
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.sdk.version}
+ 1.9.59
javax.servlet
@@ -87,19 +93,19 @@
com.google.appengine
appengine-testing
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-api-stubs
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-tools-sdk
- ${appengine.sdk.version}
+ 1.9.59
test
diff --git a/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Greeting.java b/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Greeting.java
index 13ad798fd09..cbc5a96dd35 100644
--- a/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Greeting.java
+++ b/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Greeting.java
@@ -1,18 +1,21 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
- * 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
+ * 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
+ * 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
+ * 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.
*/
//[START all]
+
package com.example.guestbook;
import static com.example.guestbook.Persistence.getDatastore;
@@ -54,7 +57,7 @@ public Greeting(String book, String content, String id, String email) {
}
public Greeting(Entity entity) {
- key = entity.hasKey() ? entity.getKey() : null;
+ key = entity.hasKey() ? entity.key() : null;
authorEmail = entity.contains("authorEmail") ? entity.getString("authorEmail") : null;
authorId = entity.contains("authorId") ? entity.getString("authorId") : null;
date = entity.contains("date") ? entity.getDateTime("date").toDate() : null;
@@ -66,7 +69,7 @@ public void save() {
key = getDatastore().allocateId(makeIncompleteKey()); // Give this greeting a unique ID
}
- Builder builder = FullEntity.newBuilder(key);
+ Builder builder = FullEntity.builder(key);
if (authorEmail != null) {
builder.set("authorEmail", authorEmail);
@@ -84,7 +87,7 @@ public void save() {
private IncompleteKey makeIncompleteKey() {
// The book is our ancestor key.
- return Key.newBuilder(book.getKey(), "Greeting").build();
+ return Key.builder(book.getKey(), "Greeting").build();
}
@Override
diff --git a/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Guestbook.java b/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Guestbook.java
index 4f2aeb69a5d..69b036fedf5 100644
--- a/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Guestbook.java
+++ b/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Guestbook.java
@@ -1,16 +1,19 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
- * 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
+ * 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
+ * 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
+ * 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.guestbook;
import static com.example.guestbook.Persistence.getDatastore;
@@ -40,8 +43,7 @@ public class Guestbook {
public Guestbook(String book) {
this.book = book == null ? "default" : book;
- key =
- keyFactory.newKey(
+ key = keyFactory.newKey(
this.book); // There is a 1:1 mapping between Guestbook names and Guestbook objects
}
@@ -52,11 +54,11 @@ public Key getKey() {
public List getGreetings() {
// This query requires the index defined in index.yaml to work because of the orderBy on date.
EntityQuery query =
- Query.newEntityQueryBuilder()
- .setKind("Greeting")
- .setFilter(hasAncestor(key))
- .setOrderBy(desc("date"))
- .setLimit(5)
+ Query.entityQueryBuilder()
+ .kind("Greeting")
+ .filter(hasAncestor(key))
+ .orderBy(desc("date"))
+ .limit(5)
.build();
QueryResults results = getDatastore().run(query);
diff --git a/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Persistence.java b/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Persistence.java
index 1b68b8541e9..ae68960703e 100644
--- a/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Persistence.java
+++ b/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Persistence.java
@@ -1,16 +1,19 @@
-/**
- * Copyright 2016 Google Inc.
+/*
+ * Copyright 2015 Google Inc.
*
- * 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
+ * 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
+ * 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
+ * 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.guestbook;
import com.google.cloud.datastore.Datastore;
@@ -25,8 +28,8 @@ public class Persistence {
public static Datastore getDatastore() {
if (datastore.get() == null) {
- datastore.set(DatastoreOptions.newBuilder().setProjectId("your-project-id-here")
- .build().getService());
+ datastore.set(DatastoreOptions.builder().projectId("your-project-id-here")
+ .build().service());
}
return datastore.get();
@@ -37,7 +40,7 @@ public static void setDatastore(Datastore datastore) {
}
public static KeyFactory getKeyFactory(Class> c) {
- return getDatastore().newKeyFactory().setKind(c.getSimpleName());
+ return getDatastore().newKeyFactory().kind(c.getSimpleName());
}
}
//[END all]
diff --git a/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/SignGuestbookServlet.java b/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/SignGuestbookServlet.java
index 2c95c5c3aee..623c85be110 100644
--- a/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/SignGuestbookServlet.java
+++ b/appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/SignGuestbookServlet.java
@@ -1,18 +1,21 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
- *
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
+ * 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
+ * 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
+ * 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.
*/
//[START all]
+
package com.example.guestbook;
import com.google.appengine.api.users.User;
diff --git a/appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/GreetingTest.java b/appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/GreetingTest.java
index a91390569ad..9f476734a74 100644
--- a/appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/GreetingTest.java
+++ b/appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/GreetingTest.java
@@ -1,29 +1,31 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
- *
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
+ * 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
+ * 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
+ * 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.guestbook;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;
+import java.util.List;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-import java.util.List;
-
@RunWith(JUnit4.class)
public class GreetingTest {
diff --git a/appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/SignGuestbookServletTest.java b/appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/SignGuestbookServletTest.java
index 4a5435eafe7..6adc74bfc18 100644
--- a/appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/SignGuestbookServletTest.java
+++ b/appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/SignGuestbookServletTest.java
@@ -1,22 +1,28 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
- *
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
+ * 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
+ * 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
+ * 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.guestbook;
import static org.junit.Assert.assertTrue;
import static org.mockito.Mockito.when;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.util.List;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -25,10 +31,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.util.List;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
@RunWith(JUnit4.class)
public class SignGuestbookServletTest {
private final LocalServiceTestHelper helper = new LocalServiceTestHelper();
diff --git a/appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/TestUtils.java b/appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/TestUtils.java
index 3780f0266f2..b23277eff8d 100644
--- a/appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/TestUtils.java
+++ b/appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/TestUtils.java
@@ -1,3 +1,19 @@
+/*
+ * Copyright 2016 Google Inc.
+ *
+ * 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.guestbook;
import static com.example.guestbook.Persistence.getDatastore;
@@ -8,7 +24,6 @@
import com.google.cloud.datastore.QueryResults;
import com.google.cloud.datastore.testing.LocalDatastoreHelper;
import com.google.common.collect.Lists;
-
import java.io.IOException;
import java.util.ArrayList;
@@ -18,7 +33,7 @@ public class TestUtils {
public static void startDatastore() {
try {
datastore.start();
- Persistence.setDatastore(datastore.getOptions().getService());
+ Persistence.setDatastore(datastore.options().service());
} catch (IOException | InterruptedException e) {
throw new RuntimeException(e);
}
@@ -35,7 +50,7 @@ public static void stopDatastore() {
public static void wipeDatastore() {
Datastore datastore = getDatastore();
- QueryResults guestbooks = datastore.run(Query.newKeyQueryBuilder().setKind("Greeting")
+ QueryResults guestbooks = datastore.run(Query.keyQueryBuilder().kind("Greeting")
.build());
ArrayList keys = Lists.newArrayList(guestbooks);
diff --git a/appengine/guestbook-objectify/README.md b/appengine/guestbook-objectify/README.md
index 45439f13e4d..367f6a4b8fa 100644
--- a/appengine/guestbook-objectify/README.md
+++ b/appengine/guestbook-objectify/README.md
@@ -1,4 +1,6 @@
# appengine/guestbook-objectify
+
+
**Java 7 runtime support on App Engine standard was [deprecated](https://cloud.google.com/appengine/docs/deprecations/java7) on
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
diff --git a/appengine/guestbook-objectify/pom.xml b/appengine/guestbook-objectify/pom.xml
index b73a555dbbe..57eac1e820f 100644
--- a/appengine/guestbook-objectify/pom.xml
+++ b/appengine/guestbook-objectify/pom.xml
@@ -25,12 +25,18 @@
5.1.21
20.0
+ 1.7
+ 1.7
+
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
@@ -41,7 +47,7 @@
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.sdk.version}
+ 1.9.59
javax.servlet
@@ -84,19 +90,19 @@
com.google.appengine
appengine-testing
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-api-stubs
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-tools-sdk
- ${appengine.sdk.version}
+ 1.9.59
test
@@ -115,7 +121,7 @@
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
false
diff --git a/appengine/guestbook-objectify/src/main/java/com/example/guestbook/Greeting.java b/appengine/guestbook-objectify/src/main/java/com/example/guestbook/Greeting.java
index 8067cd3fce7..f8976f344bd 100644
--- a/appengine/guestbook-objectify/src/main/java/com/example/guestbook/Greeting.java
+++ b/appengine/guestbook-objectify/src/main/java/com/example/guestbook/Greeting.java
@@ -1,5 +1,5 @@
-/**
- * Copyright 2014-2015 Google Inc.
+/*
+ * Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
//[START all]
+
package com.example.guestbook;
import com.googlecode.objectify.Key;
@@ -59,7 +60,7 @@ public Greeting() {
**/
public Greeting(String book, String content) {
this();
- if ( book != null ) {
+ if (book != null) {
theBook = Key.create(Guestbook.class, book); // Creating the Ancestor key
} else {
theBook = Key.create(Guestbook.class, "default");
diff --git a/appengine/guestbook-objectify/src/main/java/com/example/guestbook/Guestbook.java b/appengine/guestbook-objectify/src/main/java/com/example/guestbook/Guestbook.java
index 2b490aeff79..57f5d345095 100644
--- a/appengine/guestbook-objectify/src/main/java/com/example/guestbook/Guestbook.java
+++ b/appengine/guestbook-objectify/src/main/java/com/example/guestbook/Guestbook.java
@@ -1,5 +1,5 @@
-/**
- * Copyright 2014-2015 Google Inc.
+/*
+ * Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
//[START all]
+
package com.example.guestbook;
import com.googlecode.objectify.annotation.Entity;
diff --git a/appengine/guestbook-objectify/src/main/java/com/example/guestbook/OfyHelper.java b/appengine/guestbook-objectify/src/main/java/com/example/guestbook/OfyHelper.java
index 3d34612007c..0ce05e5a48b 100644
--- a/appengine/guestbook-objectify/src/main/java/com/example/guestbook/OfyHelper.java
+++ b/appengine/guestbook-objectify/src/main/java/com/example/guestbook/OfyHelper.java
@@ -1,16 +1,21 @@
-/**
- * Copyright 2014-2015 Google Inc.
+/*
+ * Copyright 2015 Google Inc.
+ *
+ * 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
*
- * 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.
+ * 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.
*/
+
//[START all]
+
package com.example.guestbook;
import com.googlecode.objectify.ObjectifyService;
diff --git a/appengine/guestbook-objectify/src/main/java/com/example/guestbook/SignGuestbookServlet.java b/appengine/guestbook-objectify/src/main/java/com/example/guestbook/SignGuestbookServlet.java
index e32912cb933..77ae85d3ae0 100644
--- a/appengine/guestbook-objectify/src/main/java/com/example/guestbook/SignGuestbookServlet.java
+++ b/appengine/guestbook-objectify/src/main/java/com/example/guestbook/SignGuestbookServlet.java
@@ -1,5 +1,5 @@
-/**
- * Copyright 2014-2015 Google Inc.
+/*
+ * Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
//[START all]
+
package com.example.guestbook;
import com.google.appengine.api.users.User;
diff --git a/appengine/guestbook-objectify/src/test/java/com/example/guestbook/GreetingTest.java b/appengine/guestbook-objectify/src/test/java/com/example/guestbook/GreetingTest.java
index 27d3030149d..85c8d2023a9 100644
--- a/appengine/guestbook-objectify/src/test/java/com/example/guestbook/GreetingTest.java
+++ b/appengine/guestbook-objectify/src/test/java/com/example/guestbook/GreetingTest.java
@@ -3,7 +3,9 @@
*
* 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
+ * 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,
@@ -11,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.example.guestbook;
import static com.example.guestbook.GuestbookTestUtilities.cleanDatastore;
@@ -24,7 +27,6 @@
import com.google.appengine.api.datastore.Query;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
-
import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.util.Closeable;
import org.junit.After;
diff --git a/appengine/guestbook-objectify/src/test/java/com/example/guestbook/GuestbookTestUtilities.java b/appengine/guestbook-objectify/src/test/java/com/example/guestbook/GuestbookTestUtilities.java
index cbd72b57b28..4d4d09cf3d9 100644
--- a/appengine/guestbook-objectify/src/test/java/com/example/guestbook/GuestbookTestUtilities.java
+++ b/appengine/guestbook-objectify/src/test/java/com/example/guestbook/GuestbookTestUtilities.java
@@ -3,7 +3,9 @@
*
* 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
+ * 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,
@@ -11,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.example.guestbook;
import com.google.appengine.api.datastore.DatastoreService;
@@ -20,7 +23,6 @@
import com.google.appengine.api.datastore.KeyFactory;
import com.google.appengine.api.datastore.PreparedQuery;
import com.google.appengine.api.datastore.Query;
-
import java.util.ArrayList;
import java.util.List;
diff --git a/appengine/guestbook-objectify/src/test/java/com/example/guestbook/SignGuestbookServletTest.java b/appengine/guestbook-objectify/src/test/java/com/example/guestbook/SignGuestbookServletTest.java
index 1c01ab37f8d..593650a85e2 100644
--- a/appengine/guestbook-objectify/src/test/java/com/example/guestbook/SignGuestbookServletTest.java
+++ b/appengine/guestbook-objectify/src/test/java/com/example/guestbook/SignGuestbookServletTest.java
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+
package com.example.guestbook;
import static com.example.guestbook.GuestbookTestUtilities.cleanDatastore;
@@ -28,9 +29,12 @@
import com.google.appengine.api.datastore.Query;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
-
import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.util.Closeable;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -39,12 +43,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Unit tests for {@link com.example.guestbook.SignGuestbookServlet}.
*/
@@ -81,8 +79,8 @@ public void setUp() throws Exception {
// Set up some fake HTTP requests
when(mockRequest.getRequestURI()).thenReturn(FAKE_URL);
- when(mockRequest.getParameter("guestbookName")).thenReturn( "default" );
- when(mockRequest.getParameter("content")).thenReturn( testPhrase );
+ when(mockRequest.getParameter("guestbookName")).thenReturn("default");
+ when(mockRequest.getParameter("content")).thenReturn(testPhrase);
stringWriter = new StringWriter();
when(mockResponse.getWriter()).thenReturn(new PrintWriter(stringWriter));
diff --git a/appengine/helloworld-new-plugins/README.md b/appengine/helloworld-new-plugins/README.md
index 77e861f5eb4..64b9f67041c 100644
--- a/appengine/helloworld-new-plugins/README.md
+++ b/appengine/helloworld-new-plugins/README.md
@@ -4,6 +4,9 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to deploy an application on Google App Engine.
diff --git a/appengine/helloworld-new-plugins/pom.xml b/appengine/helloworld-new-plugins/pom.xml
index f93373bc84b..5251719fbb8 100644
--- a/appengine/helloworld-new-plugins/pom.xml
+++ b/appengine/helloworld-new-plugins/pom.xml
@@ -28,11 +28,14 @@ Copyright 2015 Google Inc.
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
diff --git a/appengine/helloworld-new-plugins/src/main/java/com/example/appengine/helloworld/HelloServlet.java b/appengine/helloworld-new-plugins/src/main/java/com/example/appengine/helloworld/HelloServlet.java
index 5868bf82f9d..8f1ff88b1ec 100644
--- a/appengine/helloworld-new-plugins/src/main/java/com/example/appengine/helloworld/HelloServlet.java
+++ b/appengine/helloworld-new-plugins/src/main/java/com/example/appengine/helloworld/HelloServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/appengine/helloworld/README.md b/appengine/helloworld/README.md
index 05f7d87e50f..3e0aeb48e48 100644
--- a/appengine/helloworld/README.md
+++ b/appengine/helloworld/README.md
@@ -4,6 +4,10 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to deploy an application on Google App Engine.
diff --git a/appengine/helloworld/pom.xml b/appengine/helloworld/pom.xml
index 10dbb193de0..6710877dacf 100644
--- a/appengine/helloworld/pom.xml
+++ b/appengine/helloworld/pom.xml
@@ -20,12 +20,17 @@ Copyright 2015 Google Inc.
1.0-SNAPSHOT
com.example.appengine
appengine-helloworld
+
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
javax.servlet
@@ -51,7 +56,7 @@ Copyright 2015 Google Inc.
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/helloworld/src/main/java/com/example/appengine/helloworld/HelloServlet.java b/appengine/helloworld/src/main/java/com/example/appengine/helloworld/HelloServlet.java
index 5868bf82f9d..ba65f8c6d47 100644
--- a/appengine/helloworld/src/main/java/com/example/appengine/helloworld/HelloServlet.java
+++ b/appengine/helloworld/src/main/java/com/example/appengine/helloworld/HelloServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+
package com.example.appengine.helloworld;
import java.io.IOException;
diff --git a/appengine/iap/README.md b/appengine/iap/README.md
index 1aeed5751ef..1afde51df10 100644
--- a/appengine/iap/README.md
+++ b/appengine/iap/README.md
@@ -4,6 +4,9 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to use the [Cloud Identity-Aware Proxy][iap-docs] on [Google App
diff --git a/appengine/iap/pom.xml b/appengine/iap/pom.xml
index 15b6cd930d8..20912e49027 100644
--- a/appengine/iap/pom.xml
+++ b/appengine/iap/pom.xml
@@ -20,12 +20,16 @@ Copyright 2017 Google Inc.
com.example.appengine
appengine-iap
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
javax.servlet
diff --git a/appengine/iap/src/main/java/com/example/appengine/iap/JwtServlet.java b/appengine/iap/src/main/java/com/example/appengine/iap/JwtServlet.java
index 974c8e14a09..82ba60d4b76 100644
--- a/appengine/iap/src/main/java/com/example/appengine/iap/JwtServlet.java
+++ b/appengine/iap/src/main/java/com/example/appengine/iap/JwtServlet.java
@@ -1,16 +1,19 @@
-/**
+/*
* Copyright 2017 Google Inc.
*
- * 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
+ * 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
+ * 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
+ * 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.iap;
import java.io.IOException;
diff --git a/appengine/images/README.md b/appengine/images/README.md
index a3b66bfaab3..16b925a22a1 100644
--- a/appengine/images/README.md
+++ b/appengine/images/README.md
@@ -4,6 +4,10 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to use the Images Java API.
diff --git a/appengine/images/pom.xml b/appengine/images/pom.xml
index d5c2561ed89..a2a3af88287 100644
--- a/appengine/images/pom.xml
+++ b/appengine/images/pom.xml
@@ -24,11 +24,14 @@ Copyright 2015 Google Inc.
1.9.60
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
diff --git a/appengine/images/src/main/java/com/example/appengine/images/ImagesServlet.java b/appengine/images/src/main/java/com/example/appengine/images/ImagesServlet.java
index 2f0c1f9864a..0868f054d8a 100644
--- a/appengine/images/src/main/java/com/example/appengine/images/ImagesServlet.java
+++ b/appengine/images/src/main/java/com/example/appengine/images/ImagesServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -15,6 +15,7 @@
*/
package com.example.appengine.images;
+
import com.google.appengine.api.blobstore.BlobKey;
import com.google.appengine.api.blobstore.BlobstoreService;
import com.google.appengine.api.blobstore.BlobstoreServiceFactory;
diff --git a/appengine/logs/README.md b/appengine/logs/README.md
index 6848b4b3699..2f02caae196 100644
--- a/appengine/logs/README.md
+++ b/appengine/logs/README.md
@@ -4,6 +4,10 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to use the [Logs API][log-docs] on [Google App
diff --git a/appengine/logs/pom.xml b/appengine/logs/pom.xml
index e0b2a86518c..6e72e2fc34c 100644
--- a/appengine/logs/pom.xml
+++ b/appengine/logs/pom.xml
@@ -20,18 +20,22 @@
1.0-SNAPSHOT
com.example.appengine
appengine-logs
-
+
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.sdk.version}
+ 1.9.59
com.google.guava
@@ -72,7 +76,7 @@
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/logs/src/main/java/com/example/appengine/logs/LogsServlet.java b/appengine/logs/src/main/java/com/example/appengine/logs/LogsServlet.java
index a889763e989..068ea72e9ef 100644
--- a/appengine/logs/src/main/java/com/example/appengine/logs/LogsServlet.java
+++ b/appengine/logs/src/main/java/com/example/appengine/logs/LogsServlet.java
@@ -13,21 +13,19 @@
* limitations under the License.
*/
// [START logs_API_example]
+
package com.example.appengine.logs;
import com.google.appengine.api.log.AppLogLine;
import com.google.appengine.api.log.LogQuery;
import com.google.appengine.api.log.LogServiceFactory;
import com.google.appengine.api.log.RequestLogs;
-
-import org.joda.time.DateTime;
-
import java.io.IOException;
import java.io.PrintWriter;
-
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.joda.time.DateTime;
// Get request logs along with their app log lines and display them 5 at
diff --git a/appengine/logs/src/main/webapp/WEB-INF/web.xml b/appengine/logs/src/main/webapp/WEB-INF/web.xml
index 3b156c9b98c..b1406b5cd8d 100644
--- a/appengine/logs/src/main/webapp/WEB-INF/web.xml
+++ b/appengine/logs/src/main/webapp/WEB-INF/web.xml
@@ -13,10 +13,10 @@
limitations under the License.
-->
-
+
logs
com.example.appengine.logs.LogsServlet
diff --git a/appengine/mail/README.md b/appengine/mail/README.md
index 9d5b601753a..e0421e7e48f 100644
--- a/appengine/mail/README.md
+++ b/appengine/mail/README.md
@@ -4,6 +4,17 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to use [JavaMail][javamail-api] on [Google App Engine
diff --git a/appengine/mail/pom.xml b/appengine/mail/pom.xml
index a1e5b964c7c..ce223d5c528 100644
--- a/appengine/mail/pom.xml
+++ b/appengine/mail/pom.xml
@@ -20,24 +20,28 @@ Copyright 2016 Google Inc.
com.example.appengine
appengine-mail
-
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
javax.servlet
- servlet-api
+ javax.servlet-api
+ 3.1.0
jar
provided
com.google.appengine
appengine-api-1.0-sdk
+ 1.9.59
javax.mail
@@ -58,11 +62,10 @@ Copyright 2016 Google Inc.
1.7
-
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/mail/src/main/java/com/example/appengine/mail/BounceHandlerServlet.java b/appengine/mail/src/main/java/com/example/appengine/mail/BounceHandlerServlet.java
index 51f4536ac8a..2cdce1d668f 100644
--- a/appengine/mail/src/main/java/com/example/appengine/mail/BounceHandlerServlet.java
+++ b/appengine/mail/src/main/java/com/example/appengine/mail/BounceHandlerServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,12 +14,13 @@
* limitations under the License.
*/
+
package com.example.appengine.mail;
// [START bounce_handler_servlet]
+
import com.google.appengine.api.mail.BounceNotification;
import com.google.appengine.api.mail.BounceNotificationParser;
-
import java.io.IOException;
import java.util.logging.Logger;
import javax.mail.MessagingException;
diff --git a/appengine/mail/src/main/java/com/example/appengine/mail/HandleDiscussionEmail.java b/appengine/mail/src/main/java/com/example/appengine/mail/HandleDiscussionEmail.java
index b673497f389..90317d8694c 100644
--- a/appengine/mail/src/main/java/com/example/appengine/mail/HandleDiscussionEmail.java
+++ b/appengine/mail/src/main/java/com/example/appengine/mail/HandleDiscussionEmail.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,25 +14,28 @@
* limitations under the License.
*/
+
package com.example.appengine.mail;
+import java.util.logging.Logger;
+import java.util.regex.Matcher;
import javax.mail.internet.MimeMessage;
+import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import javax.servlet.ServletException;
-import java.util.logging.Logger;
-import java.util.regex.Matcher;
// [START example]
public class HandleDiscussionEmail extends MailHandlerBase {
private static final Logger log = Logger.getLogger(HandleDiscussionEmail.class.getName());
- public HandleDiscussionEmail() { super("discuss-(.*)@(.*)"); }
+
+ public HandleDiscussionEmail() {
+ super("discuss-(.*)@(.*)");
+ }
@Override
- protected boolean processMessage(HttpServletRequest req, HttpServletResponse res)
- throws ServletException
- {
+ protected boolean processMessage(
+ HttpServletRequest req, HttpServletResponse res) throws ServletException {
log.info("Received e-mail sent to discuss list.");
MimeMessage msg = getMessageFromRequest(req);
Matcher match = getMatcherFromRequest(req);
diff --git a/appengine/mail/src/main/java/com/example/appengine/mail/MailHandlerBase.java b/appengine/mail/src/main/java/com/example/appengine/mail/MailHandlerBase.java
index dd16582bb39..dd8093064d8 100644
--- a/appengine/mail/src/main/java/com/example/appengine/mail/MailHandlerBase.java
+++ b/appengine/mail/src/main/java/com/example/appengine/mail/MailHandlerBase.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,23 +14,24 @@
* limitations under the License.
*/
+
package com.example.appengine.mail;
-import javax.mail.internet.MimeMessage;
+import java.io.IOException;
+import java.util.Properties;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
import javax.mail.MessagingException;
import javax.mail.Session;
+import javax.mail.internet.MimeMessage;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
import javax.servlet.FilterConfig;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
import javax.servlet.ServletException;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
-import java.io.IOException;
-import java.util.Properties;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
/**
* Base class for handling the filtering of incoming emails in App Engine.
@@ -41,11 +42,10 @@ public abstract class MailHandlerBase implements Filter {
private Pattern pattern = null;
protected MailHandlerBase(String pattern) {
- if (pattern == null || pattern.trim().length() == 0)
- {
+ if (pattern == null || pattern.trim().length() == 0) {
throw new IllegalArgumentException("Expected non-empty regular expression");
}
- this.pattern = Pattern.compile("/_ah/mail/"+pattern);
+ this.pattern = Pattern.compile("/_ah/mail/" + pattern);
}
@Override public void init(FilterConfig config) throws ServletException { }
@@ -63,7 +63,8 @@ protected MailHandlerBase(String pattern) {
* The Matcher for the pattern can be retrieved via
* getMatcherFromRequest (e.g. if groups are used in the pattern).
*/
- protected abstract boolean processMessage(HttpServletRequest req, HttpServletResponse res) throws ServletException;
+ protected abstract boolean processMessage(
+ HttpServletRequest req, HttpServletResponse res) throws ServletException;
@Override
public void doFilter(ServletRequest sreq, ServletResponse sres, FilterChain chain)
@@ -85,7 +86,9 @@ public void doFilter(ServletRequest sreq, ServletResponse sres, FilterChain chai
private Matcher applyPattern(HttpServletRequest req) {
Matcher m = pattern.matcher(req.getServletPath());
- if (!m.matches()) m = null;
+ if (!m.matches()) {
+ m = null;
+ }
req.setAttribute("matcher", m);
return m;
diff --git a/appengine/mail/src/main/java/com/example/appengine/mail/MailHandlerServlet.java b/appengine/mail/src/main/java/com/example/appengine/mail/MailHandlerServlet.java
index 0262d41c95a..a0b9179bdd9 100644
--- a/appengine/mail/src/main/java/com/example/appengine/mail/MailHandlerServlet.java
+++ b/appengine/mail/src/main/java/com/example/appengine/mail/MailHandlerServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,14 +17,13 @@
package com.example.appengine.mail;
// [START mail_handler_servlet]
+
import java.io.IOException;
-import java.util.logging.Logger;
import java.util.Properties;
-
+import java.util.logging.Logger;
import javax.mail.MessagingException;
import javax.mail.Session;
import javax.mail.internet.MimeMessage;
-
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
diff --git a/appengine/mail/src/main/java/com/example/appengine/mail/MailServlet.java b/appengine/mail/src/main/java/com/example/appengine/mail/MailServlet.java
index a51fe854c6a..b574188d226 100644
--- a/appengine/mail/src/main/java/com/example/appengine/mail/MailServlet.java
+++ b/appengine/mail/src/main/java/com/example/appengine/mail/MailServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,34 +14,34 @@
* limitations under the License.
*/
+
package com.example.appengine.mail;
// [START simple_includes]
+
+import java.io.ByteArrayInputStream;
import java.io.IOException;
+import java.io.InputStream;
+import java.io.UnsupportedEncodingException;
import java.util.Properties;
import javax.mail.Message;
import javax.mail.MessagingException;
+import javax.mail.Multipart;
import javax.mail.Session;
import javax.mail.Transport;
import javax.mail.internet.AddressException;
import javax.mail.internet.InternetAddress;
-import javax.mail.internet.MimeMessage;
-// [END simple_includes]
-
-// [START multipart_includes]
-import java.io.InputStream;
-import java.io.ByteArrayInputStream;
-import java.io.UnsupportedEncodingException;
-import javax.activation.DataHandler;
-import javax.mail.Multipart;
import javax.mail.internet.MimeBodyPart;
+import javax.mail.internet.MimeMessage;
import javax.mail.internet.MimeMultipart;
-// [END multipart_includes]
-
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+// [END simple_includes]
+// [START multipart_includes]
+// [END multipart_includes]
+
@SuppressWarnings("serial")
public class MailServlet extends HttpServlet {
diff --git a/appengine/mail/src/main/webapp/WEB-INF/web.xml b/appengine/mail/src/main/webapp/WEB-INF/web.xml
index 393f67066ad..6502cf87b16 100644
--- a/appengine/mail/src/main/webapp/WEB-INF/web.xml
+++ b/appengine/mail/src/main/webapp/WEB-INF/web.xml
@@ -11,10 +11,10 @@
See the License for the specific language governing permissions and
limitations under the License.
-->
-
+
mail
com.example.appengine.mail.MailServlet
diff --git a/appengine/mailgun/README.md b/appengine/mailgun/README.md
index 00d5a393763..3be087512b5 100644
--- a/appengine/mailgun/README.md
+++ b/appengine/mailgun/README.md
@@ -4,6 +4,10 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to use [Mailgun][mailgun-api] on [Google App Engine
diff --git a/appengine/mailgun/pom.xml b/appengine/mailgun/pom.xml
index afdb72a5a76..685c242aec2 100644
--- a/appengine/mailgun/pom.xml
+++ b/appengine/mailgun/pom.xml
@@ -19,12 +19,22 @@
1.0-SNAPSHOT
com.example.appengine
appengine-mailgun
+
+
+ 1.7
+ 1.7
+
+
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
javax.servlet
@@ -58,7 +68,7 @@
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/mailgun/src/main/java/com/example/appengine/mailgun/MailgunServlet.java b/appengine/mailgun/src/main/java/com/example/appengine/mailgun/MailgunServlet.java
index ad30b5e983a..25f797c792b 100644
--- a/appengine/mailgun/src/main/java/com/example/appengine/mailgun/MailgunServlet.java
+++ b/appengine/mailgun/src/main/java/com/example/appengine/mailgun/MailgunServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+
package com.example.appengine.mailgun;
import com.sun.jersey.api.client.Client;
@@ -58,13 +59,13 @@ public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOEx
private ClientResponse sendSimpleMessage(String recipient) {
Client client = Client.create();
client.addFilter(new HTTPBasicAuthFilter("api", MAILGUN_API_KEY));
- WebResource webResource = client.resource("https://api.mailgun.net/v3/" + MAILGUN_DOMAIN_NAME
- + "/messages");
MultivaluedMapImpl formData = new MultivaluedMapImpl();
formData.add("from", "Mailgun User ");
formData.add("to", recipient);
formData.add("subject", "Simple Mailgun Example");
formData.add("text", "Plaintext content");
+ WebResource webResource = client.resource(
+ "https://api.mailgun.net/v3/" + MAILGUN_DOMAIN_NAME + "/messages");
return webResource.type(MediaType.APPLICATION_FORM_URLENCODED).post(ClientResponse.class,
formData);
}
@@ -74,8 +75,6 @@ private ClientResponse sendSimpleMessage(String recipient) {
private ClientResponse sendComplexMessage(String recipient) {
Client client = Client.create();
client.addFilter(new HTTPBasicAuthFilter("api", MAILGUN_API_KEY));
- WebResource webResource = client.resource("https://api.mailgun.net/v3/" + MAILGUN_DOMAIN_NAME
- + "/messages");
FormDataMultiPart formData = new FormDataMultiPart();
formData.field("from", "Mailgun User ");
formData.field("to", recipient);
@@ -84,6 +83,8 @@ private ClientResponse sendComplexMessage(String recipient) {
ClassLoader classLoader = getClass().getClassLoader();
File txtFile = new File(classLoader.getResource("example-attachment.txt").getFile());
formData.bodyPart(new FileDataBodyPart("attachment", txtFile, MediaType.TEXT_PLAIN_TYPE));
+ WebResource webResource = client.resource(
+ "https://api.mailgun.net/v3/" + MAILGUN_DOMAIN_NAME + "/messages");
return webResource.type(MediaType.MULTIPART_FORM_DATA_TYPE)
.post(ClientResponse.class, formData);
}
diff --git a/appengine/mailjet/README.md b/appengine/mailjet/README.md
index 3e4354bba56..4e819980dd4 100644
--- a/appengine/mailjet/README.md
+++ b/appengine/mailjet/README.md
@@ -4,6 +4,10 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to use [Mailjet](https://www.mailjet.com/) on Google Managed VMs to
diff --git a/appengine/mailjet/pom.xml b/appengine/mailjet/pom.xml
index 06bec4e634b..7bdbdaabb9b 100644
--- a/appengine/mailjet/pom.xml
+++ b/appengine/mailjet/pom.xml
@@ -19,15 +19,23 @@
1.0-SNAPSHOT
com.example.appengine
appengine-mailjet
+
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
+ 1.7
+ 1.7
4.1.1
+
com.mailjet
@@ -66,7 +74,7 @@
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/mailjet/src/main/java/com/example/appengine/mailjet/MailjetServlet.java b/appengine/mailjet/src/main/java/com/example/appengine/mailjet/MailjetServlet.java
index 2b13d055f72..3a133c1a0b0 100644
--- a/appengine/mailjet/src/main/java/com/example/appengine/mailjet/MailjetServlet.java
+++ b/appengine/mailjet/src/main/java/com/example/appengine/mailjet/MailjetServlet.java
@@ -1,5 +1,5 @@
-/**
- * Copyright 2016 Google Inc.
+/*
+ * Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,34 +13,35 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
// [START mailjet_imports]
+
package com.example.appengine.mailjet;
+import com.mailjet.client.ClientOptions;
import com.mailjet.client.MailjetClient;
import com.mailjet.client.MailjetRequest;
import com.mailjet.client.MailjetResponse;
import com.mailjet.client.errors.MailjetException;
-import com.mailjet.client.ClientOptions;
import com.mailjet.client.errors.MailjetSocketTimeoutException;
import com.mailjet.client.resource.Emailv31;
-// [END mailjet_imports]
-
-import org.json.JSONArray;
-import org.json.JSONObject;
-
import java.io.IOException;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.json.JSONArray;
+import org.json.JSONObject;
+
+// [END mailjet_imports]
// [START app]
@SuppressWarnings("serial")
public class MailjetServlet extends HttpServlet {
private static final String MAILJET_API_KEY = System.getenv("MAILJET_API_KEY");
private static final String MAILJET_SECRET_KEY = System.getenv("MAILJET_SECRET_KEY");
- private MailjetClient client = new MailjetClient(MAILJET_API_KEY, MAILJET_SECRET_KEY, new ClientOptions("v3.1"));
+ private MailjetClient client = new MailjetClient(
+ MAILJET_API_KEY, MAILJET_SECRET_KEY, new ClientOptions("v3.1"));
@Override
public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException,
@@ -49,17 +50,21 @@ public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOEx
String sender = req.getParameter("from");
MailjetRequest email = new MailjetRequest(Emailv31.resource)
- .property(Emailv31.MESSAGES, new JSONArray()
+ .property(Emailv31.MESSAGES, new JSONArray()
.put(new JSONObject()
- .put(Emailv31.Message.FROM, new JSONObject()
+ .put(Emailv31.Message.FROM, new JSONObject()
.put("Email", sender)
.put("Name", "pandora"))
- .put(Emailv31.Message.TO, new JSONArray()
- .put(new JSONObject()
- .put("Email", recipient)))
- .put(Emailv31.Message.SUBJECT, "Your email flight plan!")
- .put(Emailv31.Message.TEXTPART, "Dear passenger, welcome to Mailjet! May the delivery force be with you!")
- .put(Emailv31.Message.HTMLPART, "Dear passenger, welcome to Mailjet!
May the delivery force be with you!")));
+ .put(Emailv31.Message.TO, new JSONArray()
+ .put(new JSONObject().put("Email", recipient)))
+ .put(Emailv31.Message.SUBJECT, "Your email flight plan!")
+ .put(
+ Emailv31.Message.TEXTPART,
+ "Dear passenger, welcome to Mailjet! May the delivery force be with you!")
+ .put(
+ Emailv31.Message.HTMLPART,
+ "Dear passenger, welcome to Mailjet!
"
+ + "May the delivery force be with you!")));
try {
// trigger the API call
diff --git a/appengine/memcache/pom.xml b/appengine/memcache/pom.xml
index 0185508307e..c84d35328ad 100644
--- a/appengine/memcache/pom.xml
+++ b/appengine/memcache/pom.xml
@@ -20,13 +20,17 @@ Copyright 2015 Google Inc.
com.example.appengine
appengine-memcache
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
javax.servlet
@@ -41,6 +45,7 @@ Copyright 2015 Google Inc.
com.google.appengine
appengine-api-1.0-sdk
+ 1.9.59
com.googlecode.xmemcached
@@ -57,7 +62,7 @@ Copyright 2015 Google Inc.
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
org.apache.maven.plugins
diff --git a/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheAsyncCacheServlet.java b/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheAsyncCacheServlet.java
index d1960e06cb5..4d5e38795f5 100644
--- a/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheAsyncCacheServlet.java
+++ b/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheAsyncCacheServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheBestPracticeServlet.java b/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheBestPracticeServlet.java
index b4bd8cc9cc9..91e8f8531fb 100644
--- a/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheBestPracticeServlet.java
+++ b/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheBestPracticeServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheConcurrentServlet.java b/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheConcurrentServlet.java
index 212c5d990a8..08d7ecd6b69 100644
--- a/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheConcurrentServlet.java
+++ b/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheConcurrentServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheSyncCacheServlet.java b/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheSyncCacheServlet.java
index 97307dc10e6..365452bb9c8 100644
--- a/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheSyncCacheServlet.java
+++ b/appengine/memcache/src/main/java/com/example/appengine/memcache/MemcacheSyncCacheServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/appengine/multitenancy/README.md b/appengine/multitenancy/README.md
index fa179c63702..b07262710b2 100644
--- a/appengine/multitenancy/README.md
+++ b/appengine/multitenancy/README.md
@@ -4,6 +4,10 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
Shows the usage of the Namespaces API.
diff --git a/appengine/multitenancy/pom.xml b/appengine/multitenancy/pom.xml
index 512f5274a4b..d53a17e9610 100644
--- a/appengine/multitenancy/pom.xml
+++ b/appengine/multitenancy/pom.xml
@@ -23,16 +23,22 @@
com.example.appengine
appengine-multitenancy
+
+
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
+
5.1.21
20.0
+ 1.7
+ 1.7
-
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
-
@@ -42,7 +48,7 @@
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.sdk.version}
+ 1.9.59
javax.servlet
@@ -85,19 +91,19 @@
com.google.appengine
appengine-testing
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-api-stubs
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-tools-sdk
- ${appengine.sdk.version}
+ 1.9.59
test
@@ -116,7 +122,7 @@
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
false
diff --git a/appengine/multitenancy/src/main/java/com/example/appengine/Greeting.java b/appengine/multitenancy/src/main/java/com/example/appengine/Greeting.java
index c0645fc4fd8..a3915dd3c8b 100644
--- a/appengine/multitenancy/src/main/java/com/example/appengine/Greeting.java
+++ b/appengine/multitenancy/src/main/java/com/example/appengine/Greeting.java
@@ -1,5 +1,5 @@
-/**
- * Copyright 2014-2015 Google Inc.
+/*
+ * Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
//[START all]
+
package com.example.appengine;
import com.googlecode.objectify.Key;
@@ -22,7 +23,6 @@
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Index;
import com.googlecode.objectify.annotation.Parent;
-
import java.util.Date;
/**
@@ -58,7 +58,7 @@ public Greeting() {
**/
public Greeting(String book, String content) {
this();
- if ( book != null ) {
+ if (book != null) {
theBook = Key.create(Guestbook.class, book); // Creating the Ancestor key
} else {
theBook = Key.create(Guestbook.class, "default");
diff --git a/appengine/multitenancy/src/main/java/com/example/appengine/Guestbook.java b/appengine/multitenancy/src/main/java/com/example/appengine/Guestbook.java
index 1da82bc5b7f..202f909ab3b 100644
--- a/appengine/multitenancy/src/main/java/com/example/appengine/Guestbook.java
+++ b/appengine/multitenancy/src/main/java/com/example/appengine/Guestbook.java
@@ -1,5 +1,5 @@
-/**
- * Copyright 2014-2015 Google Inc.
+/*
+ * Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,6 +15,7 @@
*/
//[START all]
+
package com.example.appengine;
import com.googlecode.objectify.annotation.Entity;
diff --git a/appengine/multitenancy/src/main/java/com/example/appengine/MultitenancyServlet.java b/appengine/multitenancy/src/main/java/com/example/appengine/MultitenancyServlet.java
index ad206f06496..a9db780f33b 100644
--- a/appengine/multitenancy/src/main/java/com/example/appengine/MultitenancyServlet.java
+++ b/appengine/multitenancy/src/main/java/com/example/appengine/MultitenancyServlet.java
@@ -3,7 +3,9 @@
*
* 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
+ * 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,
@@ -23,10 +25,8 @@
import com.google.appengine.api.search.SearchServiceConfig;
import com.google.appengine.api.search.SearchServiceFactory;
import com.google.appengine.api.users.UserServiceFactory;
-
import java.io.IOException;
import java.io.PrintWriter;
-
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -43,15 +43,15 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
out.println("Code Snippets -- not yet fully runnable as an app");
// [START temp_namespace]
-// Set the namepace temporarily to "abc"
+ // Set the namepace temporarily to "abc"
String oldNamespace = NamespaceManager.get();
NamespaceManager.set("abc");
try {
-// ... perform operation using current namespace ...
+ // ... perform operation using current namespace ...
} finally {
NamespaceManager.set(oldNamespace);
}
-// [END temp_namespace]
+ // [END temp_namespace]
// [START per_user_namespace]
if (com.google.appengine.api.NamespaceManager.get() == null) {
@@ -59,7 +59,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
namespace = UserServiceFactory.getUserService().getCurrentUser().getUserId();
NamespaceManager.set(namespace);
}
-// [END per_user_namespace]
+ // [END per_user_namespace]
String value = "something here";
// [START ns_memcache]
@@ -75,7 +75,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
} finally {
NamespaceManager.set(oldNamespace);
}
-// [END ns_memcache]
+ // [END ns_memcache]
// [START specific_memcache]
// Create a MemcacheService that uses the namespace "abc".
@@ -104,11 +104,9 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
indexSpec = IndexSpec.newBuilder().setName("myindex").build();
// Create an Index with the namespace "anotherSpace"
index = searchService.getIndex(indexSpec);
- // [END searchns_2]
+ // [END searchns_2]
}
-
-
}
// [END example]
diff --git a/appengine/multitenancy/src/main/java/com/example/appengine/NamespaceFilter.java b/appengine/multitenancy/src/main/java/com/example/appengine/NamespaceFilter.java
index ed412169c99..66cc16b8ee5 100644
--- a/appengine/multitenancy/src/main/java/com/example/appengine/NamespaceFilter.java
+++ b/appengine/multitenancy/src/main/java/com/example/appengine/NamespaceFilter.java
@@ -3,7 +3,9 @@
*
* 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
+ * 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,
@@ -15,7 +17,6 @@
package com.example.appengine;
import com.google.appengine.api.NamespaceManager;
-
import java.io.IOException;
import javax.servlet.Filter;
import javax.servlet.FilterChain;
@@ -38,7 +39,7 @@ public void doFilter(ServletRequest req, ServletResponse res, FilterChain chain)
}
chain.doFilter(req, res); // Pass request back down the filter chain
}
-// [END nsfilter]
+ // [END nsfilter]
@Override
public void init(FilterConfig filterConfig) throws ServletException {
diff --git a/appengine/multitenancy/src/main/java/com/example/appengine/OfyHelper.java b/appengine/multitenancy/src/main/java/com/example/appengine/OfyHelper.java
index 8dcd38e8d1f..42bcf8c5c2c 100644
--- a/appengine/multitenancy/src/main/java/com/example/appengine/OfyHelper.java
+++ b/appengine/multitenancy/src/main/java/com/example/appengine/OfyHelper.java
@@ -1,5 +1,5 @@
-/**
- * Copyright 2014-2015 Google Inc.
+/*
+ * Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -13,11 +13,12 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
//[START all]
+
package com.example.appengine;
import com.googlecode.objectify.ObjectifyService;
-
import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;
diff --git a/appengine/multitenancy/src/main/java/com/example/appengine/SignGuestbookServlet.java b/appengine/multitenancy/src/main/java/com/example/appengine/SignGuestbookServlet.java
index 8726c91ce24..a2acef3030a 100644
--- a/appengine/multitenancy/src/main/java/com/example/appengine/SignGuestbookServlet.java
+++ b/appengine/multitenancy/src/main/java/com/example/appengine/SignGuestbookServlet.java
@@ -1,5 +1,5 @@
-/**
- * Copyright 2014-2015 Google Inc.
+/*
+ * Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,16 +15,14 @@
*/
//[START all]
+
package com.example.appengine;
import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
-
import com.googlecode.objectify.ObjectifyService;
-
import java.io.IOException;
-
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
diff --git a/appengine/multitenancy/src/main/java/com/example/appengine/SomeRequestServlet.java b/appengine/multitenancy/src/main/java/com/example/appengine/SomeRequestServlet.java
index 4157164a1f4..79aae9ca7a1 100644
--- a/appengine/multitenancy/src/main/java/com/example/appengine/SomeRequestServlet.java
+++ b/appengine/multitenancy/src/main/java/com/example/appengine/SomeRequestServlet.java
@@ -3,7 +3,9 @@
*
* 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
+ * 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,
@@ -11,14 +13,14 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+
package com.example.appengine;
import com.google.appengine.api.NamespaceManager;
import com.google.appengine.api.taskqueue.QueueFactory;
import com.google.appengine.api.taskqueue.TaskOptions;
-
import java.io.IOException;
-
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
diff --git a/appengine/multitenancy/src/main/java/com/example/appengine/UpdateCountsServlet.java b/appengine/multitenancy/src/main/java/com/example/appengine/UpdateCountsServlet.java
index cb1fbe8a3e3..d367ae4bc20 100644
--- a/appengine/multitenancy/src/main/java/com/example/appengine/UpdateCountsServlet.java
+++ b/appengine/multitenancy/src/main/java/com/example/appengine/UpdateCountsServlet.java
@@ -3,7 +3,9 @@
*
* 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
+ * 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,
@@ -11,16 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
+
package com.example.appengine;
import static com.googlecode.objectify.ObjectifyService.ofy;
import com.google.appengine.api.NamespaceManager;
-
import com.googlecode.objectify.annotation.Entity;
import com.googlecode.objectify.annotation.Id;
import com.googlecode.objectify.annotation.Index;
-
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
@@ -61,7 +63,7 @@ public long updateCount(String countName) {
return cp.count;
}
-// [END tq_1]
+ // [END tq_1]
@Override
protected void doGet(HttpServletRequest req, HttpServletResponse resp)
diff --git a/appengine/multitenancy/src/test/java/com/example/appengine/GreetingTest.java b/appengine/multitenancy/src/test/java/com/example/appengine/GreetingTest.java
index b58b2f3d9f6..4d4a9a8a869 100644
--- a/appengine/multitenancy/src/test/java/com/example/appengine/GreetingTest.java
+++ b/appengine/multitenancy/src/test/java/com/example/appengine/GreetingTest.java
@@ -3,7 +3,9 @@
*
* 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
+ * 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,
@@ -11,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.example.appengine;
import static com.example.appengine.GuestbookTestUtilities.cleanDatastore;
@@ -24,7 +27,6 @@
import com.google.appengine.api.datastore.Query;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
-
import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.util.Closeable;
import org.junit.After;
@@ -33,7 +35,6 @@
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
-
@RunWith(JUnit4.class)
public class GreetingTest {
private static final String TEST_CONTENT = "The world is Blue today";
diff --git a/appengine/multitenancy/src/test/java/com/example/appengine/GuestbookTestUtilities.java b/appengine/multitenancy/src/test/java/com/example/appengine/GuestbookTestUtilities.java
index 6b2c41761d0..f8bfaa17acb 100644
--- a/appengine/multitenancy/src/test/java/com/example/appengine/GuestbookTestUtilities.java
+++ b/appengine/multitenancy/src/test/java/com/example/appengine/GuestbookTestUtilities.java
@@ -3,7 +3,9 @@
*
* 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
+ * 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,
@@ -11,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.example.appengine;
import com.google.appengine.api.datastore.DatastoreService;
@@ -20,7 +23,6 @@
import com.google.appengine.api.datastore.KeyFactory;
import com.google.appengine.api.datastore.PreparedQuery;
import com.google.appengine.api.datastore.Query;
-
import java.util.ArrayList;
import java.util.List;
diff --git a/appengine/multitenancy/src/test/java/com/example/appengine/SignGuestbookServletTest.java b/appengine/multitenancy/src/test/java/com/example/appengine/SignGuestbookServletTest.java
index 7a532ca9d3f..b638cb0df4e 100644
--- a/appengine/multitenancy/src/test/java/com/example/appengine/SignGuestbookServletTest.java
+++ b/appengine/multitenancy/src/test/java/com/example/appengine/SignGuestbookServletTest.java
@@ -1,5 +1,5 @@
/*
- * Copyright 2015 Google Inc.
+ * Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -28,9 +28,12 @@
import com.google.appengine.api.datastore.Query;
import com.google.appengine.tools.development.testing.LocalDatastoreServiceTestConfig;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
-
import com.googlecode.objectify.ObjectifyService;
import com.googlecode.objectify.util.Closeable;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -39,12 +42,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Unit tests for {@link com.example.appengine.SignGuestbookServlet}.
*/
@@ -81,8 +78,8 @@ public void setUp() throws Exception {
// Set up some fake HTTP requests
when(mockRequest.getRequestURI()).thenReturn(FAKE_URL);
- when(mockRequest.getParameter("guestbookName")).thenReturn( "default" );
- when(mockRequest.getParameter("content")).thenReturn( testPhrase );
+ when(mockRequest.getParameter("guestbookName")).thenReturn("default");
+ when(mockRequest.getParameter("content")).thenReturn(testPhrase);
stringWriter = new StringWriter();
when(mockResponse.getWriter()).thenReturn(new PrintWriter(stringWriter));
diff --git a/appengine/oauth2/README.md b/appengine/oauth2/README.md
index eda98a6c876..53c54a87986 100644
--- a/appengine/oauth2/README.md
+++ b/appengine/oauth2/README.md
@@ -4,6 +4,10 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
## Oauth2 Sample
diff --git a/appengine/oauth2/pom.xml b/appengine/oauth2/pom.xml
index 024dab38fa9..3dafb06e47d 100644
--- a/appengine/oauth2/pom.xml
+++ b/appengine/oauth2/pom.xml
@@ -20,18 +20,27 @@
com.example.appengine
appengine-oauth2
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
+ 1.7
+ 1.7
+
+
+
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.sdk.version}
+ 1.9.59
@@ -55,7 +64,7 @@
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/oauth2/src/main/java/com/example/appengine/HelloServlet.java b/appengine/oauth2/src/main/java/com/example/appengine/HelloServlet.java
index 35e0e1762ed..1077c2845bd 100644
--- a/appengine/oauth2/src/main/java/com/example/appengine/HelloServlet.java
+++ b/appengine/oauth2/src/main/java/com/example/appengine/HelloServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/appengine/oauth2/src/main/java/com/example/appengine/Oauth2Filter.java b/appengine/oauth2/src/main/java/com/example/appengine/Oauth2Filter.java
index f5cf8a969da..60adee465f4 100644
--- a/appengine/oauth2/src/main/java/com/example/appengine/Oauth2Filter.java
+++ b/appengine/oauth2/src/main/java/com/example/appengine/Oauth2Filter.java
@@ -1,9 +1,11 @@
/*
- * Copyright 2016 Google Inc.
+ * Copyright 2015 Google Inc.
*
* 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
+ * 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,
@@ -11,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.example.appengine;
import static com.google.appengine.api.utils.SystemProperty.environment;
@@ -70,8 +73,8 @@ public void doFilter(
try {
String tokenAudience = oauth.getClientId(scope);
- // The line below is commented out for privacy.
-// context.log("tokenAudience: " + tokenAudience); // Account we match
+ // The line below is commented out for privacy.
+ // context.log("tokenAudience: " + tokenAudience); // Account we match
if (!allowedClients.contains(tokenAudience)) {
throw new OAuthRequestException("audience of token '" + tokenAudience
diff --git a/appengine/pom.xml b/appengine/pom.xml
index 355bc4dfb63..b903ac8a8d2 100644
--- a/appengine/pom.xml
+++ b/appengine/pom.xml
@@ -14,42 +14,30 @@
limitations under the License.
-->
- 4.0.0
- 1.0.0
+ 4.0.0
+ 1.0.0
+ com.google.cloud
+ appengine-doc-samples
+ pom
+
+
+
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
- com.google.cloud
- appengine-doc-samples
- pom
-
-
-
- doc-samples
- com.google.cloud
- 1.0.0
- ..
-
-
-
- 1.9.60
- 1
-
- 1.19.0
- 1.19.0
-
- 1.7
- 1.7
-
analytics
appidentity
- channel
cloudsql
datastore
- datastore/indexes
- datastore/indexes-exploding
- datastore/indexes-perfect
+
endpoints-frameworks-v2/backend
endpoints-frameworks-v2/migration-example
endpoints-frameworks-v2/guice-example
@@ -58,15 +46,15 @@
firebase-event-proxy/gae-firebase-event-proxy
firebase-tictactoe
-
gaeinfo
-
+ guestbook-cloud-datastore
guestbook-objectify
helloworld
helloworld-new-plugins
iap
images
logs
+ mail
mailgun
mailjet
memcache
@@ -76,11 +64,11 @@
requests
search
sendgrid
+
remote/remote-client
remote/remote-server
sockets
-
static-files
taskqueue
twilio
@@ -88,62 +76,4 @@
users
-
-
-
-
- com.google.appengine
- appengine-api-1.0-sdk
- ${appengine.sdk.version}
-
-
-
- jstl
- jstl
- 1.2
-
-
-
-
- junit
- junit
- 4.12
- test
-
-
- org.mockito
- mockito-core
- 2.13.0
- test
-
-
- com.jcabi
- jcabi-matchers
- 1.4
-
-
- com.google.appengine
- appengine-testing
- ${appengine.sdk.version}
- test
-
-
- com.google.appengine
- appengine-api-stubs
- ${appengine.sdk.version}
- test
-
-
-
-
-
-
-
- org.apache.maven.plugins
- maven-compiler-plugin
- 3.3
-
-
-
-
diff --git a/appengine/pusher-chat/README.md b/appengine/pusher-chat/README.md
index 9ba5af424d7..f429326e241 100644
--- a/appengine/pusher-chat/README.md
+++ b/appengine/pusher-chat/README.md
@@ -4,6 +4,10 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to use the [Pusher][pusher] on [Google App Engine][ae-docs].
diff --git a/appengine/pusher-chat/pom.xml b/appengine/pusher-chat/pom.xml
index 7abe9b57ac7..7ca23787fae 100644
--- a/appengine/pusher-chat/pom.xml
+++ b/appengine/pusher-chat/pom.xml
@@ -20,13 +20,17 @@ Copyright 2017 Google Inc.
com.example.appengine
appengine-pusher-chat
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
1.7
1.7
diff --git a/appengine/pusher-chat/src/main/java/com/example/appengine/pusher/AuthorizeServlet.java b/appengine/pusher-chat/src/main/java/com/example/appengine/pusher/AuthorizeServlet.java
index e6e217de2f4..71aad01c40b 100644
--- a/appengine/pusher-chat/src/main/java/com/example/appengine/pusher/AuthorizeServlet.java
+++ b/appengine/pusher-chat/src/main/java/com/example/appengine/pusher/AuthorizeServlet.java
@@ -72,24 +72,24 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
String auth =
pusher.authenticate(socketId, channelId, new PresenceUser(currentUserId, userInfo));
// if successful, returns authorization in the format
- // {
- // "auth":"49e26cb8e9dde3dfc009:a8cf1d3deefbb1bdc6a9d1547640d49d94b4b512320e2597c257a740edd1788f",
- // "channel_data":"{\"user_id\":\"23423435252\",\"user_info\":{\"displayName\":\"John Doe\"}}"
- // }
+ //{
+ // "auth":"49e26cb8e9dde3dfc009:a8cf1d3deefbb1bdc6a9d1547640d49d94b4b512320e2597c257a740edd17",
+ // "channel_data":"{\"user_id\":\"23423435252\",\"user_info\":{\"displayName\":\"John Doe\"}}"
+ //}
response.getWriter().append(auth);
}
private static Map splitQuery(String query) throws UnsupportedEncodingException {
- Map query_pairs = new HashMap<>();
+ Map queryPairs = new HashMap<>();
String[] pairs = query.split("&");
for (String pair : pairs) {
int idx = pair.indexOf("=");
- query_pairs.put(
+ queryPairs.put(
URLDecoder.decode(pair.substring(0, idx), "UTF-8"),
URLDecoder.decode(pair.substring(idx + 1), "UTF-8"));
}
- return query_pairs;
+ return queryPairs;
}
}
// [END pusher_authorize]
diff --git a/appengine/pusher-chat/src/main/java/com/example/appengine/pusher/SendMessageServlet.java b/appengine/pusher-chat/src/main/java/com/example/appengine/pusher/SendMessageServlet.java
index 4119439bdbc..68b6aaccc5d 100644
--- a/appengine/pusher-chat/src/main/java/com/example/appengine/pusher/SendMessageServlet.java
+++ b/appengine/pusher-chat/src/main/java/com/example/appengine/pusher/SendMessageServlet.java
@@ -49,7 +49,8 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
// [{"message": "my-message", "socket_id": "1232.24", "channel": "presence-my-channel"}]
String body = CharStreams.readLines(request.getReader()).toString();
- String json = body.replaceFirst("^\\[", "").replaceFirst("\\]$", "");
+ String json = body.replaceFirst("^\\[", "")
+ .replaceFirst("\\]$", "");
Map data = gson.fromJson(json, typeReference.getType());
String message = data.get("message");
String socketId = data.get("socket_id");
@@ -71,7 +72,8 @@ public void doPost(HttpServletRequest request, HttpServletResponse response) thr
channelId,
"new_message", // name of event
messageData,
- socketId); // (optional) use client socket_id to exclude the sender from receiving the message
+ // (optional) use client socket_id to exclude the sender from receiving the message
+ socketId);
// result.getStatus() == SUCCESS indicates successful transmission
messageData.put("status", result.getStatus().name());
diff --git a/appengine/remote/README.md b/appengine/remote/README.md
index bc6fc23ed23..2f50a84daaf 100644
--- a/appengine/remote/README.md
+++ b/appengine/remote/README.md
@@ -4,6 +4,10 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to access App Engine Standard Environment APIs remotely,
diff --git a/appengine/remote/remote-client/pom.xml b/appengine/remote/remote-client/pom.xml
index b2d55b838ce..c46bf15b12a 100644
--- a/appengine/remote/remote-client/pom.xml
+++ b/appengine/remote/remote-client/pom.xml
@@ -20,31 +20,40 @@
com.example.appengine
appengine-remote-client
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ../..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
-
+
+
+ 1.7
+ 1.7
+
+
com.google.appengine
appengine-remote-api
- ${appengine.sdk.version}
+ 1.9.59
com.google.appengine
appengine-api-1.0-sdk
+ 1.9.59
+
${project.build.directory}/${project.build.finalName}/WEB-INF/classes
-
maven-assembly-plugin
diff --git a/appengine/remote/remote-client/src/main/java/com/example/appengine/remote/RemoteApiExample.java b/appengine/remote/remote-client/src/main/java/com/example/appengine/remote/RemoteApiExample.java
index 97131664214..346a79fc73e 100644
--- a/appengine/remote/remote-client/src/main/java/com/example/appengine/remote/RemoteApiExample.java
+++ b/appengine/remote/remote-client/src/main/java/com/example/appengine/remote/RemoteApiExample.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,6 +14,7 @@
* limitations under the License.
*/
+
package com.example.appengine.remote;
import com.google.appengine.api.datastore.DatastoreService;
diff --git a/appengine/remote/remote-server/pom.xml b/appengine/remote/remote-server/pom.xml
index a29f5e64466..d69ed1546fb 100644
--- a/appengine/remote/remote-server/pom.xml
+++ b/appengine/remote/remote-server/pom.xml
@@ -20,17 +20,26 @@
com.example.appengine
appengine-remote-server
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ../..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
-
+
+
+ 1.7
+ 1.7
+
+
com.google.appengine
appengine-api-1.0-sdk
+ 1.9.59
org.apache.httpcomponents
@@ -49,11 +58,10 @@
${project.build.directory}/${project.build.finalName}/WEB-INF/classes
-
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/remote/remote-server/src/main/java/com/example/appengine/remote/RemoteServlet.java b/appengine/remote/remote-server/src/main/java/com/example/appengine/remote/RemoteServlet.java
index 31e2b06f823..605607b8505 100644
--- a/appengine/remote/remote-server/src/main/java/com/example/appengine/remote/RemoteServlet.java
+++ b/appengine/remote/remote-server/src/main/java/com/example/appengine/remote/RemoteServlet.java
@@ -1,5 +1,5 @@
-/**
- * Copyright 2016 Google Inc.
+/*
+ * Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/appengine/requests/README.md b/appengine/requests/README.md
index 5ce7b8078e1..bec33e0a95d 100644
--- a/appengine/requests/README.md
+++ b/appengine/requests/README.md
@@ -4,6 +4,9 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample provides Java code samples in support of the "Handling Requests" description [Requests][requests-doc] on [Google App
diff --git a/appengine/requests/pom.xml b/appengine/requests/pom.xml
index d3d2a83df56..c684fd4979d 100644
--- a/appengine/requests/pom.xml
+++ b/appengine/requests/pom.xml
@@ -20,18 +20,27 @@ Copyright 2016 Google Inc.
1.0-SNAPSHOT
com.example.appengine
appengine-requests
-
+
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
+
+ 1.7
+ 1.7
+
+
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
com.google.guava
@@ -66,19 +75,19 @@ Copyright 2016 Google Inc.
com.google.appengine
appengine-testing
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-api-stubs
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-tools-sdk
- ${appengine.sdk.version}
+ 1.9.59
test
@@ -96,7 +105,7 @@ Copyright 2016 Google Inc.
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/requests/src/main/java/com/example/appengine/requests/LoggingServlet.java b/appengine/requests/src/main/java/com/example/appengine/requests/LoggingServlet.java
index 213ab065aab..38916aa67da 100644
--- a/appengine/requests/src/main/java/com/example/appengine/requests/LoggingServlet.java
+++ b/appengine/requests/src/main/java/com/example/appengine/requests/LoggingServlet.java
@@ -12,11 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.example.appengine.requests;
import java.io.IOException;
import java.util.logging.Logger;
-
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
diff --git a/appengine/requests/src/main/java/com/example/appengine/requests/RequestsServlet.java b/appengine/requests/src/main/java/com/example/appengine/requests/RequestsServlet.java
index 82c649e0eab..8dff3498311 100644
--- a/appengine/requests/src/main/java/com/example/appengine/requests/RequestsServlet.java
+++ b/appengine/requests/src/main/java/com/example/appengine/requests/RequestsServlet.java
@@ -12,10 +12,10 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.example.appengine.requests;
import java.io.IOException;
-
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
diff --git a/appengine/requests/src/main/webapp/WEB-INF/web.xml b/appengine/requests/src/main/webapp/WEB-INF/web.xml
index 7784c6a56c6..79491cebfc2 100644
--- a/appengine/requests/src/main/webapp/WEB-INF/web.xml
+++ b/appengine/requests/src/main/webapp/WEB-INF/web.xml
@@ -1,8 +1,8 @@
-
+
requests
com.example.appengine.requests.RequestsServlet
diff --git a/appengine/requests/src/test/java/com/example/appengine/requests/LoggingServletTest.java b/appengine/requests/src/test/java/com/example/appengine/requests/LoggingServletTest.java
index 6f3469e6b5c..51c88647cc2 100644
--- a/appengine/requests/src/test/java/com/example/appengine/requests/LoggingServletTest.java
+++ b/appengine/requests/src/test/java/com/example/appengine/requests/LoggingServletTest.java
@@ -19,6 +19,12 @@
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.when;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -27,14 +33,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Unit tests for {@link LoggingServlet}.
*/
diff --git a/appengine/requests/src/test/java/com/example/appengine/requests/RequestsServletTest.java b/appengine/requests/src/test/java/com/example/appengine/requests/RequestsServletTest.java
index 639aa0a6a2a..ce15b8ef979 100644
--- a/appengine/requests/src/test/java/com/example/appengine/requests/RequestsServletTest.java
+++ b/appengine/requests/src/test/java/com/example/appengine/requests/RequestsServletTest.java
@@ -19,6 +19,10 @@
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.when;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.Before;
import org.junit.Test;
import org.junit.runner.RunWith;
@@ -26,12 +30,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Unit tests for {@link RequestsServlet}.
*/
diff --git a/appengine/search/README.md b/appengine/search/README.md
index e58f8ce5f54..cb2891fcc18 100644
--- a/appengine/search/README.md
+++ b/appengine/search/README.md
@@ -4,6 +4,10 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to use App Engine Search API.
diff --git a/appengine/search/pom.xml b/appengine/search/pom.xml
index 922dca46fa7..4aaf6a72d5f 100644
--- a/appengine/search/pom.xml
+++ b/appengine/search/pom.xml
@@ -19,17 +19,22 @@ Copyright 2015 Google Inc.
1.0-SNAPSHOT
com.example.appengine
appengine-search
+
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.sdk.version}
+ 1.9.59
javax.servlet
@@ -55,19 +60,19 @@ Copyright 2015 Google Inc.
com.google.appengine
appengine-testing
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-api-stubs
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-tools-sdk
- ${appengine.sdk.version}
+ 1.9.59
test
@@ -94,7 +99,7 @@ Copyright 2015 Google Inc.
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/search/src/main/java/com/example/appengine/search/DeleteServlet.java b/appengine/search/src/main/java/com/example/appengine/search/DeleteServlet.java
index da9fb6125d3..e9f6cee44ed 100644
--- a/appengine/search/src/main/java/com/example/appengine/search/DeleteServlet.java
+++ b/appengine/search/src/main/java/com/example/appengine/search/DeleteServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,23 +14,19 @@
* limitations under the License.
*/
+
package com.example.appengine.search;
// @formatter:off
// [START delete_import]
+
import com.google.appengine.api.search.Document;
+import com.google.appengine.api.search.Field;
import com.google.appengine.api.search.GetRequest;
import com.google.appengine.api.search.GetResponse;
-// [END delete_import]
-
-// CHECKSTYLE:OFF
-import com.google.appengine.api.search.Field;
import com.google.appengine.api.search.Index;
import com.google.appengine.api.search.IndexSpec;
import com.google.appengine.api.search.SearchServiceFactory;
-// @formatter:on
-// CHECKSTYLE:ON
-
import java.io.IOException;
import java.io.PrintWriter;
import java.util.ArrayList;
@@ -41,6 +37,11 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+// [END delete_import]
+// CHECKSTYLE:OFF
+// @formatter:on
+// CHECKSTYLE:ON
+
/**
* Code snippet for deleting documents from an Index.
*/
diff --git a/appengine/search/src/main/java/com/example/appengine/search/DocumentServlet.java b/appengine/search/src/main/java/com/example/appengine/search/DocumentServlet.java
index eaa26cd7388..c5778b18947 100644
--- a/appengine/search/src/main/java/com/example/appengine/search/DocumentServlet.java
+++ b/appengine/search/src/main/java/com/example/appengine/search/DocumentServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,12 +17,11 @@
package com.example.appengine.search;
// [START document_import]
+
import com.google.appengine.api.search.Document;
import com.google.appengine.api.search.Field;
import com.google.appengine.api.users.User;
import com.google.appengine.api.users.UserServiceFactory;
-// [END document_import]
-
import java.io.IOException;
import java.io.PrintWriter;
import java.util.Date;
@@ -30,6 +29,8 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+// [END document_import]
+
/**
* A servlet for creating Search API Document.
*/
diff --git a/appengine/search/src/main/java/com/example/appengine/search/IndexServlet.java b/appengine/search/src/main/java/com/example/appengine/search/IndexServlet.java
index 390b74c2d5e..8ba226bec2d 100644
--- a/appengine/search/src/main/java/com/example/appengine/search/IndexServlet.java
+++ b/appengine/search/src/main/java/com/example/appengine/search/IndexServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,26 +17,26 @@
package com.example.appengine.search;
// @formatter:off
+
import com.google.appengine.api.search.Document;
import com.google.appengine.api.search.Field;
+import com.google.appengine.api.search.GetRequest;
+import com.google.appengine.api.search.GetResponse;
import com.google.appengine.api.search.Index;
import com.google.appengine.api.search.IndexSpec;
import com.google.appengine.api.search.SearchServiceFactory;
+import java.io.IOException;
+import java.io.PrintWriter;
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
// CHECKSTYLE:OFF
// [START get_document_import]
-import com.google.appengine.api.search.GetRequest;
-import com.google.appengine.api.search.GetResponse;
// [END get_document_import]
// @formatter:on
// CHECKSTYLE:ON
-import java.io.IOException;
-import java.io.PrintWriter;
-import javax.servlet.http.HttpServlet;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Code snippet for getting a document from Index.
diff --git a/appengine/search/src/main/java/com/example/appengine/search/SchemaServlet.java b/appengine/search/src/main/java/com/example/appengine/search/SchemaServlet.java
index 4deda3e3cfa..5c17cbf32f0 100644
--- a/appengine/search/src/main/java/com/example/appengine/search/SchemaServlet.java
+++ b/appengine/search/src/main/java/com/example/appengine/search/SchemaServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,20 +18,12 @@
import com.google.appengine.api.search.Document;
import com.google.appengine.api.search.Field;
-import com.google.appengine.api.search.SearchServiceFactory;
-
-// @formatter:off
-// CHECKSTYLE:OFF
-// [START schema_import]
import com.google.appengine.api.search.Field.FieldType;
-import com.google.appengine.api.search.Index;
import com.google.appengine.api.search.GetIndexesRequest;
import com.google.appengine.api.search.GetResponse;
+import com.google.appengine.api.search.Index;
import com.google.appengine.api.search.Schema;
-// [END schema_import]
-// @formatter:on
-// CHECKSTYLE:ON
-
+import com.google.appengine.api.search.SearchServiceFactory;
import java.io.IOException;
import java.io.PrintWriter;
import java.util.List;
@@ -39,6 +31,13 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+// @formatter:off
+// CHECKSTYLE:OFF
+// [START schema_import]
+// [END schema_import]
+// @formatter:on
+// CHECKSTYLE:ON
+
@SuppressWarnings("serial")
public class SchemaServlet extends HttpServlet {
diff --git a/appengine/search/src/main/java/com/example/appengine/search/SearchOptionServlet.java b/appengine/search/src/main/java/com/example/appengine/search/SearchOptionServlet.java
index 83a63287fa5..94d628e8e3d 100644
--- a/appengine/search/src/main/java/com/example/appengine/search/SearchOptionServlet.java
+++ b/appengine/search/src/main/java/com/example/appengine/search/SearchOptionServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,25 +17,17 @@
package com.example.appengine.search;
import com.google.appengine.api.search.Document;
-import com.google.appengine.api.search.Index;
-
-// CHECKSTYLE:OFF
-// @formatter:off
-// [START search_option_import]
import com.google.appengine.api.search.Field;
+import com.google.appengine.api.search.Index;
import com.google.appengine.api.search.IndexSpec;
-import com.google.appengine.api.search.SearchServiceFactory;
import com.google.appengine.api.search.Query;
import com.google.appengine.api.search.QueryOptions;
import com.google.appengine.api.search.Results;
+import com.google.appengine.api.search.ScoredDocument;
import com.google.appengine.api.search.SearchException;
+import com.google.appengine.api.search.SearchServiceFactory;
import com.google.appengine.api.search.SortExpression;
import com.google.appengine.api.search.SortOptions;
-import com.google.appengine.api.search.ScoredDocument;
-// [END search_option_import]
-// @formatter:on
-// CHECKSTYLE:ON
-
import java.io.IOException;
import java.io.PrintWriter;
import java.util.logging.Logger;
@@ -43,6 +35,13 @@
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+// CHECKSTYLE:OFF
+// @formatter:off
+// [START search_option_import]
+// [END search_option_import]
+// @formatter:on
+// CHECKSTYLE:ON
+
/**
* Code snippet for searching with query options.
diff --git a/appengine/search/src/main/java/com/example/appengine/search/SearchServlet.java b/appengine/search/src/main/java/com/example/appengine/search/SearchServlet.java
index e92005b55a6..b9c4c99bd37 100644
--- a/appengine/search/src/main/java/com/example/appengine/search/SearchServlet.java
+++ b/appengine/search/src/main/java/com/example/appengine/search/SearchServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -18,27 +18,27 @@
// @formatter:off
// [START search_document_import]
+
import com.google.appengine.api.search.Document;
import com.google.appengine.api.search.Field;
+import com.google.appengine.api.search.Index;
+import com.google.appengine.api.search.IndexSpec;
import com.google.appengine.api.search.Results;
import com.google.appengine.api.search.ScoredDocument;
import com.google.appengine.api.search.SearchException;
-import com.google.appengine.api.search.StatusCode;
-// [END search_document_import]
-
-// CHECKSTYLE:OFF
-import com.google.appengine.api.search.Index;
-import com.google.appengine.api.search.IndexSpec;
import com.google.appengine.api.search.SearchServiceFactory;
-// @formatter:on
-// CHECKSTYLE:ON
-
+import com.google.appengine.api.search.StatusCode;
import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+// [END search_document_import]
+// CHECKSTYLE:OFF
+// @formatter:on
+// CHECKSTYLE:ON
+
@SuppressWarnings("serial")
diff --git a/appengine/search/src/main/java/com/example/appengine/search/Utils.java b/appengine/search/src/main/java/com/example/appengine/search/Utils.java
index 4fab0159303..0f572ae0181 100644
--- a/appengine/search/src/main/java/com/example/appengine/search/Utils.java
+++ b/appengine/search/src/main/java/com/example/appengine/search/Utils.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.example.appengine.search;
// [START index_import]
diff --git a/appengine/search/src/main/webapp/WEB-INF/web.xml b/appengine/search/src/main/webapp/WEB-INF/web.xml
index d3e1e6f8ec3..dff23e08f13 100644
--- a/appengine/search/src/main/webapp/WEB-INF/web.xml
+++ b/appengine/search/src/main/webapp/WEB-INF/web.xml
@@ -1,8 +1,8 @@
-
+
document
com.example.appengine.search.DocumentServlet
diff --git a/appengine/search/src/test/java/com/example/appengine/search/DeleteServletTest.java b/appengine/search/src/test/java/com/example/appengine/search/DeleteServletTest.java
index 15b9deec1fb..6a3fa2d0f2f 100644
--- a/appengine/search/src/test/java/com/example/appengine/search/DeleteServletTest.java
+++ b/appengine/search/src/test/java/com/example/appengine/search/DeleteServletTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,17 +20,16 @@
import static org.mockito.Mockito.when;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
public class DeleteServletTest {
private final LocalServiceTestHelper helper = new LocalServiceTestHelper();
diff --git a/appengine/search/src/test/java/com/example/appengine/search/DocumentServletTest.java b/appengine/search/src/test/java/com/example/appengine/search/DocumentServletTest.java
index 55bb6ed5350..989c6cb1d32 100644
--- a/appengine/search/src/test/java/com/example/appengine/search/DocumentServletTest.java
+++ b/appengine/search/src/test/java/com/example/appengine/search/DocumentServletTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,17 +21,16 @@
import com.google.appengine.api.search.Document;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
public class DocumentServletTest {
private final LocalServiceTestHelper helper = new LocalServiceTestHelper();
diff --git a/appengine/search/src/test/java/com/example/appengine/search/IndexServletTest.java b/appengine/search/src/test/java/com/example/appengine/search/IndexServletTest.java
index ce3a3eee55c..84ad13930b6 100644
--- a/appengine/search/src/test/java/com/example/appengine/search/IndexServletTest.java
+++ b/appengine/search/src/test/java/com/example/appengine/search/IndexServletTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,17 +20,16 @@
import static org.mockito.Mockito.when;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
public class IndexServletTest {
private final LocalServiceTestHelper helper = new LocalServiceTestHelper();
diff --git a/appengine/search/src/test/java/com/example/appengine/search/SchemaServletTest.java b/appengine/search/src/test/java/com/example/appengine/search/SchemaServletTest.java
index c5c459c55fa..c8785be9a65 100644
--- a/appengine/search/src/test/java/com/example/appengine/search/SchemaServletTest.java
+++ b/appengine/search/src/test/java/com/example/appengine/search/SchemaServletTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,17 +20,16 @@
import static org.mockito.Mockito.when;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
public class SchemaServletTest {
private final LocalServiceTestHelper helper = new LocalServiceTestHelper();
diff --git a/appengine/search/src/test/java/com/example/appengine/search/SearchOptionServletTest.java b/appengine/search/src/test/java/com/example/appengine/search/SearchOptionServletTest.java
index ae055868e9e..0809769bbcc 100644
--- a/appengine/search/src/test/java/com/example/appengine/search/SearchOptionServletTest.java
+++ b/appengine/search/src/test/java/com/example/appengine/search/SearchOptionServletTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,17 +20,16 @@
import static org.mockito.Mockito.when;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
public class SearchOptionServletTest {
private final LocalServiceTestHelper helper = new LocalServiceTestHelper();
diff --git a/appengine/search/src/test/java/com/example/appengine/search/SearchServletTest.java b/appengine/search/src/test/java/com/example/appengine/search/SearchServletTest.java
index a405b5a8693..ad892ee0bc8 100644
--- a/appengine/search/src/test/java/com/example/appengine/search/SearchServletTest.java
+++ b/appengine/search/src/test/java/com/example/appengine/search/SearchServletTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -20,17 +20,16 @@
import static org.mockito.Mockito.when;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
public class SearchServletTest {
private final LocalServiceTestHelper helper = new LocalServiceTestHelper();
diff --git a/appengine/search/src/test/java/com/example/appengine/search/UtilsTest.java b/appengine/search/src/test/java/com/example/appengine/search/UtilsTest.java
index e3a3e58cf2a..c11620d4d87 100644
--- a/appengine/search/src/test/java/com/example/appengine/search/UtilsTest.java
+++ b/appengine/search/src/test/java/com/example/appengine/search/UtilsTest.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2016 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/appengine/sendgrid/README.md b/appengine/sendgrid/README.md
index a5f5bbead15..8766030eb80 100644
--- a/appengine/sendgrid/README.md
+++ b/appengine/sendgrid/README.md
@@ -4,6 +4,10 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to use [SendGrid](https://www.sendgrid.com) on
diff --git a/appengine/sendgrid/pom.xml b/appengine/sendgrid/pom.xml
index f25ad2b7d97..0c98066b169 100644
--- a/appengine/sendgrid/pom.xml
+++ b/appengine/sendgrid/pom.xml
@@ -20,11 +20,14 @@ Copyright 2015 Google Inc.
com.example.appengine
appengine-sendgrid
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
@@ -47,11 +50,10 @@ Copyright 2015 Google Inc.
${project.build.directory}/${project.build.finalName}/WEB-INF/classes
-
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
org.apache.maven.plugins
diff --git a/appengine/sendgrid/src/main/java/com/example/appengine/sendgrid/SendEmailServlet.java b/appengine/sendgrid/src/main/java/com/example/appengine/sendgrid/SendEmailServlet.java
index db086c739eb..b75aab6b544 100644
--- a/appengine/sendgrid/src/main/java/com/example/appengine/sendgrid/SendEmailServlet.java
+++ b/appengine/sendgrid/src/main/java/com/example/appengine/sendgrid/SendEmailServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
diff --git a/appengine/sockets/README.md b/appengine/sockets/README.md
index f848c00566b..0b8735aec2c 100644
--- a/appengine/sockets/README.md
+++ b/appengine/sockets/README.md
@@ -5,6 +5,10 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample displays what's going on in your app. It dumps the environment and lots more.
diff --git a/appengine/sockets/README_LIBS.md b/appengine/sockets/README_LIBS.md
index 168f8c36d73..1faa8e0136c 100644
--- a/appengine/sockets/README_LIBS.md
+++ b/appengine/sockets/README_LIBS.md
@@ -5,6 +5,9 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
## Using the Socket API with JavaPNS
diff --git a/appengine/sockets/pom.xml b/appengine/sockets/pom.xml
index 4989d2d3c8f..4bf6f5d9f6c 100755
--- a/appengine/sockets/pom.xml
+++ b/appengine/sockets/pom.xml
@@ -26,12 +26,14 @@
com.example.appengine
sockets
-
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
@@ -45,7 +47,7 @@
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/sockets/src/main/java/com/example/appengine/sockets/WhoIsClientServlet.java b/appengine/sockets/src/main/java/com/example/appengine/sockets/WhoIsClientServlet.java
index 39bfc397392..5791402af8e 100644
--- a/appengine/sockets/src/main/java/com/example/appengine/sockets/WhoIsClientServlet.java
+++ b/appengine/sockets/src/main/java/com/example/appengine/sockets/WhoIsClientServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2017 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -13,6 +13,7 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.example.appengine.sockets;
import java.io.IOException;
@@ -22,14 +23,12 @@
import java.io.Writer;
import java.net.Socket;
import java.util.logging.Logger;
-
-import javax.servlet.http.*;
-
+import javax.servlet.http.HttpServlet;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.jsoup.Jsoup;
import org.jsoup.safety.Whitelist;
-
-
/**
* This simple example uses the Socket API to access a WHOIS server and query
* for domains that contain the string "google.com".
@@ -45,8 +44,8 @@ public class WhoIsClientServlet extends HttpServlet {
void writeHeader(HttpServletResponse resp, String name) throws IOException {
resp.setContentType("text/html");
resp.setCharacterEncoding("UTF-8");
- String header = "App Engine Whois example result for " + name + "" +
- "\n";
+ String header = "App Engine Whois example result for " + name + ""
+ + "\n";
resp.getWriter().print(header);
}
diff --git a/appengine/static-files/pom.xml b/appengine/static-files/pom.xml
index 80bc6e63d3e..4caf47f76ba 100644
--- a/appengine/static-files/pom.xml
+++ b/appengine/static-files/pom.xml
@@ -20,13 +20,21 @@ Copyright 2015 Google Inc.
com.example.appengine
appengine-staticfiles
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
+ 1.7
+ 1.7
+
+
javax.servlet
@@ -44,7 +52,7 @@ Copyright 2015 Google Inc.
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
org.apache.maven.plugins
diff --git a/appengine/taskqueue/defer-samples/README.md b/appengine/taskqueue/defer-samples/README.md
index b545636c110..15f16b789c6 100644
--- a/appengine/taskqueue/defer-samples/README.md
+++ b/appengine/taskqueue/defer-samples/README.md
@@ -4,6 +4,10 @@ App Engine Java Guestbook
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
## Sample guestbook for use with App Engine Java.
diff --git a/appengine/taskqueue/defer-samples/pom.xml b/appengine/taskqueue/defer-samples/pom.xml
index ee9233b6199..9940f94dbcc 100644
--- a/appengine/taskqueue/defer-samples/pom.xml
+++ b/appengine/taskqueue/defer-samples/pom.xml
@@ -20,20 +20,19 @@
com.google.cloud.taskqueue.samples
taskqueue-defer-sample
-
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ../..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
1.7
1.7
- 1.9.60
- 2.5
- 3.2.0
@@ -41,7 +40,7 @@
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.sdk.version}
+ 1.9.59
javax.servlet
@@ -52,13 +51,14 @@
jstl
jstl
+ 1.2
junit
junit
-
+ 4.12
org.mockito
@@ -68,12 +68,12 @@
com.google.appengine
appengine-testing
- ${appengine.sdk.version}
+ 1.9.59
com.google.appengine
appengine-api-stubs
- ${appengine.sdk.version}
+ 1.9.59
@@ -84,7 +84,7 @@
org.codehaus.mojo
versions-maven-plugin
- ${codehaus-versions-maven-plugin-version}
+ 2.5
compile
@@ -99,7 +99,7 @@
org.apache.maven.plugins
maven-war-plugin
- ${maven-war-plugin-version}
+ 3.2.0
true
@@ -116,7 +116,7 @@
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
false
diff --git a/appengine/taskqueue/defer-samples/src/main/java/com/google/cloud/taskqueue/samples/DeferSampleServlet.java b/appengine/taskqueue/defer-samples/src/main/java/com/google/cloud/taskqueue/samples/DeferSampleServlet.java
index 82e9057f2da..abe037b2dc1 100644
--- a/appengine/taskqueue/defer-samples/src/main/java/com/google/cloud/taskqueue/samples/DeferSampleServlet.java
+++ b/appengine/taskqueue/defer-samples/src/main/java/com/google/cloud/taskqueue/samples/DeferSampleServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -17,13 +17,13 @@
/**
* This package demonstrates how to use the task queue with Java.
*/
+
package com.google.cloud.taskqueue.samples;
import com.google.appengine.api.taskqueue.DeferredTask;
import com.google.appengine.api.taskqueue.Queue;
import com.google.appengine.api.taskqueue.QueueFactory;
import com.google.appengine.api.taskqueue.TaskOptions;
-
import java.io.IOException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
diff --git a/appengine/taskqueue/pom.xml b/appengine/taskqueue/pom.xml
index 9b9512d3b2e..df75e03408e 100644
--- a/appengine/taskqueue/pom.xml
+++ b/appengine/taskqueue/pom.xml
@@ -21,12 +21,14 @@
taskqueue-doc-samples
pom
-
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
diff --git a/appengine/taskqueue/pull-samples/README.md b/appengine/taskqueue/pull-samples/README.md
index 2181ff96e8a..b1f0659f914 100644
--- a/appengine/taskqueue/pull-samples/README.md
+++ b/appengine/taskqueue/pull-samples/README.md
@@ -4,6 +4,10 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to use [pull task queues][appid] on [Google App
diff --git a/appengine/taskqueue/pull-samples/pom.xml b/appengine/taskqueue/pull-samples/pom.xml
index e5ec216253d..174bf1e96bb 100644
--- a/appengine/taskqueue/pull-samples/pom.xml
+++ b/appengine/taskqueue/pull-samples/pom.xml
@@ -22,18 +22,27 @@ Copyright 2016 Google Inc.
com.example.taskqueue
taskqueue
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ../..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
+ 1.7
+ 1.7
+
+
com.google.appengine
appengine-api-1.0-sdk
+ 1.9.59
javax.servlet
@@ -51,11 +60,13 @@ Copyright 2016 Google Inc.
com.google.appengine
appengine-testing
+ 1.9.59
test
com.google.appengine
appengine-api-stubs
+ 1.9.59
test
@@ -88,12 +99,11 @@ Copyright 2016 Google Inc.
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
com.google.appengine
gcloud-maven-plugin
- ${appengine.sdk.version}
true
diff --git a/appengine/taskqueue/pull-samples/src/main/java/com/example/taskqueue/TaskqueueServlet.java b/appengine/taskqueue/pull-samples/src/main/java/com/example/taskqueue/TaskqueueServlet.java
index 88aaefeed0d..b6e0ff7536c 100644
--- a/appengine/taskqueue/pull-samples/src/main/java/com/example/taskqueue/TaskqueueServlet.java
+++ b/appengine/taskqueue/pull-samples/src/main/java/com/example/taskqueue/TaskqueueServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -16,23 +16,20 @@
package com.example.taskqueue;
-import com.google.appengine.api.taskqueue.TaskOptions;
import com.google.appengine.api.taskqueue.Queue;
import com.google.appengine.api.taskqueue.QueueFactory;
import com.google.appengine.api.taskqueue.TaskHandle;
-
+import com.google.appengine.api.taskqueue.TaskOptions;
import java.io.IOException;
+import java.util.List;
+import java.util.concurrent.TimeUnit;
+import java.util.logging.Logger;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
-import java.util.Date;
-import java.util.List;
-import java.util.logging.Logger;
-import java.util.concurrent.TimeUnit;
-
-/**
+/*
* Form Handling Servlet
* This servlet has one method
* {@link #doPost(<#HttpServletRequest req#>, <#HttpServletResponse resp#>)} which takes the form
@@ -40,99 +37,99 @@
*/
public class TaskqueueServlet extends HttpServlet {
- private static final Logger log = Logger.getLogger(TaskqueueServlet.class.getName());
- private static final int numberOfTasksToAdd = 100;
- private static final int numberOfTasksToLease = 100;
- private static boolean useTaggedTasks = true;
- private static String output;
- private static String message;
+ private static final Logger log = Logger.getLogger(TaskqueueServlet.class.getName());
+ private static final int numberOfTasksToAdd = 100;
+ private static final int numberOfTasksToLease = 100;
+ private static boolean useTaggedTasks = true;
+ private static String output;
+ private static String message;
- // Process the http POST of the form
- @Override
- public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException,
- ServletException {
- if (req.getParameter("addTask") != null) {
- String content = req.getParameter("content");
- String output = String.format("Adding %d Tasks to the Task Queue with a payload of '%s'",
- numberOfTasksToAdd, content.toString());
- log.info(output.toString());
+ // Process the http POST of the form
+ @Override
+ public void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException,
+ ServletException {
+ if (req.getParameter("addTask") != null) {
+ String content = req.getParameter("content");
+ String output = String.format("Adding %d Tasks to the Task Queue with a payload of '%s'",
+ numberOfTasksToAdd, content.toString());
+ log.info(output.toString());
- // Add Tasks to Task Queue
- // [START get_queue]
- Queue q = QueueFactory.getQueue("pull-queue");
- // [END get_queue]
- if (!useTaggedTasks) {
- for (int i = 0; i < numberOfTasksToAdd; i++) {
- // [START add_task]
- q.add(TaskOptions.Builder.withMethod(TaskOptions.Method.PULL)
- .payload(content.toString()));
- // [END add_task]
- }
- } else {
- for (int i = 0; i < numberOfTasksToAdd; i++) {
- // [START add_task_w_tag]
- q.add(TaskOptions.Builder.withMethod(TaskOptions.Method.PULL)
- .payload(content.toString())
- .tag("process".getBytes()));
- // [END add_task_w_tag]
+ // Add Tasks to Task Queue
+ // [START get_queue]
+ Queue q = QueueFactory.getQueue("pull-queue");
+ // [END get_queue]
+ if (!useTaggedTasks) {
+ for (int i = 0; i < numberOfTasksToAdd; i++) {
+ // [START add_task]
+ q.add(TaskOptions.Builder.withMethod(TaskOptions.Method.PULL)
+ .payload(content.toString()));
+ // [END add_task]
+ }
+ } else {
+ for (int i = 0; i < numberOfTasksToAdd; i++) {
+ // [START add_task_w_tag]
+ q.add(TaskOptions.Builder.withMethod(TaskOptions.Method.PULL)
+ .payload(content.toString())
+ .tag("process".getBytes()));
+ // [END add_task_w_tag]
- }
- }
- try {
- message = "Added " + numberOfTasksToAdd + " tasks to the task queue.";
- req.setAttribute("message", message);
- req.getRequestDispatcher("tasks.jsp").forward(req,resp);
- } catch (ServletException e) {
- throw new ServletException("ServletException error: ", e);
- }
- } else if (req.getParameter("leaseTask") != null) {
- output = String.format("Pulling %d Tasks from the Task Queue", numberOfTasksToLease);
- log.info(output.toString());
+ }
+ }
+ try {
+ message = "Added " + numberOfTasksToAdd + " tasks to the task queue.";
+ req.setAttribute("message", message);
+ req.getRequestDispatcher("tasks.jsp").forward(req, resp);
+ } catch (ServletException e) {
+ throw new ServletException("ServletException error: ", e);
+ }
+ } else if (req.getParameter("leaseTask") != null) {
+ output = String.format("Pulling %d Tasks from the Task Queue", numberOfTasksToLease);
+ log.info(output.toString());
- // Pull tasks from the Task Queue and process them
- Queue q = QueueFactory.getQueue("pull-queue");
- if (!useTaggedTasks) {
- // [START lease_tasks]
- List tasks = q.leaseTasks(3600, TimeUnit.SECONDS, numberOfTasksToLease);
- // [END lease_tasks]
- message = processTasks(tasks, q);
- } else {
- // [START lease_tasks_by_tag]
- // Lease only tasks tagged with "process"
- List tasks = q.leaseTasksByTag(3600, TimeUnit.SECONDS, numberOfTasksToLease, "process");
- // You can also specify a tag to lease via LeaseOptions passed to leaseTasks.
- // [END lease_tasks_by_tag]
- message = processTasks(tasks, q);
- }
- req.setAttribute("message", message);
- req.getRequestDispatcher("tasks.jsp").forward(req,resp);
+ // Pull tasks from the Task Queue and process them
+ Queue q = QueueFactory.getQueue("pull-queue");
+ if (!useTaggedTasks) {
+ // [START lease_tasks]
+ List tasks = q.leaseTasks(3600, TimeUnit.SECONDS, numberOfTasksToLease);
+ // [END lease_tasks]
+ message = processTasks(tasks, q);
} else {
- resp.sendRedirect("/");
+ // [START lease_tasks_by_tag]
+ // Lease only tasks tagged with "process"
+ List tasks = q
+ .leaseTasksByTag(3600, TimeUnit.SECONDS, numberOfTasksToLease, "process");
+ // You can also specify a tag to lease via LeaseOptions passed to leaseTasks.
+ // [END lease_tasks_by_tag]
+ message = processTasks(tasks, q);
}
- }
+ req.setAttribute("message", message);
+ req.getRequestDispatcher("tasks.jsp").forward(req, resp);
+ } else {
+ resp.sendRedirect("/");
+ }
+ }
- //Method to process and delete tasks
- private static String processTasks(List tasks, Queue q) {
- String payload;
- int numberOfDeletedTasks = 0;
- for (TaskHandle task : tasks) {
- payload = new String(task.getPayload());
- output = String.format("Processing: taskName='%s' payload='%s'", task.getName()
- .toString(), payload.toString());
- log.info(output.toString());
- output = String.format("Deleting taskName='%s'", task.getName().toString());
- log.info(output.toString());
- // [START delete_task]
- q.deleteTask(task);
- // [END delete_task]
- numberOfDeletedTasks++;
- }
- if (numberOfDeletedTasks > 0) {
- message = "Processed and deleted " + numberOfTasksToLease + " tasks from the " +
- " task queue.";
- } else {
- message = "Task Queue has no tasks available for lease.";
- }
- return message;
- }
+ //Method to process and delete tasks
+ private static String processTasks(List tasks, Queue q) {
+ String payload;
+ int numberOfDeletedTasks = 0;
+ for (TaskHandle task : tasks) {
+ payload = new String(task.getPayload());
+ output = String.format("Processing: taskName='%s' payload='%s'", task.getName(), payload);
+ log.info(output);
+ output = String.format("Deleting taskName='%s'", task.getName());
+ log.info(output);
+ // [START delete_task]
+ q.deleteTask(task);
+ // [END delete_task]
+ numberOfDeletedTasks++;
+ }
+ if (numberOfDeletedTasks > 0) {
+ message = "Processed and deleted " + numberOfTasksToLease + " tasks from the "
+ + " task queue.";
+ } else {
+ message = "Task Queue has no tasks available for lease.";
+ }
+ return message;
+ }
}
diff --git a/appengine/taskqueue/push-samples/README.md b/appengine/taskqueue/push-samples/README.md
index e742e720ce9..5d83b60fa05 100644
--- a/appengine/taskqueue/push-samples/README.md
+++ b/appengine/taskqueue/push-samples/README.md
@@ -3,6 +3,10 @@
This sample demonstrates how to use the [TaskQueue API][taskqueue-api] on [Google App
Engine][ae-docs].
+
+
+
+
[taskqueue-api]: https://cloud.google.com/appengine/docs/java/javadoc/com/google/appengine/api/taskqueue/package-summary
[ae-docs]: https://cloud.google.com/appengine/docs/java/
diff --git a/appengine/taskqueue/push-samples/pom.xml b/appengine/taskqueue/push-samples/pom.xml
index db3fcf76d63..32edf54fbdf 100644
--- a/appengine/taskqueue/push-samples/pom.xml
+++ b/appengine/taskqueue/push-samples/pom.xml
@@ -20,14 +20,22 @@ Copyright 2016 Google Inc.
1.0-SNAPSHOT
com.example.appengine
taskqueue-push
-
+
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ../..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
+ 1.7
+ 1.7
+
+
javax.servlet
@@ -44,7 +52,7 @@ Copyright 2016 Google Inc.
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.sdk.version}
+ 1.9.59
@@ -62,19 +70,19 @@ Copyright 2016 Google Inc.
com.google.appengine
appengine-testing
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-api-stubs
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-tools-sdk
- ${appengine.sdk.version}
+ 1.9.59
test
@@ -92,7 +100,7 @@ Copyright 2016 Google Inc.
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/taskqueue/push-samples/src/main/java/com/example/appengine/taskqueue/push/Enqueue.java b/appengine/taskqueue/push-samples/src/main/java/com/example/appengine/taskqueue/push/Enqueue.java
index 806e3a911a1..742e6022fea 100644
--- a/appengine/taskqueue/push-samples/src/main/java/com/example/appengine/taskqueue/push/Enqueue.java
+++ b/appengine/taskqueue/push-samples/src/main/java/com/example/appengine/taskqueue/push/Enqueue.java
@@ -12,21 +12,22 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.example.appengine.taskqueue.push;
// [START import]
+
import com.google.appengine.api.taskqueue.Queue;
import com.google.appengine.api.taskqueue.QueueFactory;
import com.google.appengine.api.taskqueue.TaskOptions;
-// [END import]
-
import java.io.IOException;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+// [END import]
+
// [START enqueue]
// The Enqueue servlet should be mapped to the "/enqueue" URL.
public class Enqueue extends HttpServlet {
diff --git a/appengine/taskqueue/push-samples/src/main/java/com/example/appengine/taskqueue/push/Worker.java b/appengine/taskqueue/push-samples/src/main/java/com/example/appengine/taskqueue/push/Worker.java
index 63c42af1d1d..65e83e47a65 100644
--- a/appengine/taskqueue/push-samples/src/main/java/com/example/appengine/taskqueue/push/Worker.java
+++ b/appengine/taskqueue/push-samples/src/main/java/com/example/appengine/taskqueue/push/Worker.java
@@ -12,11 +12,11 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.example.appengine.taskqueue.push;
import java.io.IOException;
import java.util.logging.Logger;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
diff --git a/appengine/taskqueue/push-samples/src/test/java/com/example/appengine/taskqueue/push/WorkerTest.java b/appengine/taskqueue/push-samples/src/test/java/com/example/appengine/taskqueue/push/WorkerTest.java
index 2d82e3ee69d..e3be5d151f2 100644
--- a/appengine/taskqueue/push-samples/src/test/java/com/example/appengine/taskqueue/push/WorkerTest.java
+++ b/appengine/taskqueue/push-samples/src/test/java/com/example/appengine/taskqueue/push/WorkerTest.java
@@ -12,11 +12,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
+
package com.example.appengine.taskqueue.push;
import static com.google.common.truth.Truth.assertThat;
import static org.mockito.Mockito.when;
+import java.io.ByteArrayOutputStream;
+import java.io.PrintStream;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -25,12 +30,6 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.ByteArrayOutputStream;
-import java.io.PrintStream;
-
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Unit tests for {@link Worker}.
*/
diff --git a/appengine/twilio/README.md b/appengine/twilio/README.md
index eff13a1d043..9edf4400c4e 100644
--- a/appengine/twilio/README.md
+++ b/appengine/twilio/README.md
@@ -4,6 +4,9 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to use [Twilio](https://www.twilio.com) on [Google
diff --git a/appengine/twilio/pom.xml b/appengine/twilio/pom.xml
index 4f79a933d01..7263dee6c2a 100644
--- a/appengine/twilio/pom.xml
+++ b/appengine/twilio/pom.xml
@@ -20,13 +20,21 @@ Copyright 2015 Google Inc.
com.example.appengine
appengine-twilio
+
- appengine-doc-samples
- com.google.cloud
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
+ 1.7
+ 1.7
+
+
@@ -51,7 +59,7 @@ Copyright 2015 Google Inc.
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/twilio/src/main/java/com/example/appengine/twilio/ReceiveCallServlet.java b/appengine/twilio/src/main/java/com/example/appengine/twilio/ReceiveCallServlet.java
index 1e5aabda0cf..024d74a57c7 100644
--- a/appengine/twilio/src/main/java/com/example/appengine/twilio/ReceiveCallServlet.java
+++ b/appengine/twilio/src/main/java/com/example/appengine/twilio/ReceiveCallServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -19,9 +19,7 @@
import com.twilio.sdk.verbs.Say;
import com.twilio.sdk.verbs.TwiMLException;
import com.twilio.sdk.verbs.TwiMLResponse;
-
import java.io.IOException;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
diff --git a/appengine/twilio/src/main/java/com/example/appengine/twilio/ReceiveSmsServlet.java b/appengine/twilio/src/main/java/com/example/appengine/twilio/ReceiveSmsServlet.java
index aa7bb6db308..5188f44de2d 100644
--- a/appengine/twilio/src/main/java/com/example/appengine/twilio/ReceiveSmsServlet.java
+++ b/appengine/twilio/src/main/java/com/example/appengine/twilio/ReceiveSmsServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -14,14 +14,13 @@
* limitations under the License.
*/
+
package com.example.appengine.twilio;
import com.twilio.sdk.verbs.Message;
import com.twilio.sdk.verbs.TwiMLException;
import com.twilio.sdk.verbs.TwiMLResponse;
-
import java.io.IOException;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
diff --git a/appengine/twilio/src/main/java/com/example/appengine/twilio/SendSmsServlet.java b/appengine/twilio/src/main/java/com/example/appengine/twilio/SendSmsServlet.java
index 6cb0c30a46e..67c686999cc 100644
--- a/appengine/twilio/src/main/java/com/example/appengine/twilio/SendSmsServlet.java
+++ b/appengine/twilio/src/main/java/com/example/appengine/twilio/SendSmsServlet.java
@@ -1,4 +1,4 @@
-/**
+/*
* Copyright 2015 Google Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -21,17 +21,15 @@
import com.twilio.sdk.resource.factory.MessageFactory;
import com.twilio.sdk.resource.instance.Account;
import com.twilio.sdk.resource.instance.Message;
-import org.apache.http.NameValuePair;
-import org.apache.http.message.BasicNameValuePair;
-
import java.io.IOException;
import java.util.ArrayList;
import java.util.List;
-
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.apache.http.NameValuePair;
+import org.apache.http.message.BasicNameValuePair;
// [START example]
@SuppressWarnings("serial")
diff --git a/appengine/twilio/src/main/webapp/WEB-INF/web.xml b/appengine/twilio/src/main/webapp/WEB-INF/web.xml
index 4791ebe69c4..6aae8dac298 100644
--- a/appengine/twilio/src/main/webapp/WEB-INF/web.xml
+++ b/appengine/twilio/src/main/webapp/WEB-INF/web.xml
@@ -13,10 +13,10 @@
limitations under the License.
-->
-
+
receivecall
com.example.appengine.twilio.ReceiveCallServlet
diff --git a/appengine/urlfetch/README.md b/appengine/urlfetch/README.md
index 8a7e40b517e..a68dcb18c53 100644
--- a/appengine/urlfetch/README.md
+++ b/appengine/urlfetch/README.md
@@ -4,6 +4,10 @@
December 13, 2017 and will be shut down entirely on January 16, 2019. It is replaced by the
[Java 8 Runtime Environment](https://cloud.google.com/appengine/docs/standard/java/runtime-java8).**
+
+
+
+
Samples for the Java 8 runtime can be found [here](/appengine-java8).
This sample demonstrates how to deploy an application on Google App Engine.
diff --git a/appengine/urlfetch/pom.xml b/appengine/urlfetch/pom.xml
index 9b2b484d84a..4063dd3f92d 100644
--- a/appengine/urlfetch/pom.xml
+++ b/appengine/urlfetch/pom.xml
@@ -20,13 +20,21 @@ Copyright 2015 Google Inc.
com.example.appengine
appengine-URLFetch
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
+ 1.7
+ 1.7
+
+
javax.servlet
@@ -49,7 +57,7 @@ Copyright 2015 Google Inc.
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/urlfetch/src/main/java/com/example/appengine/UrlFetchServlet.java b/appengine/urlfetch/src/main/java/com/example/appengine/UrlFetchServlet.java
index f0052655408..3d20fda5f95 100644
--- a/appengine/urlfetch/src/main/java/com/example/appengine/UrlFetchServlet.java
+++ b/appengine/urlfetch/src/main/java/com/example/appengine/UrlFetchServlet.java
@@ -3,7 +3,9 @@
*
* 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
+ * 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,
@@ -14,8 +16,6 @@
package com.example.appengine;
-import org.json.JSONObject;
-
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
@@ -27,6 +27,7 @@
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
+import org.json.JSONObject;
@SuppressWarnings("serial")
public class UrlFetchServlet extends HttpServlet {
@@ -35,7 +36,7 @@ public class UrlFetchServlet extends HttpServlet {
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException, ServletException {
-// [START example]
+ // [START example]
URL url = new URL("http://api.icndb.com/jokes/random");
BufferedReader reader = new BufferedReader(new InputStreamReader(url.openStream()));
StringBuffer json = new StringBuffer();
@@ -45,7 +46,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp)
json.append(line);
}
reader.close();
-// [END example]
+ // [END example]
JSONObject jo = new JSONObject(json.toString());
req.setAttribute("joke", jo.getJSONObject("value").getString("joke"));
diff --git a/appengine/urlfetch/src/main/webapp/WEB-INF/web.xml b/appengine/urlfetch/src/main/webapp/WEB-INF/web.xml
index ddc5cfb4c46..e8068b7a916 100644
--- a/appengine/urlfetch/src/main/webapp/WEB-INF/web.xml
+++ b/appengine/urlfetch/src/main/webapp/WEB-INF/web.xml
@@ -1,8 +1,8 @@
-
+
hello
com.example.appengine.UrlFetchServlet
diff --git a/appengine/users/pom.xml b/appengine/users/pom.xml
index 7314109df88..18363a10111 100644
--- a/appengine/users/pom.xml
+++ b/appengine/users/pom.xml
@@ -14,25 +14,30 @@ Copyright 2015 Google Inc.
See the License for the specific language governing permissions and
limitations under the License.
-->
-
+
4.0.0
war
1.0-SNAPSHOT
com.example.appengine
appengine-users
-
+
+
- com.google.cloud
- appengine-doc-samples
- 1.0.0
- ..
+ com.google.cloud.samples
+ shared-configuration
+ 1.0.8
+
com.google.appengine
appengine-api-1.0-sdk
- ${appengine.sdk.version}
+ 1.9.59
com.google.guava
@@ -67,19 +72,19 @@ Copyright 2015 Google Inc.
com.google.appengine
appengine-testing
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-api-stubs
- ${appengine.sdk.version}
+ 1.9.59
test
com.google.appengine
appengine-tools-sdk
- ${appengine.sdk.version}
+ 1.9.59
test
@@ -92,7 +97,8 @@ Copyright 2015 Google Inc.
- ${project.build.directory}/${project.build.finalName}/WEB-INF/classes
+ ${project.build.directory}/${project.build.finalName}/WEB-INF/classes
+
org.apache.maven.plugins
@@ -106,7 +112,7 @@ Copyright 2015 Google Inc.
com.google.appengine
appengine-maven-plugin
- ${appengine.sdk.version}
+ 1.9.59
diff --git a/appengine/users/src/main/java/com/example/appengine/users/UsersServlet.java b/appengine/users/src/main/java/com/example/appengine/users/UsersServlet.java
index d654fc78384..690cd88119a 100644
--- a/appengine/users/src/main/java/com/example/appengine/users/UsersServlet.java
+++ b/appengine/users/src/main/java/com/example/appengine/users/UsersServlet.java
@@ -14,21 +14,21 @@
*/
// [START users_API_example]
+
package com.example.appengine.users;
import com.google.appengine.api.users.UserService;
import com.google.appengine.api.users.UserServiceFactory;
-
import java.io.IOException;
-
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class UsersServlet extends HttpServlet {
+
@Override
public void doGet(HttpServletRequest req, HttpServletResponse resp)
- throws IOException {
+ throws IOException {
UserService userService = UserServiceFactory.getUserService();
String thisUrl = req.getRequestURI();
@@ -42,8 +42,8 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp)
+ "\">sign out.
");
} else {
resp.getWriter().println("Please sign in.
");
+ + userService.createLoginURL(thisUrl)
+ + "\">sign in.");
}
}
}
diff --git a/appengine/users/src/main/webapp/WEB-INF/web.xml b/appengine/users/src/main/webapp/WEB-INF/web.xml
index 4b2b77234dc..7b67107c3cb 100644
--- a/appengine/users/src/main/webapp/WEB-INF/web.xml
+++ b/appengine/users/src/main/webapp/WEB-INF/web.xml
@@ -1,8 +1,8 @@
-
+
users
com.example.appengine.users.UsersServlet
diff --git a/appengine/users/src/test/java/com/example/appengine/users/UsersServletTest.java b/appengine/users/src/test/java/com/example/appengine/users/UsersServletTest.java
index ffc0a74785a..861e23841b7 100644
--- a/appengine/users/src/test/java/com/example/appengine/users/UsersServletTest.java
+++ b/appengine/users/src/test/java/com/example/appengine/users/UsersServletTest.java
@@ -20,7 +20,11 @@
import static org.mockito.Mockito.when;
import com.google.appengine.tools.development.testing.LocalServiceTestHelper;
-
+import java.io.PrintWriter;
+import java.io.StringWriter;
+import javax.management.remote.JMXPrincipal;
+import javax.servlet.http.HttpServletRequest;
+import javax.servlet.http.HttpServletResponse;
import org.junit.After;
import org.junit.Before;
import org.junit.Test;
@@ -29,26 +33,23 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
-import java.io.PrintWriter;
-import java.io.StringWriter;
-
-import javax.management.remote.JMXPrincipal;
-import javax.servlet.http.HttpServletRequest;
-import javax.servlet.http.HttpServletResponse;
-
/**
* Unit tests for {@link UsersServlet}.
*/
@RunWith(JUnit4.class)
public class UsersServletTest {
- private static final String FAKE_URL = "fakey.fake.fak";
- private static final String FAKE_NAME = "Fake";
+
+ private static final String FAKE_URL = "fakey.fake.fak";
+ private static final String FAKE_NAME = "Fake";
// Set up a helper so that the ApiProxy returns a valid environment for local testing.
private final LocalServiceTestHelper helper = new LocalServiceTestHelper();
- @Mock private HttpServletRequest mockRequestNotLoggedIn;
- @Mock private HttpServletRequest mockRequestLoggedIn;
- @Mock private HttpServletResponse mockResponse;
+ @Mock
+ private HttpServletRequest mockRequestNotLoggedIn;
+ @Mock
+ private HttpServletRequest mockRequestLoggedIn;
+ @Mock
+ private HttpServletResponse mockResponse;
private StringWriter responseWriter;
private UsersServlet servletUnderTest;
@@ -75,7 +76,8 @@ public void setUp() throws Exception {
servletUnderTest = new UsersServlet();
}
- @After public void tearDown() {
+ @After
+ public void tearDown() {
helper.tearDown();
}
@@ -90,7 +92,7 @@ public void doGet_userNotLoggedIn_writesResponse() throws Exception {
.contains("Please .
");
+ .contains("sign in.");
}
@Test
@@ -104,6 +106,6 @@ public void doGet_userLoggedIn_writesResponse() throws Exception {
.contains("Hello, " + FAKE_NAME + "!");
assertThat(responseWriter.toString())
.named("UsersServlet response")
- .contains("sign out");
+ .contains("sign out");
}
}