是否可以将 Java Servlet 部署到 GAE? [英] Is it possible to deploy a Java Servlet to GAE?
本文介绍了是否可以将 Java Servlet 部署到 GAE?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
是否可以将 Java Servlet 部署到 GAE,或者服务器是否需要托管在其他地方?
Is it possible to deploy a Java Servlet to GAE, or does the server need to be hosted elsewhere?
推荐答案
简短回答:是
答案稍长:
App Engine 使用 Jetty servlet 容器来托管应用程序并支持 Java Servlet API 2.4 版.请记住,您必须遵守一些限制(source):
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 运行 Java 6 版本,但不提供所有 Java 类,例如 Swing 和大多数 AWT 类不受支持.
- 您不能使用线程或使用线程的框架.
- 您不能写入文件系统.
- 您只能读取属于您的应用程序的文件.
- 某些java.lang.System"操作,例如gc() 或 exit() 什么也不做.
- 您不能调用 JNI 代码.
- 反射可以用于您自己的类和标准 Java 类,但您不能使用反射来访问应用程序之外的其他类.
- servlet 必须在 30 秒内回复,否则会抛出
com.google.apphosting.api.DeadlineExceededException
. - 请参阅此处,了解列入白名单的 Java 类.
- 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屋!
查看全文