简体   繁体   English

使用Ruby与jRuby的设计问题

[英]Design question for working with Ruby vs. jRuby

I have a project which will need to have some Java layer. 我有一个项目,它将需要一些Java层。 I am wondering it if is reasonable to try to avoid using jRuby by having the Ruby code call some URL that would invoke a Java controller, which, I guess, would return some JSON. 我想知道通过让Ruby代码调用一些将调用Java控制器的URL来避免使用jRuby是否合理,我想这会返回一些JSON。

Is that a reasonable approach? 那是一个合理的方法吗? Or does it have inherent problems when in comes to architecture and would be a pain in the long run? 还是在架构方面存在固有的问题,从长远来看会很痛苦?

Also, if it is just Ruby, can it still be hosted on Tomcat and be part of my .war file? 另外,如果只是Ruby,它是否仍可以托管在Tomcat上并成为我的.war文件的一部分? And What is that rails part that I will seem to be missing? 那我似乎会丢失的那个滑轨部分是什么?

You could do it either way. 您可以选择任何一种方式。 For me it would be easier not to involve Java in the mix, and keep Ruby talking to JRuby. 对我来说,不让Java参与其中并让Ruby与JRuby对话会更容易。 Also, I'm not sure if you know this or not, but JRuby is also available as a self contained interpreter. 另外,我不确定您是否知道这一点,但是JRuby也可以用作自包含解释器。 Look for the complete jar in the download page . 下载页面中找到完整的jar。

Also, if Java is a must, you could call the Ruby code from Java, via the scripting engines, as presented here 另外,如果必须使用Java,则可以通过脚本引擎从Java调用Ruby代码,如此处所示

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM