当前位置: 首页>>代码示例>>Java>>正文


Java HttpTransportProperties.ProxyProperties方法代码示例

本文整理汇总了Java中org.apache.axis2.transport.http.HttpTransportProperties.ProxyProperties方法的典型用法代码示例。如果您正苦于以下问题:Java HttpTransportProperties.ProxyProperties方法的具体用法?Java HttpTransportProperties.ProxyProperties怎么用?Java HttpTransportProperties.ProxyProperties使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.axis2.transport.http.HttpTransportProperties的用法示例。


在下文中一共展示了HttpTransportProperties.ProxyProperties方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getStubs

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
private Stubs getStubs(String serverUrl) throws Exception
{
	final ConfigurationContext ctx = getConfiguration();

	final HttpTransportProperties.ProxyProperties proxyProperties = new HttpTransportProperties.ProxyProperties();
	final ProxyDetails proxy = configService.getProxyDetails();
	if( proxy.isConfigured() && !proxy.isHostExcepted(new URL(serverUrl).getHost()) )
	{
		proxyProperties.setProxyName(proxy.getHost());
		proxyProperties.setProxyPort(proxy.getPort());
		ctx.setProperty(HTTPConstants.PROXY, proxyProperties);
	}
	ctx.setProperty(HTTPConstants.SO_TIMEOUT, 120000);
	ctx.setProperty(HTTPConstants.CONNECTION_TIMEOUT, 120000);

	return new Stubs(ctx, serverUrl);
}
 
开发者ID:equella,项目名称:Equella,代码行数:18,代码来源:BlackboardConnectorServiceImpl.java

示例2: initMassSpecAPIStub

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
protected MassSpecAPIStub initMassSpecAPIStub() throws Exception {
	MassSpecAPIStub stub = new MassSpecAPIStub();
	stub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, false);
	stub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT, 3 * 60 * 1000);
	stub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, 3 * 60 * 1000);
	stub._getServiceClient().getOptions().setCallTransportCleanup(true);
	//set proxy if available
	if(this.settings.containsKey(VariableNames.CHEMSPIDER_PROXY_SERVER) 
			&& this.settings.containsKey(VariableNames.CHEMSPIDER_PROXY_PORT)
			&& this.settings.get(VariableNames.CHEMSPIDER_PROXY_SERVER) != null 
			&& this.settings.get(VariableNames.CHEMSPIDER_PROXY_PORT) != null) 
	{
		HttpTransportProperties.ProxyProperties pp = new HttpTransportProperties.ProxyProperties();
		try {
			pp.setProxyName((String)this.settings.get(VariableNames.CHEMSPIDER_PROXY_SERVER));
			pp.setProxyPort(Integer.parseInt((String)this.settings.get(VariableNames.CHEMSPIDER_PROXY_PORT)));
		} catch(Exception e) {
			e.printStackTrace();
			this.logger.error("Error: Could not set proxy settings. Please check input.");
			throw new Exception();
		}
		stub._getServiceClient().getOptions().setProperty(HTTPConstants.PROXY,pp);
	}
	
	return stub;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:27,代码来源:OnlineChemSpiderDatabase.java

示例3: initSearchStub

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
protected SearchStub initSearchStub() throws Exception {
	SearchStub searchStub = new SearchStub();
	searchStub._getServiceClient().getOptions().setProperty(HTTPConstants.CHUNKED, false);
	searchStub._getServiceClient().getOptions().setProperty(HTTPConstants.CONNECTION_TIMEOUT, 3 * 60 * 1000);
	searchStub._getServiceClient().getOptions().setProperty(HTTPConstants.SO_TIMEOUT, 3 * 60 * 1000);
	
	//set proxy if available
	if(this.settings.containsKey(VariableNames.CHEMSPIDER_PROXY_SERVER) 
			&& this.settings.containsKey(VariableNames.CHEMSPIDER_PROXY_PORT)
			&& this.settings.get(VariableNames.CHEMSPIDER_PROXY_SERVER) != null 
			&& this.settings.get(VariableNames.CHEMSPIDER_PROXY_PORT) != null) 
	{
		HttpTransportProperties.ProxyProperties pp = new HttpTransportProperties.ProxyProperties();
		try {
			pp.setProxyName((String)this.settings.get(VariableNames.CHEMSPIDER_PROXY_SERVER));
			pp.setProxyPort(Integer.parseInt((String)this.settings.get(VariableNames.CHEMSPIDER_PROXY_PORT)));
		} catch(Exception e) {
			this.logger.error("Error: Could not set proxy settings. Please check input.");
			throw new Exception();
		}
		searchStub._getServiceClient().getOptions().setProperty(HTTPConstants.PROXY,pp);
	}
	
	return searchStub;
}
 
开发者ID:c-ruttkies,项目名称:MetFragRelaunched,代码行数:26,代码来源:OnlineChemSpiderDatabase.java

示例4: updateServiceClientOptions

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
private void updateServiceClientOptions(String trpUrl, String addUrl, String prxUrl) throws AxisFault {
    Options options = new Options();
    options.setTo(new EndpointReference(trpUrl));
    options.setAction("urn:sampleOperation");
    options.setTimeOutInMilliSeconds(10000000);

    // set addressing, transport and proxy url
    if (addUrl != null && !"null".equals(addUrl)) {
        serviceClient.engageModule("addressing");
        options.setTo(new EndpointReference(addUrl));
    }
    if (trpUrl != null && !"null".equals(trpUrl)) {
        options.setProperty(Constants.Configuration.TRANSPORT_URL, trpUrl);
    } else {
        serviceClient.engageModule("addressing");
    }
    serviceClient.engageModule("addressing");
    if (prxUrl != null && !"null".equals(prxUrl)) {
        HttpTransportProperties.ProxyProperties proxyProperties =
            new HttpTransportProperties.ProxyProperties();
        try {
            URL url = new URL(prxUrl);
            proxyProperties.setProxyName(url.getHost());
            proxyProperties.setProxyPort(url.getPort());
            proxyProperties.setUserName("");
            proxyProperties.setPassWord("");
            proxyProperties.setDomain("");
            options.setProperty(HTTPConstants.PROXY, proxyProperties);
        } catch (MalformedURLException e) {
            String msg = "Error while creating proxy URL";
            log.error(msg, e);
            throw new AxisFault(msg, e);
        }
    }
    serviceClient.setOptions(options);
}
 
开发者ID:wso2,项目名称:product-ei,代码行数:37,代码来源:LoadBalanceSessionFullClient.java

示例5: setupStub

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
public static void setupStub(final @NotNull Stub stub, final @NotNull Credentials credentials, final @NotNull URI serverUri) {
  Options options = stub._getServiceClient().getOptions();

  // http params
  options.setProperty(HTTPConstants.CHUNKED, Constants.VALUE_FALSE);
  options.setProperty(HTTPConstants.MC_ACCEPT_GZIP, Boolean.TRUE);
  options.setProperty(HTTPConstants.SO_TIMEOUT, SOCKET_TIMEOUT);
  if (Registry.is("tfs.set.connection.timeout", false)) {
    options.setProperty(HTTPConstants.CONNECTION_TIMEOUT, SOCKET_TIMEOUT);
  }

  // credentials
  if (credentials.getType() == Credentials.Type.Alternate) {
    String basicAuth =
      BasicScheme.authenticate(new UsernamePasswordCredentials(credentials.getUserName(), credentials.getPassword()), "UTF-8");
    Map<String, String> headers = new HashMap<String, String>();
    headers.put(HTTPConstants.HEADER_AUTHORIZATION, basicAuth);
    options.setProperty(HTTPConstants.HTTP_HEADERS, headers);
  }
  else {
    HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
    auth.setUsername(credentials.getUserName());
    auth.setPassword(credentials.getPassword() != null ? credentials.getPassword() : "");
    auth.setDomain(credentials.getDomain());
    auth.setHost(serverUri.getHost());
    options.setProperty(HTTPConstants.AUTHENTICATE, auth);

    HttpMethodParams params = new HttpMethodParams();
    params.setBooleanParameter(USE_NATIVE_CREDENTIALS, credentials.getType() == Credentials.Type.NtlmNative);
    options.setProperty(HTTPConstants.HTTP_METHOD_PARAMS, params);
  }

  // proxy
  final HttpTransportProperties.ProxyProperties proxyProperties;
  final HTTPProxyInfo proxy = HTTPProxyInfo.getCurrent();
  if (proxy.host != null) {
    proxyProperties = new HttpTransportProperties.ProxyProperties();
    Pair<String, String> domainAndUser = getDomainAndUser(proxy.user);
    proxyProperties.setProxyName(proxy.host);
    proxyProperties.setProxyPort(proxy.port);
    proxyProperties.setDomain(domainAndUser.first);
    proxyProperties.setUserName(domainAndUser.second);
    proxyProperties.setPassWord(proxy.password);
  }
  else {
    proxyProperties = null;
  }

  options.setProperty(HTTPConstants.PROXY, proxyProperties);
}
 
开发者ID:Microsoft,项目名称:vso-intellij,代码行数:51,代码来源:WebServiceHelper.java

示例6: testEchoXMLSync

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
public void testEchoXMLSync() throws Exception {

        OMElement payload = TestingUtils.createDummyOMElement();
        /**
         * Proxy setting in runtime
         */
        HttpTransportProperties.ProxyProperties proxyproperties =
                new HttpTransportProperties.ProxyProperties();
        proxyproperties.setProxyName("localhost");
        proxyproperties.setProxyPort(5555);
        proxyproperties.setDomain("anonymous");
        proxyproperties.setPassWord("anonymous");
        proxyproperties.setUserName("anonymous");

        Options options = new Options();
        options.setProperty(HTTPConstants.PROXY, proxyproperties);
        options.setTo(targetEPR);
        options.setTransportInProtocol(Constants.TRANSPORT_HTTP);
        ConfigurationContext configContext =
                ConfigurationContextFactory.createConfigurationContextFromFileSystem(
                        null, null);
        ServiceClient sender = new ServiceClient(configContext, null);
        sender.setOptions(options);

        OMElement result = sender.sendReceive(payload);

        TestingUtils.compareWithCreatedOMElement(result);
    }
 
开发者ID:wso2,项目名称:wso2-axis2,代码行数:29,代码来源:EchoRawRuntimeProxyTest.java

示例7: ProxyUtil

import org.apache.axis2.transport.http.HttpTransportProperties; //导入方法依赖的package包/类
public ProxyUtil(String ip, int porta, String usuario,String senha) {
	   
	proxyProperties = new HttpTransportProperties.ProxyProperties();      
       
      proxyProperties.setProxyName(ip);    
        
      proxyProperties.setProxyPort(porta);    
       
      proxyProperties.setUserName(usuario);    
       
      proxyProperties.setPassWord(senha);    
}
 
开发者ID:Samuel-Oliveira,项目名称:Java_CTe,代码行数:13,代码来源:ProxyUtil.java


注:本文中的org.apache.axis2.transport.http.HttpTransportProperties.ProxyProperties方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。