绕过 DNS 查找并将 URL 提交给代理 [英] Bypass DNS lookup and submit URL to proxy

查看:32
本文介绍了绕过 DNS 查找并将 URL 提交给代理的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个使用 Apache HttpComponents 发出 Web 请求的 Java 应用程序.我已将应用程序配置为使用 JVM 属性使用代理服务器

I have Java application that uses Apache HttpComponents to make web request. I have configured the application to use Proxy Servers using the JVM Property

java -Dhttp.proxyHost=127.0.0.1 -Dhttp.proxyPort=3132

目前我的 Java 应用程序客户端进行 DNS 查找,但它会失败.我希望代理执行 DNS 解析,就像 Web 浏览器在自动代理配置模式(使用 .pac 文件)下所做的那样.

Currently my java application client makes DNS lookup in which it will fail. I want the Proxy to do the DNS resolution just like how web browsers do in automatic Proxy configuration mode (with .pac files).

推荐答案

试试看这里:http://hc.apache.org/httpcomponents-client-ga/httpclient/examples/org/apache/http/examples/client/ClientExecuteProxy.java

似乎您需要使用 setProxy() 而不是全局属性来指定代理.

It seems as though you need to specify a proxy using setProxy() and not global properties.

这篇关于绕过 DNS 查找并将 URL 提交给代理的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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