GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — merge with master, remove tabs inserted by Eclipse · feulf/java-docs-samples@dbe274f

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • appengine
    • guestbook-cloud-datastore/src
      • main/java/com/example/guestbook
        • Greeting.java
        • Guestbook.java
        • Persistence.java
      • test/java/com/example/guestbook
        • TestUtils.java
    • guestbook-objectify/src/main/webapp/WEB-INF
      • appengine-web.xml
    • helloworld-new-plugins
      • README.md
    • images/src/main/java/com/example/appengine/images
      • ImagesServlet.java
    • logs
      • README.md
      • src/main/java/com/example/appengine/logs
        • LogsServlet.java
    • multitenancy/src/main/webapp/WEB-INF
      • appengine-web.xml
    • oauth2/src/main/webapp/WEB-INF
      • web.xml
    • requests/src/test/java/com/example/appengine/requests
      • LoggingServletTest.java
      • RequestsServletTest.java
  • bigquery/cloud-client/src
    • main/java/com/example/bigquery
      • QuickstartSample.java
      • SimpleApp.java
      • SyncQuerySample.java
    • test/java/com/example/bigquery
      • QuickstartSampleIT.java
  • compute
    • cmdline/src/main/java
      • ComputeEngineSample.java
    • error-reporting
      • README.md
  • datastore
    • cloud-client/src
      • main/java/com/example/datastore
        • QuickstartSample.java
      • test/java/com/example/datastore
        • QuickstartSampleIT.java
    • src
      • main/java/com/google/datastore/snippets
        • TaskList.java
      • test/java/com/google/datastore/snippets
        • ConceptsTest.java
  • endpoints/getting-started/src/main
    • appengine
      • app.yaml
      • openapi.yaml
    • java/com/example/endpoints
      • AuthInfoServlet.java
  • flexible
    • async-rest
      • README.md
    • cloudstorage/src/main/java/com/example/cloudstorage
      • UploadServlet.java
    • datastore/src/main/java/com/example/datastore
      • DatastoreServlet.java
    • endpoints
      • README.md
      • src/main
        • appengine
          • app.yaml
          • openapi.yaml
        • java/com/example/endpoints
          • AuthInfoServlet.java
    • helloworld
      • README.md
    • sparkjava/src
      • main/java/com/google/appengine/sparkdemo
        • Main.java
        • UserService.java
      • test/java/com/google/appengine/sparkdemo
        • UserServiceTest.java
  • language/analysis/src
    • main/java/com/google/cloud/language/samples
      • Analyze.java
    • test/java/com/google/cloud/language/samples
      • AnalyzeIT.java
  • monitoring/v3
    • README.md
  • pubsub/cloud-client/src
    • main/java/com/example/pubsub
      • QuickstartSample.java
    • test/java/com/example/pubsub
      • QuickstartSampleIT.java
  • storage
    • cloud-client/src
      • main/java/com/example/storage
        • QuickstartSample.java
      • test/java/com/example/storage
        • QuickstartSampleIT.java
    • storage-transfer
      • README.md
      • pom.xml
      • src
        • main/java/com/google/cloud/storage/storagetransfer/samples
          • AwsRequester.java
          • NearlineRequester.java
          • RequestChecker.java
          • TransferClientCreator.java
          • TransferJobUtils.java
        • test/java/com/google/cloud/storage/storagetransfer/samples/test
          • RequestCheckerTest.java
          • TransferJobUtilsTest.java
    • xml-api/serviceaccount-appengine-sample/src/main/webapp/WEB-INF
      • web.xml
  • translate
    • README.md
    • cloud-client/src
      • main/java/com/example/translate
        • QuickstartSample.java
      • test/java/com/example/translate
        • QuickstartSampleIT.java
    • src
      • main/java/com/google/cloud/translate/samples
        • TranslateText.java
      • test/java/com/google/cloud/translate/samples
        • TranslateTextTest.java

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Dismiss banner
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Greeting.java‎

Copy file name to clipboardExpand all lines: appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Greeting.java
+3-3Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public Greeting(String book, String content, String id, String email) {
5454
}
5555

5656
public Greeting(Entity entity) {
57-
key = entity.hasKey() ? entity.key() : null;
57+
key = entity.hasKey() ? entity.getKey() : null;
5858
authorEmail = entity.contains("authorEmail") ? entity.getString("authorEmail") : null;
5959
authorId = entity.contains("authorId") ? entity.getString("authorId") : null;
6060
date = entity.contains("date") ? entity.getDateTime("date").toDate() : null;
@@ -66,7 +66,7 @@ public void save() {
6666
key = getDatastore().allocateId(makeIncompleteKey()); // Give this greeting a unique ID
6767
}
6868

69-
Builder<Key> builder = FullEntity.builder(key);
69+
Builder<Key> builder = FullEntity.newBuilder(key);
7070

7171
if (authorEmail != null) {
7272
builder.set("authorEmail", authorEmail);
@@ -84,7 +84,7 @@ public void save() {
8484

8585
private IncompleteKey makeIncompleteKey() {
8686
// The book is our ancestor key.
87-
return Key.builder(book.getKey(), "Greeting").build();
87+
return Key.newBuilder(book.getKey(), "Greeting").build();
8888
}
8989

9090
@Override
Collapse file

‎appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Guestbook.java‎

Copy file name to clipboardExpand all lines: appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Guestbook.java
+5-5Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,11 +52,11 @@ public Key getKey() {
5252
public List<Greeting> getGreetings() {
5353
// This query requires the index defined in index.yaml to work because of the orderBy on date.
5454
EntityQuery query =
55-
Query.entityQueryBuilder()
56-
.kind("Greeting")
57-
.filter(hasAncestor(key))
58-
.orderBy(desc("date"))
59-
.limit(5)
55+
Query.newEntityQueryBuilder()
56+
.setKind("Greeting")
57+
.setFilter(hasAncestor(key))
58+
.setOrderBy(desc("date"))
59+
.setLimit(5)
6060
.build();
6161

6262
QueryResults<Entity> results = getDatastore().run(query);
Collapse file

‎appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Persistence.java‎

Copy file name to clipboardExpand all lines: appengine/guestbook-cloud-datastore/src/main/java/com/example/guestbook/Persistence.java
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public class Persistence {
2525

2626
public static Datastore getDatastore() {
2727
if (datastore.get() == null) {
28-
datastore.set(DatastoreOptions.builder().projectId("your-project-id-here").build().service());
28+
datastore.set(DatastoreOptions.newBuilder().setProjectId("your-project-id-here")
29+
.build().getService());
2930
}
3031

3132
return datastore.get();
@@ -36,7 +37,7 @@ public static void setDatastore(Datastore datastore) {
3637
}
3738

3839
public static KeyFactory getKeyFactory(Class<?> c) {
39-
return getDatastore().newKeyFactory().kind(c.getSimpleName());
40+
return getDatastore().newKeyFactory().setKind(c.getSimpleName());
4041
}
4142
}
4243
//[END all]
Collapse file

‎appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/TestUtils.java‎

Copy file name to clipboardExpand all lines: appengine/guestbook-cloud-datastore/src/test/java/com/example/guestbook/TestUtils.java
+3-2Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ public class TestUtils {
1818
public static void startDatastore() {
1919
try {
2020
datastore.start();
21-
Persistence.setDatastore(datastore.options().service());
21+
Persistence.setDatastore(datastore.getOptions().getService());
2222
} catch (IOException | InterruptedException e) {
2323
throw new RuntimeException(e);
2424
}
@@ -35,7 +35,8 @@ public static void stopDatastore() {
3535

3636
public static void wipeDatastore() {
3737
Datastore datastore = getDatastore();
38-
QueryResults<Key> guestbooks = datastore.run(Query.keyQueryBuilder().kind("Greeting").build());
38+
QueryResults<Key> guestbooks = datastore.run(Query.newKeyQueryBuilder().setKind("Greeting")
39+
.build());
3940
ArrayList<Key> keys = Lists.newArrayList(guestbooks);
4041

4142
if (!keys.isEmpty()) {
Collapse file

‎appengine/guestbook-objectify/src/main/webapp/WEB-INF/appengine-web.xml‎

Copy file name to clipboardExpand all lines: appengine/guestbook-objectify/src/main/webapp/WEB-INF/appengine-web.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<application>your-app-id</application>
44
<version>${appengine.app.version}</version>
55
<threadsafe>true</threadsafe>
6-
6+
77
<system-properties>
88
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
99
</system-properties>
Collapse file

‎appengine/helloworld-new-plugins/README.md‎

Copy file name to clipboardExpand all lines: appengine/helloworld-new-plugins/README.md
+2-2Lines changed: 2 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ Use either:
1818
### Running locally
1919

2020
$ mvn appengine:run
21-
21+
2222
### Deploying
2323

2424
$ mvn appengine:deploy
@@ -36,7 +36,7 @@ If you do not have gradle installed, you can run using `./gradlew appengineRun`.
3636

3737
If you do not have gradle installed, you can deploy using `./gradlew appengineDeploy`.
3838

39-
<!--
39+
<!--
4040
## Intelij Idea
4141
Limitations - Appengine Standard support in the Intellij plugin is only available for the Ultimate Edition of Idea.
4242
Collapse file

‎appengine/images/src/main/java/com/example/appengine/images/ImagesServlet.java‎

Copy file name to clipboardExpand all lines: appengine/images/src/main/java/com/example/appengine/images/ImagesServlet.java
+2-2Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
6161
FileChannel fileChannel = fileInputStream.getChannel();
6262
ByteBuffer byteBuffer = ByteBuffer.allocate((int)fileChannel.size());
6363
fileChannel.read(byteBuffer);
64-
64+
6565
byte[] imageBytes = byteBuffer.array();
6666

6767
// Write the original image to Cloud Storage
@@ -103,7 +103,7 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp) throws IOExc
103103
//[END rotate]
104104

105105
// Output some simple HTML to display the images we wrote to Cloud Storage
106-
// in the browser.
106+
// in the browser.
107107
PrintWriter out = resp.getWriter();
108108
out.println("<html><body>\n");
109109
out.println("<img src='//storage.cloud.google.com/" + bucket
Collapse file

‎appengine/logs/README.md‎

Copy file name to clipboardExpand all lines: appengine/logs/README.md
+2-2Lines changed: 2 additions & 2 deletions
  • Display the source diff
  • Display the rich diff
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ Engine][ae-docs].
66
[log-docs]: https://cloud.google.com/appengine/docs/java/logs/
77
[ae-docs]: https://cloud.google.com/appengine/docs/java/
88

9-
## Running locally
9+
## Running locally
1010

1111
The Logs API only generates output for deployed apps, so this program should not be run locally.
1212

1313
## Deploying
14-
14+
1515
This example uses the
1616
[Maven gcloud plugin](https://cloud.google.com/appengine/docs/java/managed-vms/maven).
1717

Collapse file

‎appengine/logs/src/main/java/com/example/appengine/logs/LogsServlet.java‎

Copy file name to clipboardExpand all lines: appengine/logs/src/main/java/com/example/appengine/logs/LogsServlet.java
+6-6Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,15 @@
3434
// a time, using a Next link to cycle through to the next 5.
3535
public class LogsServlet extends HttpServlet {
3636
@Override
37-
public void doGet(HttpServletRequest req, HttpServletResponse resp)
37+
public void doGet(HttpServletRequest req, HttpServletResponse resp)
3838
throws IOException {
3939

4040
resp.setContentType("text/html");
4141
PrintWriter writer = resp.getWriter();
4242
writer.println("<!DOCTYPE html>");
4343
writer.println("<meta charset=\"utf-8\">");
4444
writer.println("<title>App Engine Logs Sample</title>");
45-
45+
4646
// We use this to break out of our iteration loop, limiting record
4747
// display to 5 request logs at a time.
4848
int limit = 5;
@@ -81,17 +81,17 @@ public void doGet(HttpServletRequest req, HttpServletResponse resp)
8181
writer.println(String.format("<br>Date: %s", appTime.toString()));
8282
writer.println("<br>Level: " + appLog.getLogLevel() + "<br>");
8383
writer.println("Message: " + appLog.getLogMessage() + "<br> <br>");
84-
}
84+
}
8585

8686
if (++count >= limit) {
8787
break;
8888
}
89-
}
89+
}
9090

9191
// When the user clicks this link, the offset is processed in the
9292
// GET handler and used to cycle through to the next 5 request logs.
9393
writer.println(String.format("<br><a href=\"/?offset=%s\">Next</a>", lastOffset));
94-
}
95-
}
94+
}
95+
}
9696
// [END logs_API_example]
9797

Collapse file

‎appengine/multitenancy/src/main/webapp/WEB-INF/appengine-web.xml‎

Copy file name to clipboardExpand all lines: appengine/multitenancy/src/main/webapp/WEB-INF/appengine-web.xml
+1-1Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<application>your-app-id</application>
44
<version>${appengine.app.version}</version>
55
<threadsafe>true</threadsafe>
6-
6+
77
<system-properties>
88
<property name="java.util.logging.config.file" value="WEB-INF/logging.properties"/>
99
</system-properties>

0 commit comments

Comments
0 (0)
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.