是否可以将Java Servlet部署到GAE? [英] Is it possible to deploy a Java Servlet to GAE?

查看:70
本文介绍了是否可以将Java Servlet部署到GAE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

是否可以将Java Servlet部署到GAE,还是需要将服务器托管在别处? 回答:

稍微长一点的答案: > App Engine使用Jetty servlet容器托管应用程序并支持Java Servlet API 2.4版。请记住,虽然有相当多的限制,你必须尊重(来源):


  • App Engine运行Java 6版本,但不提供所有Java类,例如Swing和大多数AWT类不支持。
  • 您不能使用使用线程的线程或框架。

  • 您可能无法写入文件系统。

  • 您只能读取属于您的应用程序的文件。

  • 某些java.lang.System操作,例如gc()或exit()不会执行任何操作。
  • 无法调用JNI代码。
  • 反射对于您自己的类和标准Java类,但不能使用反射来访问应用程序之外的其他类。

  • 一个servlet必须在30秒内回复或 com.google.apphosting.api.DeadlineExceededException

  • 请参阅这里为列入白名单的Java类。



请务必阅读 The Sandbox 可以查看哪些内容和哪些内容无效的示例。


Is it possible to deploy a Java Servlet to GAE, or does the server need to be hosted elsewhere?

解决方案

Short answer: Yes

Slightly longer answer:

App Engine uses the Jetty servlet container to host applications and supports the Java Servlet API version 2.4. Keep in mind though that there are quite a few restrictions in place that you have to respect (source):

  • App Engine runs a version of Java 6 but does not provide all Java classes, for example Swing and most AWT classes are not supported.
  • You cannot use Threads or frameworks which use Threads.
  • You may not write to the filesystem.
  • You may only read files which are part of your application.
  • Certain "java.lang.System" actions, e.g. gc() or exit() will do nothing.
  • You can not call JNI code.
  • Reflection is possible for your own classes and standard Java classes, but your cannot use reflection to access other classes outside your application.
  • A servlet must reply within 30 seconds or a com.google.apphosting.api.DeadlineExceededException is thrown.
  • See here for the Java classes that are white-listed.

Be sure to also read up on The Sandbox to see examples of what will and will not work.

这篇关于是否可以将Java Servlet部署到GAE?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆