在Java AppEngine中为Java构建一个JS服务器 [英] Build a JS server inside of Java for Google AppEngine

查看:95
本文介绍了在Java AppEngine中为Java构建一个JS服务器的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只需要为一个项目创建一个小界面。所以我决定采用给定的代码并在Google AppEngine上运行它。我的问题是,我在JavaScript方面经验丰富,并掌握了Java的一些基本知识,但我不知道如何构建Java Web应用程序。我启动了Eclipse,并安装了AppEngine-addon,下载的Rhino和env.js(这对我需要运行的一堆代码是必需的),但是后来发现我坐在这个文件的位置上,不知道把它们放在哪里。 / p>

如果有人可以告诉我在哪个目录中放置Rhino的哪些文件(我认为它是/ war / WEB-INF / lib /) ),如何添加env.js文件以及如何访问作为应用程序索引的.java文件中的所有这些文件。

解决方案

我并不了解应用程序引擎,但使用Rhino jsc编译扩展Servlet API的脚本文件取得了很好的成功。最终的结果是一个很好的WAR文件,您可以在任何servlet容器中,也可以在App Engine中进行部署。请参阅此处为我的相关博客文章关于这种技术,和这里为一个示例Eclipse项目。

I just needed to create a little interface for a project. So I decided to take given code and to run it on Google AppEngine. My problem is, that I'm experienced in JavaScript and got some basic knowledge of Java, but I got no clue how a Java webapp has to be structured. I started Eclipse and installed the AppEngine-addon, downloaded Rhino and env.js (which is necessary for the bunch of code I need to run) but then found me in the situation of sitting on this files not knowing where to put them.

It would be great if someone could tell me in which directory to put which files for Rhino (I assume it's "/war/WEB-INF/lib/"), how to add the env.js-file and how to access all these files inside the .java-file which is the index of the app.

解决方案

I don't know about app engine in particular, but I have had good success using Rhino jsc to compile script files which extend the Servlet API. The end result is a nice WAR file which you can deploy in any servlet container, and perhaps App Engine as well. See here for my relevant blog post about this technique, and here for a sample Eclipse project.

这篇关于在Java AppEngine中为Java构建一个JS服务器的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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