Google App Engine(2)Java Start and Project
We need to use war directory instead of war archive file for app engine SDK.
The Project Directory
The structure of the project is going to be like this:
Guestbook
src/
war/
WEN-INF /
lib/
classes/
Almost the same as I am working in normal web project.
As I am using eclipse plugin, so I can just create a new project there based on the plugin.
I just type the project name and package declaration, place the project in this directory /Users/carl/work/appengine.
Base on my long term Java working experience, I think the below is the common Java Servlet work.
The Servlet Class
An HTTP servlet is an application class that can process and respond to web request.
Follow the document, it is just a class implement the HttpServlet API and overwrite the doGet method as follow:
package com.sillycat.sample.guestbook;
import java.io.IOException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class GuestbookServlet extends HttpServlet {
private static final long serialVersionUID = -8974156249244283590L;
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
resp.setContentType("text/plain");
resp.getWriter().println("Hello, world");
}
}
The web.xml File
Make my own servlet work in web.xml. Web.xml is something just like the routes or URL mapping.
…snip...
<servlet>
<servlet-name>guestbook</servlet-name>
<servlet-class>com.sillycat.sample.guestbook.GuestbookServlet</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>guestbook</servlet-name>
<url-pattern>/guestbook</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
</welcome-file-list>
</web-app>
The app engine-web.xml File
Additional configuration file is named appengine-web.xml and it is along with web.xml.
The configuration detail is here https://developers.google.com/appengine/docs/java/config/appconfig
I only configure my_app_id in application entry first.
Running the Project
Just run on eclipse plugin, but I got this error messages.
Error Message:
[ERROR] Unable to find 'com/sillycat/sample/guestbook/Guestbook.gwt.xml' on your classpath; could be a typo, or maybe you forgot to include a classpath entry for source?
[ERROR] shell failed in doStartup method
Error Message:
Missing required argument 'module[s]'
Solution:
The problem came when I create the project, I should pay attention to the option when I create projects. I should not select Google Web Toolkit, but only select Google App Engine.
Testing the Application
I can verify my application with this URL on my local browser then.
http://localhost:8888/guestbook
And the admin console URL is as follow:
http://localhost:8888/_ah/admin
References:
https://developers.google.com/appengine/docs/java/gettingstarted/creating
https://developers.google.com/appengine/docs/java/config/appconfig
http://stackoverflow.com/questions/8628429/google-app-engine-missing-required-argument-modules
分享到:
相关推荐
Google AppEngine J2EE web application Android To get started you may want to play with the live demo. Once you're ready to dive in to the code simply download the zip archive and follow the ...
示例 Play 框架 scala 后端使用 Google App Engine 管理的 VM 和自定义运行时。 先决条件 安装活化剂 在上创建一个新的云项目 导出您的项目 ID: $ export PROJECT_ID= < project> 跑步 本地 ```sh # Start the ...
它旨在与可作为“ google.golang.org/appengine”使用的新appengine接口一起使用,但应易于移植到经典appengine。 测试gcloud --project pendo-io beta emulators datastore start --host-port 127.0.0.1:8090 ...
- `appengine:start`:在本地启动App Engine开发服务器进行测试。 - `appengine:stop`:停止本地运行的App Engine开发服务器。 每个目标会涉及到与Google App Engine SDK的交互,读取项目配置,执行必要的部署或...
Get a feel for app deployment using Docker and Google App Engine Table of Contents Chapter 1: Chat Application with Web Sockets Chapter 2: Adding User Accounts Chapter 3: Three Ways to Implement ...
You will begin the book with an empty Cocos2D project and build on it until you end up with a complete game. The book will teach you how to work on game logic, handling user input, controlling the ...
You'll start with game design fundamentals and programming basics, and then progress toward creating your own basic game engine and playable game apps that work on Android and earlier version ...
Use the Ember CLI to build your app using module-focused JavaScript classes with a clear project structure. Learn how to use Ember's routing classes to organize your app, write web components that ...
Learn about Product Flavors - Build Types - Build Variants and build different APK's from the same project (includes an example with 2 Flavors). Game Development with AndEngine and libGDX Integration...
"start:app-multi" : "yarn workspace @project/app-multi-comps start" , "start:app-single" : "yarn workspace @project/app-single-comp start" , "start:app-ts" : "yarn workspace @project/app-type
Even faster Key/Value store nosql embedded database engine utilizing the new MGIndex data structure with MurMur2 Hashing and WAH Bitmap indexes for duplicates. See Also More like this More by this...
隐含碳的含义加密将我撕裂,丽莎在开始之前,运行: npm install 然后从客户端文件夹运行: npm start在Google App Engine中部署React构建创建一个新项目创建一个Google App Engine实例gcloud config set project ...
app.set('view engine', 'ejs'); // 其他配置... ``` 3. **使用 EJS 模板** - 在 `views` 文件夹中创建 `.ejs` 文件来编写模板。 - 例如,在 `views` 文件夹下创建一个名为 `index.ejs` 的文件: ```html <!...
app.set('view engine', 'ejs'); app.use(express.static('public')); app.get('/', (req, res) => { res.render('index', { products: getProducts() }); }); function getProducts() { // 这里返回商品...
oc new-project three-tier-app oc project three-tier-app 部署mysql数据库: oc new-app --name=mysql5 --docker-image=mysql:5.7 \ -e MYSQL_USER=user1 -e MYSQL_PASSWORD=mypa55 -e MYSQL_DATABASE=
在 Android Studio 中,选择 "Start a new Android Studio project",然后在向导中选择 "Wearable App" 模板。确保在模块配置中勾选 "Add wear app to project",这样会生成一个包含 Wearable 库的模块。 ### 3. ...
[模块依赖](project-bootstrap/project.png) #### 模块介绍 > zheng-common Spring+SpringMVC+Mybatis框架集成公共模块,包括公共配置、MybatisGenerator扩展插件、通用BaseService、工具类等。 > zheng-admin ...