`
sillycat
  • 浏览: 2492044 次
  • 性别: Icon_minigender_1
  • 来自: 成都
社区版块
存档分类
最新评论

Google App Engine(2)Java Start and Project

 
阅读更多
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 plus java start

    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 ...

    gcloud-play-sample:示例 Play 框架 scala 后端,使用 Google App Engine 托管的 VM 和自定义运行时

    示例 Play 框架 scala 后端使用 Google App Engine 管理的 VM 和自定义运行时。 先决条件 安装活化剂 在上创建一个新的云项目 导出您的项目 ID: $ export PROJECT_ID= &lt; project&gt; 跑步 本地 ```sh # Start the ...

    appwrap:用于抽象的appengine数据存储区和memcache(现在称为memstore)的接口,以及用于仅测试的简单重新实现

    它旨在与可作为“ google.golang.org/appengine”使用的新​​appengine接口一起使用,但应易于移植到经典appengine。 测试gcloud --project pendo-io beta emulators datastore start --host-port 127.0.0.1:8090 ...

    Go.Programming.Blueprints.2nd

    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 ...

    Go: Design Patterns for Real-World Projects

    You will get a feel for app deployment using Docker and Google App Engine. Each project could form the basis of a start-up, which means they are directly applicable to modern software markets. With ...

    .Learning.iPhone.Game.Development.with.Cocos2D.3.0

    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 ...

    Beginning Android Games

     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 ...

    Getting Started with Android Studio

    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...

    Go_Design+Patterns+for+Real-World+Projects-Packt+Publishing(2017).pdf

    will get a feel for app deployment using Docker and Google App Engine. Each project could form the basis of a start-up, which means they are directly applicable to modern software markets.

    Deliver.Audacious.Web.Apps.with.Ember2

    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 ...

    Android 4 游戏开发入门(Beginning Android 4 Games Development)

    You'll start with game design fundamentals and programming basics, and then progress toward creating your own basic game engine and playable game that works on Android 4.0 and earlier devices....

    psychic-engine

    "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

    BobBuilder_app

    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...

    the-carbon-implication-of-crypto

    隐含碳的含义加密将我撕裂,丽莎在开始之前,运行: npm install 然后从客户端文件夹运行: npm start在Google App Engine中部署React构建创建一个新项目创建一个Google App Engine实例gcloud config set project ...

    OpenShift-Example:在OpenShift的单个节点上部署的三层应用程序

    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=

    在C++程序中使用QML

    2.具体代码 // UICtest.qml import Qt 4.7 Rectangle { id: mainWidget; width: 640 height: 480 function callbyc(v) { mainWidget.color = v; return "finish"; } Rectangle{ id: secondRect; x: 100...

    单点登录源码

    [模块依赖](project-bootstrap/project.png) #### 模块介绍 &gt; zheng-common Spring+SpringMVC+Mybatis框架集成公共模块,包括公共配置、MybatisGenerator扩展插件、通用BaseService、工具类等。 &gt; zheng-admin ...

Global site tag (gtag.js) - Google Analytics