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


Java HttpTransportProperties类代码示例

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


HttpTransportProperties类属于org.apache.axis2.transport.http包,在下文中一共展示了HttpTransportProperties类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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: WSUserStoreManager

import org.apache.axis2.transport.http.HttpTransportProperties; //导入依赖的package包/类
public WSUserStoreManager(String userName, String password, String serverUrl,
                          ConfigurationContext configCtxt) throws UserStoreException {
    try {

        if (serverUrl != null && !serverUrl.endsWith("/")) {
            serverUrl += "/";
        }

        stub = new RemoteUserStoreManagerServiceStub(configCtxt, serverUrl
                + SERVICE_NAME);

        HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
        authenticator.setUsername(userName);
        authenticator.setPassword(password);
        authenticator.setPreemptiveAuthentication(true);

        ServiceClient client = stub._getServiceClient();
        Options option = client.getOptions();
        option.setManageSession(true);
        option.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE,
                authenticator);
    } catch (AxisFault e) {
        handleException(e.getMessage(), e);
    }
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:26,代码来源:WSUserStoreManager.java

示例5: WorkflowDeployerClient

import org.apache.axis2.transport.http.HttpTransportProperties; //导入依赖的package包/类
public WorkflowDeployerClient(String bpsURL, String username, char[] password) throws AxisFault {
    bpelUploaderStub = new BPELUploaderStub(bpsURL + BPEL_UPLOADER_SERVICE);
    ServiceClient serviceClient = bpelUploaderStub._getServiceClient();
    Options options = serviceClient.getOptions();
    HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
    auth.setUsername(username);
    auth.setPassword(new String(password));
    auth.setPreemptiveAuthentication(true);
    List<String> authSchemes = new ArrayList<>();
    authSchemes.add(HttpTransportProperties.Authenticator.BASIC);
    auth.setAuthSchemes(authSchemes);
    options.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
    serviceClient.setOptions(options);

    humanTaskUploaderStub = new HumanTaskUploaderStub(bpsURL + HT_UPLOADER_SERVICE);
    ServiceClient htServiceClient = humanTaskUploaderStub._getServiceClient();
    Options htOptions = htServiceClient.getOptions();
    htOptions.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
    htServiceClient.setOptions(htOptions);
}
 
开发者ID:wso2-attic,项目名称:carbon-identity,代码行数:21,代码来源:WorkflowDeployerClient.java

示例6: prepareStubInternal

import org.apache.axis2.transport.http.HttpTransportProperties; //导入依赖的package包/类
private void prepareStubInternal(Stub stub)
{
    Options options = stub._getServiceClient().getOptions();
    options.setExceptionToBeThrownOnSOAPFault(true);
    options.setTimeOutInMilliSeconds(timeout);
    options.setManageSession(true);
    if (sessionCookie != null)
    {
        options.setProperty(HTTPConstants.COOKIE_STRING, sessionCookie);
    }
    options.setProperty(HTTPConstants.REUSE_HTTP_CLIENT, Boolean.TRUE);

    if (httpUsername != null && httpUsername.length() >= 0 && httpPassword != null)
    {
        HttpTransportProperties.Authenticator authenticator =
            new HttpTransportProperties.Authenticator();
        authenticator.setUsername(httpUsername);
        authenticator.setPassword(httpPassword);
        options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);
    }
}
 
开发者ID:hschott,项目名称:cargo-wso2-container,代码行数:22,代码来源:AbstractWSO2Carbon4xRemoteService.java

示例7: sendForcefulShutDownRequest

import org.apache.axis2.transport.http.HttpTransportProperties; //导入依赖的package包/类
public static void sendForcefulShutDownRequest(String backendURL, String userName,
                                               String password) throws AutomationFrameworkException {
    try {
        ServiceClient serviceClient = new ServiceClient();
        Options opts = new Options();
        opts.setManageSession(true);
        opts.setTo(new EndpointReference(backendURL + "ServerAdmin"));
        opts.setAction("urn:shutdown");
        HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
        auth.setUsername(userName);
        auth.setPassword(password);
        opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);

        serviceClient.setOptions(opts);
        serviceClient.sendReceive(ClientConnectionUtil.createPayLoadShutDownServerForcefully());

    } catch (AxisFault e) {
        log.error("Unable to shutdown carbon server forcefully..", e);
        throw new AutomationFrameworkException("Unable to shutdown carbon server forcefully..", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:22,代码来源:ClientConnectionUtil.java

示例8: sendGraceFullRestartRequest

import org.apache.axis2.transport.http.HttpTransportProperties; //导入依赖的package包/类
public static void sendGraceFullRestartRequest(String backendURL, String userName,
                                               String password) throws AutomationFrameworkException {
    try {
        ServiceClient serviceClient = new ServiceClient();
        Options opts = new Options();
        opts.setManageSession(true);
        opts.setTo(new EndpointReference(backendURL + "/ServerAdmin"));
        opts.setAction("urn:restart");
        HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
        auth.setUsername(userName);
        auth.setPassword(password);
        opts.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);

        serviceClient.setOptions(opts);
        serviceClient.sendReceive(ClientConnectionUtil.createPayLoadRestartServerGracefully());

    } catch (AxisFault e) {
        log.error("Unable to restart carbon server gracefully..", e);
        throw new AutomationFrameworkException("Unable to restart carbon server gracefully..", e);
    }
}
 
开发者ID:wso2,项目名称:carbon-platform-integration,代码行数:22,代码来源:ClientConnectionUtil.java

示例9: initializeRestClient

import org.apache.axis2.transport.http.HttpTransportProperties; //导入依赖的package包/类
/**
 * Initialize the rest client and set username and password of the user
 *
 * @param serverURL server URL
 * @param username  username
 * @param password  password
 * @throws AxisFault
 */
private void initializeRestClient(String serverURL, String username, String password) throws AxisFault {
    HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
    authenticator.setUsername(username);
    authenticator.setPassword(password);
    authenticator.setPreemptiveAuthentication(true);

    ConfigurationContext configurationContext;
    try {
        configurationContext = ConfigurationContextFactory.createDefaultConfigurationContext();
    } catch (Exception e) {
        String msg = "Backend error occurred. Please contact the service admins!";
        throw new AxisFault(msg, e);
    }
    HashMap<String, TransportOutDescription> transportsOut = configurationContext
            .getAxisConfiguration().getTransportsOut();
    for (TransportOutDescription transportOutDescription : transportsOut.values()) {
        transportOutDescription.getSender().init(configurationContext, transportOutDescription);
    }

    this.restClient = new RestClient(serverURL, username, password);
}
 
开发者ID:apache,项目名称:stratos,代码行数:30,代码来源:RestCommandLineService.java

示例10: Oauth2TokenValidator

import org.apache.axis2.transport.http.HttpTransportProperties; //导入依赖的package包/类
public Oauth2TokenValidator(String identityURL, String userName, String password)
        throws MalformedURLException, AxisFault {

    this.identityURL = identityURL;
    String adminUserName = userName;
    String adminPassword = password;

    //create service client with given url
    String targetEndpointUrl = identityURL + "/services/OAuth2TokenValidationService.OAuth2TokenValidationServiceHttpsSoap12Endpoint/";
    OAuth2TokenValidationServiceStub stub = new OAuth2TokenValidationServiceStub(targetEndpointUrl);
    oAuth2TokenValidationService = stub;

    ServiceClient client = stub._getServiceClient();
    HttpTransportProperties.Authenticator authenticator = new HttpTransportProperties.Authenticator();
    authenticator.setUsername(adminUserName);
    authenticator.setPassword(adminPassword);
    authenticator.setPreemptiveAuthentication(true);
    Options options = client.getOptions();
    options.setProperty(HTTPConstants.AUTHENTICATE, authenticator);

    client.setOptions(options);
}
 
开发者ID:GruppoFilippetti,项目名称:vertx-mqtt-broker,代码行数:23,代码来源:Oauth2TokenValidator.java

示例11: setBasicAuth

import org.apache.axis2.transport.http.HttpTransportProperties; //导入依赖的package包/类
/**
 * Ugly hack which only works due to the fact that the session server
 * doesn't verifiy the user's organization role
 * 
 * @param stub
 */
private void setBasicAuth(Stub stub) {
    HttpTransportProperties.Authenticator basicAuth = new HttpTransportProperties.Authenticator();
    basicAuth.setUsername(userKey);
    basicAuth.setPassword(password);
    basicAuth.setPreemptiveAuthentication(true);
    final Options clientOptions = stub._getServiceClient().getOptions();
    clientOptions.setProperty(HTTPConstants.AUTHENTICATE, basicAuth);
}
 
开发者ID:servicecatalog,项目名称:oscm,代码行数:15,代码来源:BssClient.java

示例12: authenticate

import org.apache.axis2.transport.http.HttpTransportProperties; //导入依赖的package包/类
/**
 * Authenticates the service client from the username and password configured in RecoveryEndpointConfig.properties file
 *
 * @param client service client
 */
public void authenticate(ServiceClient client) {
    Options option = client.getOptions();
    HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
    auth.setUsername(accessUsername);
    auth.setPassword(accessPassword);
    auth.setPreemptiveAuthentication(true);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
    option.setManageSession(true);
}
 
开发者ID:wso2,项目名称:carbon-identity-framework,代码行数:15,代码来源:IdentityManagementServiceUtil.java

示例13: 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

示例14: authenticate

import org.apache.axis2.transport.http.HttpTransportProperties; //导入依赖的package包/类
public void authenticate(ServiceClient client) throws ApplicationManagementException {
    Options option = client.getOptions();
    HttpTransportProperties.Authenticator auth = new HttpTransportProperties.Authenticator();
    auth.setUsername(username);
    auth.setPassword(password);
    auth.setPreemptiveAuthentication(true);
    option.setProperty(org.apache.axis2.transport.http.HTTPConstants.AUTHENTICATE, auth);
    option.setManageSession(true);
}
 
开发者ID:wso2,项目名称:carbon-device-mgt,代码行数:10,代码来源:ServiceAuthenticator.java

示例15: 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


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