使JRuby继承Java代理设置 [英] Make JRuby inherit Java proxy settings

查看:112
本文介绍了使JRuby继承Java代理设置的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我想从JRuby上运行的Rails代码发出HTTP请求。

I would like to make HTTP requests from Rails code running on top of JRuby.

如何让它重新使用http.proxyHost,http.proxyPort和http.nonProxyHosts设置,给JVM运行它?

How can I make it to re-use http.proxyHost, http.proxyPort and http.nonProxyHosts settings, given to JVM running it ?

推荐答案

要通过JRuby传递JVM标志,请使用 -J ... 。在这种情况下:

To pass JVM flags through JRuby, use -J.... In this case:

jruby -J-Dhttp.proxyHost=foo -J-Dhttp.proxyPort=1234 -J-Dhttp.nonProxyHosts="*.bar.com" ...

这在JRuby的帮助文本中有解释。

This is explained in JRuby's help text.

-J[java option] pass an option on to the JVM (e.g. -J-Xmx512m)
                use --properties to list JRuby properties
                run 'java -help' for a list of other Java options

这篇关于使JRuby继承Java代理设置的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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