org.apache.maven.plugins
maven-war-plugin
diff --git a/managed_vms/async-rest/src/main/java/com/google/appengine/demos/DumpServlet.java b/managed_vms/async-rest/src/main/java/com/google/appengine/demos/DumpServlet.java
index 6d0541adceb..87012af49cd 100644
--- a/managed_vms/async-rest/src/main/java/com/google/appengine/demos/DumpServlet.java
+++ b/managed_vms/async-rest/src/main/java/com/google/appengine/demos/DumpServlet.java
@@ -1,19 +1,3 @@
-/*
- * 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.
- */
-
package com.google.appengine.demos;
import java.io.IOException;
@@ -29,8 +13,9 @@
public class DumpServlet extends HttpServlet {
@Override
- protected void doGet(HttpServletRequest request, HttpServletResponse response)
- throws ServletException, IOException {
+ protected void doGet(HttpServletRequest request,
+ HttpServletResponse response) throws ServletException,
+ IOException {
response.setContentType("text/html");
response.setStatus(HttpServletResponse.SC_OK);
@@ -43,42 +28,19 @@ protected void doGet(HttpServletRequest request, HttpServletResponse response)
out.printf("getServletContextName=%s%n", getServletContext().getServletContextName());
out.printf("virtualServerName=%s%n", getServletContext().getVirtualServerName());
out.printf("contextPath=%s%n", getServletContext().getContextPath());
- out.printf(
- "version=%d.%d%n",
- getServletContext().getMajorVersion(),
- getServletContext().getMinorVersion());
- out.printf(
- "effectiveVersion=%d.%d%n",
- getServletContext().getEffectiveMajorVersion(),
- getServletContext().getEffectiveMinorVersion());
+ out.printf("version=%d.%d%n", getServletContext().getMajorVersion(), getServletContext().getMinorVersion());
+ out.printf("effectiveVersion=%d.%d%n", getServletContext().getEffectiveMajorVersion(), getServletContext().getEffectiveMinorVersion());
out.println("");
out.println("Request Fields:
");
out.println("");
- out.printf(
- "remoteHost/Addr:port=%s/%s:%d%n",
- request.getRemoteHost(),
- request.getRemoteAddr(),
- request.getRemotePort());
- out.printf(
- "localName/Addr:port=%s/%s:%d%n",
- request.getLocalName(),
- request.getLocalAddr(),
- request.getLocalPort());
- out.printf(
- "scheme=%s method=%s protocol=%s%n",
- request.getScheme(),
- request.getMethod(),
- request.getProtocol());
+ out.printf("remoteHost/Addr:port=%s/%s:%d%n", request.getRemoteHost(), request.getRemoteAddr(), request.getRemotePort());
+ out.printf("localName/Addr:port=%s/%s:%d%n", request.getLocalName(), request.getLocalAddr(), request.getLocalPort());
+ out.printf("scheme=%s method=%s protocol=%s%n", request.getScheme(), request.getMethod(), request.getProtocol());
out.printf("serverName:serverPort=%s:%d%n", request.getServerName(), request.getServerPort());
out.printf("requestURI=%s%n", request.getRequestURI());
out.printf("requestURL=%s%n", request.getRequestURL().toString());
- out.printf(
- "contextPath|servletPath|pathInfo=%s|%s|%s%n",
- request.getContextPath(),
- request.getServletPath(),
- request.getPathInfo());
- out.printf(
- "session/new=%s/%b%n", request.getSession(true).getId(), request.getSession().isNew());
+ out.printf("contextPath|servletPath|pathInfo=%s|%s|%s%n", request.getContextPath(), request.getServletPath(), request.getPathInfo());
+ out.printf("session/new=%s/%b%n", request.getSession(true).getId(), request.getSession().isNew());
out.println("");
out.println("Request Headers:
");
out.println("");
diff --git a/managed_vms/async-rest/src/main/java/com/google/appengine/demos/asyncrest/AbstractRestServlet.java b/managed_vms/async-rest/src/main/java/com/google/appengine/demos/asyncrest/AbstractRestServlet.java
index 51a3e49b096..07956c2dc3d 100644
--- a/managed_vms/async-rest/src/main/java/com/google/appengine/demos/asyncrest/AbstractRestServlet.java
+++ b/managed_vms/async-rest/src/main/java/com/google/appengine/demos/asyncrest/AbstractRestServlet.java
@@ -1,19 +1,3 @@
-/*
- * 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.
- */
-
package com.google.appengine.demos.asyncrest;
import java.io.IOException;
@@ -32,31 +16,32 @@
import javax.servlet.http.HttpServletResponse;
/**
- * Abstract base class for REST servlets.
+ * AbstractRestServlet.
+ *
*/
public class AbstractRestServlet extends HttpServlet {
- protected static final int MAX_RESULTS = 5;
+ protected final static int MAX_RESULTS = 5;
- protected static final String STYLE = "";
- protected static final String APPKEY = "com.google.appengine.demos.asyncrest.appKey";
- protected static final String APPKEY_ENV = "PLACES_APPKEY";
- protected static final String LOC_PARAM = "loc";
- protected static final String ITEMS_PARAM = "items";
- protected static final String LATITUDE_PARAM = "lat";
- protected static final String LONGITUDE_PARAM = "long";
- protected static final String RADIUS_PARAM = "radius";
+ protected final static String APPKEY = "com.google.appengine.demos.asyncrest.appKey";
+ protected final static String APPKEY_ENV = "PLACES_APPKEY";
+ protected final static String LOC_PARAM = "loc";
+ protected final static String ITEMS_PARAM = "items";
+ protected final static String LATITUDE_PARAM = "lat";
+ protected final static String LONGITUDE_PARAM = "long";
+ protected final static String RADIUS_PARAM = "radius";
protected String key;
@Override
public void init(ServletConfig servletConfig) throws ServletException {
- // First try the servlet context init-param.
+ //first try the servlet context init-param
String source = "InitParameter";
key = servletConfig.getInitParameter(APPKEY);
if (key == null || key.startsWith("${")) {
@@ -75,19 +60,18 @@ public void init(ServletConfig servletConfig) throws ServletException {
}
}
- public static String sanitize(String str) {
- if (str == null) {
+ public static String sanitize(String s) {
+ if (s == null) {
return null;
}
- return str.replace("<", "?").replace("&", "?").replace("\n", "?");
+ return s.replace("<", "?").replace("&", "?").replace("\n", "?");
}
protected String restQuery(String coordinates, String radius, String item) {
try {
- return "https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=" + key
- + "&location=" + URLEncoder.encode(coordinates, "UTF-8")
- + "&types=" + URLEncoder.encode(item, "UTF-8")
- + "&radius=" + URLEncoder.encode(radius, "UTF-8");
+ return "https://maps.googleapis.com/maps/api/place/nearbysearch/json?key=" + key + "&location="
+ + URLEncoder.encode(coordinates, "UTF-8") + "&types=" + URLEncoder.encode(item, "UTF-8")
+ + "&radius=" + URLEncoder.encode(radius, "UTF-8");
} catch (Exception e) {
throw new RuntimeException(e);
@@ -100,22 +84,21 @@ public String generateResults(Queue