简体   繁体   English

Google App Engine Java部署和Servlet / jsp关系

[英]Google App Engine Java Deployment and Servlet/jsp relationship

I am trying to understand application deployment on Google App Engine using java. 我正在尝试使用Java了解Google App Engine上的应用程序部署。 Looks like if java is used it is more like deployment of a web application which extends java servlet ( HttpServlet ). 看起来如果使用Java,则更像是扩展了Java servlet(HttpServlet)的Web应用程序的部署。 Let me know if java application can be deployed without using servlet or jsp. 让我知道是否可以在不使用servlet或jsp的情况下部署Java应用程序。

I agree in addition to standard web application deployment it will require GAE specific configuration ie appengine-web.xml. 我同意,除了标准的Web应用程序部署外,它还需要GAE特定的配置,即appengine-web.xml。 But my question is mainly on requirement of servlet for java based deployment. 但是我的问题主要是基于Java部署的servlet需求。

Sorry for very basic question, but all code samples pointed me to servlet but in document there is no mention about servlet. 对一个非常基本的问题很抱歉,但是所有代码示例都将我指向servlet,但是在文档中没有提及servlet。

Depending on which tools (frameworks) you are using in App Engine you may OR NOT write Servlets and JSPs. 根据您在App Engine中使用的工具(框架),您可以或不可以编写Servlet和JSP。 For example if you use Google Endpoints ( https://cloud.google.com/endpoints/docs/frameworks/java/about-cloud-endpoints-frameworks ), you will not write any servlet yourself: they will be automatically generated by the framework itself. 例如,如果您使用Google端点( https://cloud.google.com/endpoints/docs/frameworks/java/about-cloud-endpoints-frameworks ),则您不会自己编写任何servlet:它们将由框架本身。

On the other hand it is totally possible to deploy your own servlets and JSPs, and adapt the web.xml file accordingly. 另一方面,完全可以部署您自己的servlet和JSP,并相应地修改web.xml文件。

As I understand you want to communicate with the server via HTTP. 据我了解,您想通过HTTP与服务器通信。 Servlets are most common way to support this protocol in JVM, unless you want to implement protocol in something low level, like in Netty. Servlet是在JVM中支持该协议的最常见方法,除非您想在Netty等底层实现协议。

Servlet is a set of java interfaces, but it is not required to implement them by yourself. Servlet是一组Java接口,但是您不需要自己实现它们。 Most Java web frameworks provide some implementation for you. 大多数Java Web框架为您提供一些实现。 I mean someone should write this servlet once, but most likely it was written by frameworks authors many years ago, you don't even need to think about its implementation. 我的意思是某人应该只编写一次该servlet,但很可能是多年前框架作者编写的,您甚至无需考虑其实现。

For example I don't remember writing any Servlet since 2003, but I have plenty of working web apps on GAE. 例如,自2003年以来我不记得编写任何Servlet,但是我在GAE上有很多可运行的Web应用程序。 Most of them are Spring based, it have Spring Dispatcher Servlet which does all processing HTTP request/response for you. 它们中的大多数都是基于Spring的,它具有Spring Dispatcher Servlet,它可以为您处理所有HTTP请求/响应。

So the answer is: yes App Engine is Servlet based app container and you need one, but it's very unlikely you'll write any servlet by yourself 因此答案是:是的App Engine是基于Servlet的应用程序容器,您需要一个容器,但是您自己编写任何servlet的可能性很小

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM