是否可以将Java Servlet部署到GAE? [英] Is it possible to deploy a Java Servlet to GAE?
问题描述
是否可以将Java Servlet部署到GAE,还是需要将服务器托管在别处? 回答:是
稍微长一点的答案: > App Engine使用Jetty servlet容器托管应用程序并支持Java Servlet API 2.4版。请记住,虽然有相当多的限制,你必须尊重(来源):
com.google.apphosting.api.DeadlineExceededException
请务必阅读 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屋!