是否可以将 Java Servlet 部署到 GAE?

发布于 2024-12-28 13:03:02 字数 51 浏览 1 评论 0原文

是否可以将 Java Servlet 部署到 GAE,或者服务器是否需要托管在其他地方?

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

若有似无的小暗淡 2025-01-04 13:03:03

简短的回答:

稍长的回答:

App Engine 使用 Jetty servlet 容器来托管应用程序并支持 Java Servlet API 版本 2.4。请记住,您必须遵守相当多的限制(来源< /a>):

  • App Engine 运行 Java 6 版本,但不提供所有 Java 类,例如不支持 Swing 和大多数 AWT 类。
  • 您不能使用线程或使用线程的框架。
  • 您不能写入文件系统。
  • 您只能读取属于您的应用程序一部分的文件。
  • 某些“java.lang.System”操作,例如 gc() 或 exit() 将不执行任何操作。
  • 您不能调用 JNI 代码。
  • 您自己的类和标准 Java 类可以进行反射,但您不能使用反射来访问应用程序外部的其他类。
  • servlet 必须在 30 秒内回复,否则将引发 com.google.apphosting.api.DeadlineExceededException
  • 请参阅此处了解列入白名单的 Java 类。

请务必阅读沙盒,查看以下示例什么会起作用,什么不会起作用。

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.

薄荷港 2025-01-04 13:03:03

可以将基本servlet部署到GAE,但是您还需要执行其他操作才能让GAE接受它。

强烈推荐对该主题进行快速网络搜索。您会发现有大量这方面的资源,包括 GAE 站点本身的文档。

You can deploy a basic servlet to GAE, but there are additional things you need to do for GAE to accept it.

I would highly recommend a quick web search on the topic. You will find that there are tons of resources for this, including the documentation at the GAE site itself.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文