【问题标题】:Wildfly - Proxy ConfigurationWildfly - 代理配置
【发布时间】:2014-08-28 22:26:46
【问题描述】:

我只需将 Wildfly 8 配置为使用外部 HTTP 代理即可连接到 Internet;你能告诉我在哪里以及如何指定代理地址和端口吗?

我在 Windows 7 上将 Wildfly 作为服务运行。

非常感谢您的帮助!

【问题讨论】:

    标签: jboss wildfly


    【解决方案1】:

    我是通过添加来做到的

    set "JAVA_OPTS=%JAVA_OPTS% -Dhttp.proxyHost=MY_PROXY_HOST -Dhttp.proxyPort=MY_PROXY_PORT -Dhttp.proxyUser=MY_LOGIN -Dhttp.proxyPassword=MY_PASSWORD"
    

    进入文件 bin/standalone.conf.bat(我在独立模式下使用 wildfly) 换句话说,Wildfly 很好地使用了系统 (JVM) 代理设置。

    【讨论】:

      【解决方案2】:

      我们不得不使用 Wildfly 10 完成更多步骤:

      • 覆盖 wildfly 层中的 resteasy-client 模块,使其不会将自己注册为默认的 JAX-rs 客户端构建器。这是必需的,因为 jboss 将在我们企业档案中的模块之前扫描它自己的模块。我们在 module.xml 中添加了一个排除项:

      ```

      <resource-root path="resteasy-client-3.0.19.Final.jar">
          <filter>
            <exclude-set>
                <path name="META-INF/services"/>
            </exclude-set>
          </filter>
       </resource-root>
      

      ```

      • 实现您自己的 ResteasyClientBuilder 以使其使用其 URLConnection 引擎。我们发现默认引擎(apache http commons)不支持我们的 http.proxyHost 系统属性,而 java URLConnection 引擎却支持。

      ```

      public class ProxifiedClientBuilder extends ResteasyClientBuilder {
          public ProxifiedClientBuilder() {
              super();
              URLConnectionEngine urlConnectionEngine = new URLConnectionEngine();
              httpEngine(urlConnectionEngine);
        }
      }
      

      ```

      • 将您的 ClientBuilder 注册为默认提供程序。您可以在 META-INF/services 文件中或使用系统属性执行此操作:

      ```

      <system-properties>
       <property name="javax.ws.rs.client.ClientBuilder" value="be.buyway.util.ProxifiedClientBuilder"/>
      </system-properties>   
      

      ```

      希望这对其他人有所帮助。

      【讨论】:

        猜你喜欢
        • 2018-09-05
        • 1970-01-01
        • 2019-05-15
        • 2017-04-12
        • 1970-01-01
        • 1970-01-01
        • 2014-12-24
        • 2015-08-28
        • 2015-05-05
        相关资源
        最近更新 更多