java中的脚本编写 - 来自Java 1.5中服务器端类文件的javascript [英] scripting in java - javascript from a server-side class file in Java 1.5

查看:116
本文介绍了java中的脚本编写 - 来自Java 1.5中服务器端类文件的javascript的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有三种类型的获取请求,这些请求通过移动设备传送到Web应用程序上的文件。由于移动设备不提供cookie,因此日志文件命中只有

I have three types of get requests that are delivered to a class file on web application from a mobile device. Because the mobile device provides no cookies, the log file hit only has

in.ter.nal.ip   ser.ver.i.p:port    2009-06-05  09:14:44    GET /applicationname/mobiledevicexml    reqtype=login&userid=xx###  200 87  -   MercuryMobile/1.0 CFNetwork/342.1 Darwin/9.4.1  cookieArrayLength=0;

如果我可以在我的类文件中实例化javascript,并从urchinTracker()生成一个javascript函数调用在类文件里面,我可以替换那个无用的cookieArrayLength = 0;通过一些有用的数据,urchin可以从日志文件中读取到分析报告中。
我们一直在用Rhino 查看Java中的脚本; Safari Bookshelf有:

If I can instantiate javascript in my class file, and generate a javascript function call to urchinTracker() from inside the class file, I can replace that useless cookieArrayLength=0; with some useful data urchin can read from the log file into analytics reports. We have been looking at scripting in Java with Rhino; Safari Bookshelf has:


JavaTM中的脚本:语言,
框架和模式

Scripting in JavaTM: Languages, Frameworks, and Patterns

帮助我们立即演示我们可以在类文件中运行javascript - 这在Java 6上开箱即用。

which helped us immediately demo that we can run javascript in class files --this works out-of-the-box on Java 6.

任何人都知道在Java 1.5或1.4上使用Rhino编写脚本的资源吗?

Anyone know any resources for scripting with Rhino on Java 1.5 or 1.4?

或者,任何有关从java 1.5运行javascript的建议都会受到赞赏。

Alternately, any suggestions for running javascript from java 1.5 would be appreciated.

推荐答案

[我在答案中发帖,因为我没有足够的分数来发表对问题本身的评论。]

[I'm posting in an answer, because I don't have enough points to post a comment on the question itself.]

你确定吗urchinTracker()函数将在Web浏览器之外运行?如果函数依赖于各种浏览器对象(如文档对象模型(DOM)或XmlHttpRequest),则运行Rhino JavaScript解释器(这并不太难)是不够的。

Are you sure that the urchinTracker() function will operate outside of a web browser? Running the Rhino JavaScript interpreter (which isn't too difficult) won't be enough if the function relies on various browser objects, like the Document Object Model (DOM) or XmlHttpRequest.

我建议您至少扫描urchinTracker()函数的内部,看看是否是这种情况。

I suggest that you at least scan the internals of the urchinTracker() function to see if this is the case.

这篇关于java中的脚本编写 - 来自Java 1.5中服务器端类文件的javascript的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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