GAE / Java8 trial (Part 5: "Console for local development")

theme

Last time implemented the access logic to Datastore in test first. This time, I will write briefly about how to start the GAE application locally and check the operation.

GAE Trial Index

-GAE / Java8 trial (No. 0: "About App Engine") -GAE / Java8 trial (Part 1: "Create and deploy a web application with Java8") -GAE / Java8 trial (Part 2: "Java application explanation") -GAE / Java8 trial (Part 3: "Java application test code explanation") -GAE / Java8 trial (4: "Access logic to Datastore")

Development environment

OS

$ cat /etc/os-release 
NAME="Ubuntu"
VERSION="17.10 (Artful Aardvark)"

Java

$ java -version
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

IDE

Everyone loves IntelliJ IDEA

reference

--Use Java Local Development Server

Practice

A little modification of the source I wrote last time.

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
	String id = req.getParameter("id");
	String name = req.getParameter("name");

	DatastoreService ds = DatastoreServiceFactory.getDatastoreService();
	Entity e = new Entity(KeyFactory.createKey("book", Integer.parseInt(id)));
	e.setProperty("bookName", name);
	ds.put(e);
}

First, start the local development server. This is as in Previously written article.

$ mvn appengine:run

Confirm by POST with Postman.

Screenshot from 2018-11-01 01-56-44.png

Although it is the logic to register the request parameter in the Datastore, it is unknown whether it was processed normally because it does not return any response. At times like this (not limited to this time ...), use the console for local development.

http://localhost:8080/_ah/admin Access here. Then, such a screen is displayed. This is the "console for local development".

Screenshot from 2018-11-01 02-11-17.png

Then, when you press "List Entries", you can see that the contents loaded in the request parameters by Postman are registered in the Datastore.

Screenshot from 2018-11-01 02-13-31.png

Summary

You can see the status of the Task queue as well as the Datastore. You can also control access to resources such as Datastore, Memcache, and Task queues. This is convenient. Screenshot from 2018-11-01 02-20-37.png Screenshot from 2018-11-01 02-21-46.png

Recommended Posts

GAE / Java8 trial (Part 5: "Console for local development")
GAE / Java8 trial (Part 6: "Deployment failure")
GAE / Java8 trial (Part 4: "Datastore access logic")
Build Java development environment (for Mac)
Sample code collection for Azure Java development
Creating a java web application development environment with docker for mac part1
Convenient plugin for Eclipse JAVA development: Decompiler
Create a java web application development environment with docker for mac part2
Java development with Codenvy: Console app debug
Is Java SE8 Silver useful for Java development work? ??
Build a development environment for Docker, java, vscode
Java development training
For JAVA learning (2018-03-16-01)
[Java development] Java memory
java practice part 1
Java development environment
2017 IDE for Java
Java local class
Java for statement
Things to watch out for in future Java development
CI / CD practice for beginners --Part3 --Preparation for development project
Java development for beginners to start from 1-Vol.1-eclipse setup
[Java] Platforms to choose from for Java development starting now (2020)