2012-07-18 25 views
3

是否可以更改jax-ws中的http处理程序? 例如:从weblogic.net.http.HttpURLConnection到sun.net.www.protocol.http.HttpURLConnection。在运行jvm中更改HttpURLConnection

+1

看看http://jersey.java.net/nonav/documentation/latest/client-api.html ,它支持HttpURLConnection和Apache HTTPClient。您可以使用http://jersey.java.net/nonav/documentation/latest/client-api.html。你也不应该使用package sun的类,因为它们可以在任何时候被删除。 – Andy 2012-07-18 21:28:39

回答

6

你可以尝试在weblogic中使用-DUseSunHttpHandler=true

使用WLST(非群集)

在managered服务器ENV脚本中添加JVM参数下$WLS_DOMAIN_HOME/bin/setDomainEnv.sh

JAVA_OPTIONS=-DUseSunHttpHandler=true 
    export JAVA_OPTIONS 

使用WebLogic控制台(群集)管理WebLogic

管理WebLogic

-DUseSunHttpHandler=true添加到a或b中的参数中。

  • 在管理控制台导航到Home>Summary of Servers><managed server name>>Configuration>Server Start标签。

  • 在config文件中$WLS_DOMAIN_HOME/config/config.xml与XML的路径server>server-start>arguments

+0

你救了我一天的男人。谢谢 – 2016-06-16 07:29:03

1

实施您自己的URLConnectionFactory,它可以恢复所需的HttpURLConnection并在构建客户端时进行设置。

URLConnectionClientHandler urlConnectionClientHandler = new URLConnectionClientHandler(
    new MyURLConnectionFactory()); 
Client client = new Client(urlConnectionClientHandler);