Skip to content

Use std runtime #900

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 26, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
import com.google.gson.GsonBuilder;
import com.google.gson.JsonParser;
import java.io.IOException;
import java.lang.Exception;
import java.util.Enumeration;
import java.util.Map;
import java.util.Properties;
Expand Down Expand Up @@ -83,27 +84,39 @@ public class GaeInfoServlet extends HttpServlet {

// Fetch Metadata
String fetchMetadata(String key) throws IOException {
Request request = new Request.Builder()
.url(metadata + key)
.addHeader("Metadata-Flavor", "Google")
.get()
.build();

Response response = ok.newCall(request).execute();
return response.body().string();
try {
Request request = new Request.Builder()
.url(metadata + key)
.addHeader("Metadata-Flavor", "Google")
.get()
.build();

Response response = ok.newCall(request).execute();
return response.body().string();
} catch (Exception e) {
log("fetchMetadata - "+metadata+key+": ", e);
}
return "";
}

String fetchJsonMetadata(String prefix) throws IOException {
String json = "";
try {
Request request = new Request.Builder()
.url(metadata + prefix )
.addHeader("Metadata-Flavor", "Google")
.get()
.build();

Response response = ok.newCall(request).execute();

// Convert json to prety json
return gson.toJson(jp.parse(response.body().string()));
Response response = ok.newCall(request).execute();
// Convert json to prety json
json = response.body().string();
return gson.toJson(jp.parse(json));
} catch (Exception e) {
log("fetchJsonMetadata - "+metadata+prefix+" : ", e);
log(" body: "+json);
}
return "{}";
}

@Override
Expand Down
5 changes: 4 additions & 1 deletion flexible/sparkjava/src/main/appengine/app.yaml
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
runtime: custom
runtime: java
env: flex

runtime_config:
jdk: openjdk8
4 changes: 0 additions & 4 deletions flexible/sparkjava/src/main/docker/Dockerfile

This file was deleted.

2 changes: 1 addition & 1 deletion flexible/sparkjava/src/main/resources/public/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
<div class="container" role="main">
<div class="jumbotron">
<h1>User Database</h1>
<p>Using App Engine Managed VMs, Google Cloud Datastore, and SparkJava.</p>
<p>Using App Engine Flexible, Google Cloud Datastore, and SparkJava.</p>
</div>
<div class="page-header">
<h1>All users</h1>
Expand Down