• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java HttpInvokerClientConfiguration类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



HttpInvokerClientConfiguration类属于org.springframework.remoting.httpinvoker包,在下文中一共展示了HttpInvokerClientConfiguration类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: doExecuteRequest

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
@Override
protected RemoteInvocationResult doExecuteRequest(
        HttpInvokerClientConfiguration config, ByteArrayOutputStream baos)
        throws IOException, ClassNotFoundException {

    PostMethod postMethod = createPostMethod(config);
    try {
        postMethod.setRequestBody(new ByteArrayInputStream(baos.toByteArray()));
        executePostMethod(config, this.httpClient, postMethod);
        return readRemoteInvocationResult(postMethod.getResponseBodyAsStream(), config.getCodebaseUrl());
    }
    finally {
        // need to explicitly release because it might be pooled
        postMethod.releaseConnection();
    }
}
 
开发者ID:xingmima,项目名称:dubbos,代码行数:17,代码来源:CommonsHttpInvokerRequestExecutor.java


示例2: doExecuteRequest

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
@Override
protected RemoteInvocationResult doExecuteRequest(
        HttpInvokerClientConfiguration config, ByteArrayOutputStream baos)
        throws Exception {

    if (this.connectTimeout >= 0) {
        httpClient.setConnectTimeout(this.connectTimeout);
    }

    if (this.readTimeout >= 0) {
        httpClient.setIdleTimeout(this.readTimeout);
    }

    ContentResponse response = httpClient.newRequest(config.getServiceUrl())
            .method(HttpMethod.POST)
            .content(new BytesContentProvider(baos.toByteArray()))
            .send();

    if (response.getStatus() >= 300) {
        throw new IOException(
                "Did not receive successful HTTP response: status code = " + response.getStatus() +
                        ", status message = [" + response.getReason() + "]");
    }

    return readRemoteInvocationResult(new ByteArrayInputStream(response.getContent()), config.getCodebaseUrl());
}
 
开发者ID:thinline72,项目名称:rpc-example,代码行数:27,代码来源:Http2InvokerRequestExecutor.java


示例3: setRequestBody

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
/**
 * Overridden to obtain the Credentials from the CredentialsSource and pass
 * them via HTTP BASIC Authorization.
 */

protected void setRequestBody(final HttpInvokerClientConfiguration config,
    final HttpPost httpPost, final ByteArrayOutputStream baos) throws IOException {
	final UsernamePasswordCredentials credentials = (UsernamePasswordCredentials) this.credentialsSource.getCredentials(this.serviceConfiguration.getEndpointUrl().toExternalForm());

    final String base64 = credentials.getUsername() + ":"
    + credentials.getPassword();
    httpPost.addHeader("Authorization", "Basic " + new String(Base64.encodeBase64(base64.getBytes())));

    if (logger.isDebugEnabled()) {
        logger
            .debug("HttpInvocation now presenting via BASIC authentication CredentialsSource-derived: "
                + credentials.getUsername());
    }
    
    super.setRequestBody(config, httpPost, baos);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:22,代码来源:AuthenticationCommonsHttpInvokerRequestExecutor.java


示例4: doExecuteRequest

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
/**
 * Execute the given request through Commons HttpClient.
 * <p>This method implements the basic processing workflow:
 * The actual work happens in this class's template methods.
 * @see #createPostMethod
 * @see #setRequestBody
 * @see #executePostMethod
 * @see #validateResponse
 * @see #getResponseBody
 */
@Override
protected RemoteInvocationResult doExecuteRequest(
        HttpInvokerClientConfiguration config, ByteArrayOutputStream baos)
        throws IOException, ClassNotFoundException {

    PostMethod postMethod = createPostMethod(config);
    try {
        setRequestBody(config, postMethod, baos);
        executePostMethod(config, getHttpClient(), postMethod);
        validateResponse(config, postMethod);
        InputStream responseBody = getResponseBody(config, postMethod);
        return readRemoteInvocationResult(responseBody, config.getCodebaseUrl());
    }
    finally {
        // Need to explicitly release because it might be pooled.
        postMethod.releaseConnection();
    }
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:29,代码来源:CommonsHttpInvokerRequestExecutor.java


示例5: doExecuteRequest

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
@Override
protected RemoteInvocationResult doExecuteRequest(HttpInvokerClientConfiguration config, ByteArrayOutputStream baos) throws Exception {
    HttpPost postMethod = new HttpPost(config.getServiceUrl());

    ByteArrayEntity entity = new ByteArrayEntity(baos.toByteArray());
    entity.setContentType(getContentType());
    postMethod.setEntity(entity);

    BasicHttpContext context = null;

    if (environment.useSslContext()) {
        context = new BasicHttpContext();
        context.setAttribute(HttpClientContext.USER_TOKEN, goAgentServerHttpClient.principal());
    }

    try (CloseableHttpResponse response = goAgentServerHttpClient.execute(postMethod, context)) {
        validateResponse(response);
        InputStream responseBody = getResponseBody(response);
        return readRemoteInvocationResult(responseBody, config.getCodebaseUrl());
    }
}
 
开发者ID:gocd,项目名称:gocd,代码行数:22,代码来源:GoHttpClientHttpInvokerRequestExecutor.java


示例6: setRequestBody

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
/**
 * Overridden to obtain the Credentials from the CredentialsSource and pass
 * them via HTTP BASIC Authorization.
 */

protected void setRequestBody(final HttpInvokerClientConfiguration config,
    final PostMethod postMethod, final ByteArrayOutputStream baos) throws IOException {
	final UsernamePasswordCredentials credentials = (UsernamePasswordCredentials) this.credentialsSource.getCredentials(this.serviceConfiguration.getEndpointUrl().toExternalForm());

    final String base64 = credentials.getUsername() + ":"
    + credentials.getPassword();
    postMethod.addRequestHeader("Authorization", "Basic " + new String(Base64.encodeBase64(base64.getBytes())));

    if (logger.isDebugEnabled()) {
        logger
            .debug("HttpInvocation now presenting via BASIC authentication CredentialsSource-derived: "
                + credentials.getUsername());
    }
    
    super.setRequestBody(config, postMethod, baos);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:22,代码来源:AuthenticationCommonsHttpInvokerRequestExecutor.java


示例7: setRequestBody

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
/**
 * Signs the outgoing request by generating a digital signature from the bytes in the ByteArrayOutputStream and attaching the
 * signature and our alias to the headers of the PostMethod.
 */
@Override
protected void setRequestBody(HttpInvokerClientConfiguration config, HttpPost httpPost, ByteArrayOutputStream baos) throws IOException {
    if (isSecure()) {
        try {
            signRequest(httpPost, baos);
        } catch (Exception e) {
            throw new RuntimeException("Failed to sign the outgoing message.", e);
        }
    }
    super.setRequestBody(config, httpPost, baos);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:16,代码来源:KSBHttpInvokerRequestExecutor.java


示例8: validateResponse

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
@Override
protected void validateResponse(HttpInvokerClientConfiguration config, HttpResponse response) throws HttpException {
    int statusCode = response.getStatusLine().getStatusCode();

    // HTTP status codes in the 200-299 range indicate success
    if (statusCode >= HttpStatus.SC_MULTIPLE_CHOICES /* 300 */) {
        throw new HttpException(statusCode, "Did not receive successful HTTP response: status code = " + statusCode +
                ", status message = [" + response.getStatusLine().getReasonPhrase() + "]");
    }
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:11,代码来源:KSBHttpInvokerRequestExecutor.java


示例9: createPostMethod

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
/**
 * Create a PostMethod for the given configuration.
 * <p>The default implementation creates a standard PostMethod with
 * "application/x-java-serialized-object" as "Content-Type" header.
 * @param config the HTTP invoker configuration that specifies the
 * target service
 * @return the PostMethod instance
 * @throws IOException if thrown by I/O methods
 */
protected PostMethod createPostMethod(HttpInvokerClientConfiguration config) throws IOException {
    PostMethod postMethod = new PostMethod(config.getServiceUrl());
    LocaleContext locale = LocaleContextHolder.getLocaleContext();
    if (locale != null) {
        postMethod.addRequestHeader(HTTP_HEADER_ACCEPT_LANGUAGE, StringUtils.toLanguageTag(locale.getLocale()));
    }
    if (isAcceptGzipEncoding()) {
        postMethod.addRequestHeader(HTTP_HEADER_ACCEPT_ENCODING, ENCODING_GZIP);
    }
    return postMethod;
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:21,代码来源:CommonsHttpInvokerRequestExecutor.java


示例10: setRequestBody

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
/**
 * Signs the outgoing request by generating a digital signature from the bytes in the ByteArrayOutputStream and attaching the
 * signature and our alias to the headers of the PostMethod.
 */
@Override
protected void setRequestBody(HttpInvokerClientConfiguration config, PostMethod postMethod, ByteArrayOutputStream baos) throws IOException {
	if (isSecure()) {
		try {
			signRequest(postMethod, baos);	
		} catch (Exception e) {
			throw new RuntimeException("Failed to sign the outgoing message.", e);
		}
	}
	super.setRequestBody(config, postMethod, baos);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:16,代码来源:KSBHttpInvokerRequestExecutor.java


示例11: validateResponse

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
@Override
protected void validateResponse(HttpInvokerClientConfiguration config, PostMethod postMethod) throws IOException {
	if (postMethod.getStatusCode() >= 300) {
		throw new HttpException(postMethod.getStatusCode(), "Did not receive successful HTTP response: status code = " + postMethod.getStatusCode() +
				", status message = [" + postMethod.getStatusText() + "]");
	}
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:8,代码来源:KSBHttpInvokerRequestExecutor.java


示例12: doExecuteRequest

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
@Override
protected RemoteInvocationResult doExecuteRequest(HttpInvokerClientConfiguration config, ByteArrayOutputStream baos)
        throws IOException, ClassNotFoundException {

    RemoteInvocationResult result;

    Object context = serverSelector.initContext();
    String url = currentServiceUrl(serverSelector.getUrl(context), config);
    if (url == null)
        throw new IllegalStateException("Server URL list is empty");

    while (true) {
        HttpURLConnection con = openConnection(url);
        try {
            StopWatch sw = new StopWatch();
            prepareConnection(con, baos.size());
            writeRequestBody(config, con, baos);
            sw.start("waiting time");
            validateResponse(config, con);
            CountingInputStream responseInputStream = new CountingInputStream(readResponseBody(config, con));
            sw.stop();

            serverSelector.success(context);

            sw.start("reading time");
            try (ObjectInputStream ois = createObjectInputStream(decorateInputStream(responseInputStream), config.getCodebaseUrl())) {
                result = doReadRemoteInvocationResult(ois);
            }
            sw.stop();
            if (log.isDebugEnabled()) {
                log.debug(String.format("Receiving HTTP invoker response for service at [%s], with size %s, %s", config.getServiceUrl(),
                        responseInputStream.getCount(), printStopWatch(sw)));
            }
            break;
        } catch (IOException e) {
            log.info(String.format("Invocation of %s failed: %s", url, e));

            serverSelector.fail(context);
            url = currentServiceUrl(serverSelector.getUrl(context), config);
            if (url != null) {
                log.info("Trying to invoke the next available URL: " + url);
                continue;
            }
            log.info("No more URL available");
            throw e;
        }
    }
    return result;
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:50,代码来源:ClusteredHttpInvokerRequestExecutor.java


示例13: currentServiceUrl

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
@Nullable
protected String currentServiceUrl(String url, HttpInvokerClientConfiguration config) {
    return url == null ? null :  url + "/" + config.getServiceUrl();
}
 
开发者ID:cuba-platform,项目名称:cuba,代码行数:5,代码来源:ClusteredHttpInvokerRequestExecutor.java


示例14: getResponseBody

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
/**
 * Returns a wrapped InputStream which is responsible for verifying the digital signature on the response after all
 * data has been read.
 */
@Override
protected InputStream getResponseBody(HttpInvokerClientConfiguration config, HttpResponse postMethod) throws IOException {
    if (isSecure()) {
        // extract and validate the headers
        Header digitalSignatureHeader = postMethod.getFirstHeader(KSBConstants.DIGITAL_SIGNATURE_HEADER);
        Header keyStoreAliasHeader = postMethod.getFirstHeader(KSBConstants.KEYSTORE_ALIAS_HEADER);
        Header certificateHeader = postMethod.getFirstHeader(KSBConstants.KEYSTORE_CERTIFICATE_HEADER);

        if (digitalSignatureHeader == null || StringUtils.isEmpty(digitalSignatureHeader.getValue())) {
            throw new RuntimeException("A digital signature header was required on the response but none was found.");
        }

        boolean foundValidKeystoreAlias = (keyStoreAliasHeader != null && StringUtils.isNotBlank(keyStoreAliasHeader.getValue()));
        boolean foundValidCertificate = (certificateHeader != null && StringUtils.isNotBlank(certificateHeader.getValue()));

        if (!foundValidCertificate && !foundValidKeystoreAlias) {
            throw new RuntimeException("Either a key store alias header or a certificate header was required on the response but neither were found.");
        }

        // decode the digital signature from the header into binary
        byte[] digitalSignature = Base64.decodeBase64(digitalSignatureHeader.getValue().getBytes("UTF-8"));
        String errorQualifier = "General Security Error";

        try {
            Signature signature = null;

            if (foundValidCertificate) {
                errorQualifier = "Error with given certificate";
                // get the Signature for verification based on the alias that was sent to us
                byte[] encodedCertificate = Base64.decodeBase64(certificateHeader.getValue().getBytes("UTF-8"));
                CertificateFactory cf = CertificateFactory.getInstance("X.509");
                signature = getDigitalSignatureService().getSignatureForVerification(cf.generateCertificate(new ByteArrayInputStream(encodedCertificate)));
            } else if (foundValidKeystoreAlias) {
                // get the Signature for verification based on the alias that was sent to us
                String keystoreAlias = keyStoreAliasHeader.getValue();
                errorQualifier = "Error with given alias " + keystoreAlias;
                signature = getDigitalSignatureService().getSignatureForVerification(keystoreAlias);
            }

            // wrap the InputStream in an input stream that will verify the signature
            return new SignatureVerifyingInputStream(digitalSignature, signature, super.getResponseBody(config, postMethod));
        } catch (GeneralSecurityException e) {
            throw new RuntimeException("Problem verifying signature: " + errorQualifier,e);
        }
    }

    return super.getResponseBody(config, postMethod);
}
 
开发者ID:kuali,项目名称:kc-rice,代码行数:53,代码来源:KSBHttpInvokerRequestExecutor.java


示例15: getResponseBody

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
/**
 * Returns a wrapped InputStream which is responsible for verifying the digital signature on the response after all
 * data has been read.
 */
@Override
protected InputStream getResponseBody(HttpInvokerClientConfiguration config, PostMethod postMethod) throws IOException {
	if (isSecure()) {
		// extract and validate the headers
		Header digitalSignatureHeader = postMethod.getResponseHeader(KSBConstants.DIGITAL_SIGNATURE_HEADER);
		Header keyStoreAliasHeader = postMethod.getResponseHeader(KSBConstants.KEYSTORE_ALIAS_HEADER);
		Header certificateHeader = postMethod.getResponseHeader(KSBConstants.KEYSTORE_CERTIFICATE_HEADER);
		if (digitalSignatureHeader == null || StringUtils.isEmpty(digitalSignatureHeader.getValue())) {
			throw new RuntimeException("A digital signature header was required on the response but none was found.");
		}
		boolean foundValidKeystoreAlias = (keyStoreAliasHeader != null && StringUtils.isNotBlank(keyStoreAliasHeader.getValue()));
		boolean foundValidCertificate = (certificateHeader != null && StringUtils.isNotBlank(certificateHeader.getValue()));
		if (!foundValidCertificate && !foundValidKeystoreAlias) {
               throw new RuntimeException("Either a key store alias header or a certificate header was required on the response but neither were found.");
		}
		// decode the digital signature from the header into binary
		byte[] digitalSignature = Base64.decodeBase64(digitalSignatureHeader.getValue().getBytes("UTF-8"));
		String errorQualifier = "General Security Error";
		try {
		    Signature signature = null;
		    if (foundValidCertificate) {
                   errorQualifier = "Error with given certificate";
                // get the Signature for verification based on the alias that was sent to us
		        byte[] encodedCertificate = Base64.decodeBase64(certificateHeader.getValue().getBytes("UTF-8"));
	            CertificateFactory cf = CertificateFactory.getInstance("X.509");
                signature = getDigitalSignatureService().getSignatureForVerification(cf.generateCertificate(new ByteArrayInputStream(encodedCertificate)));
		    } else if (foundValidKeystoreAlias) {
                // get the Signature for verification based on the alias that was sent to us
		        String keystoreAlias = keyStoreAliasHeader.getValue();
		        errorQualifier = "Error with given alias " + keystoreAlias;
                signature = getDigitalSignatureService().getSignatureForVerification(keystoreAlias);
		    }
		    
			// wrap the InputStream in an input stream that will verify the signature
			return new SignatureVerifyingInputStream(digitalSignature, signature, super.getResponseBody(config, postMethod));
		} catch (GeneralSecurityException e) {
			throw new RuntimeException("Problem verifying signature: " + errorQualifier,e);
		}
	}
	return super.getResponseBody(config, postMethod);
}
 
开发者ID:aapotts,项目名称:kuali_rice,代码行数:46,代码来源:KSBHttpInvokerRequestExecutor.java


示例16: setRequestBody

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
/**
 * Set the given serialized remote invocation as request body.
 * <p>The default implementation simply sets the serialized invocation as the
 * PostMethod's request body. This can be overridden, for example, to write a
 * specific encoding and to potentially set appropriate HTTP request headers.
 * @param config the HTTP invoker configuration that specifies the target service
 * @param postMethod the PostMethod to set the request body on
 * @param baos the ByteArrayOutputStream that contains the serialized
 * RemoteInvocation object
 * @throws IOException if thrown by I/O methods
 * @see org.apache.commons.httpclient.methods.PostMethod#setRequestBody(java.io.InputStream)
 * @see org.apache.commons.httpclient.methods.PostMethod#setRequestEntity
 * @see org.apache.commons.httpclient.methods.InputStreamRequestEntity
 */
protected void setRequestBody(
        HttpInvokerClientConfiguration config, PostMethod postMethod, ByteArrayOutputStream baos)
        throws IOException {

    postMethod.setRequestEntity(new ByteArrayRequestEntity(baos.toByteArray(), getContentType()));
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:21,代码来源:CommonsHttpInvokerRequestExecutor.java


示例17: executePostMethod

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
/**
 * Execute the given PostMethod instance.
 * @param config the HTTP invoker configuration that specifies the target service
 * @param httpClient the HttpClient to execute on
 * @param postMethod the PostMethod to execute
 * @throws IOException if thrown by I/O methods
 * @see org.apache.commons.httpclient.HttpClient#executeMethod(org.apache.commons.httpclient.HttpMethod)
 */
protected void executePostMethod(
        HttpInvokerClientConfiguration config, HttpClient httpClient, PostMethod postMethod)
        throws IOException {

    httpClient.executeMethod(postMethod);
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:15,代码来源:CommonsHttpInvokerRequestExecutor.java


示例18: validateResponse

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
/**
 * Validate the given response as contained in the PostMethod object,
 * throwing an exception if it does not correspond to a successful HTTP response.
 * <p>Default implementation rejects any HTTP status code beyond 2xx, to avoid
 * parsing the response body and trying to deserialize from a corrupted stream.
 * @param config the HTTP invoker configuration that specifies the target service
 * @param postMethod the executed PostMethod to validate
 * @throws IOException if validation failed
 * @see org.apache.commons.httpclient.methods.PostMethod#getStatusCode()
 * @see org.apache.commons.httpclient.HttpException
 */
protected void validateResponse(HttpInvokerClientConfiguration config, PostMethod postMethod)
        throws IOException {

    if (postMethod.getStatusCode() >= 300) {
        throw new HttpException(
                "Did not receive successful HTTP response: status code = " + postMethod.getStatusCode() +
                ", status message = [" + postMethod.getStatusText() + "]");
    }
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:21,代码来源:CommonsHttpInvokerRequestExecutor.java


示例19: getResponseBody

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
/**
 * Extract the response body from the given executed remote invocation request.
 * <p>The default implementation simply fetches the PostMethod's response body stream.
 * If the response is recognized as GZIP response, the InputStream will get wrapped
 * in a GZIPInputStream.
 * @param config the HTTP invoker configuration that specifies the target service
 * @param postMethod the PostMethod to read the response body from
 * @return an InputStream for the response body
 * @throws IOException if thrown by I/O methods
 * @see #isGzipResponse
 * @see java.util.zip.GZIPInputStream
 * @see org.apache.commons.httpclient.methods.PostMethod#getResponseBodyAsStream()
 * @see org.apache.commons.httpclient.methods.PostMethod#getResponseHeader(String)
 */
protected InputStream getResponseBody(HttpInvokerClientConfiguration config, PostMethod postMethod)
        throws IOException {

    if (isGzipResponse(postMethod)) {
        return new GZIPInputStream(postMethod.getResponseBodyAsStream());
    }
    else {
        return postMethod.getResponseBodyAsStream();
    }
}
 
开发者ID:payneteasy,项目名称:superfly,代码行数:25,代码来源:CommonsHttpInvokerRequestExecutor.java


示例20: createPostMethod

import org.springframework.remoting.httpinvoker.HttpInvokerClientConfiguration; //导入依赖的package包/类
/**
 * Create a PostMethod for the given configuration.
 * @param config the HTTP invoker configuration that specifies the
 * target service
 * @return the PostMethod instance
 * @throws IOException if thrown by I/O methods
 */
protected PostMethod createPostMethod(HttpInvokerClientConfiguration config) throws IOException {
    PostMethod postMethod = new PostMethod(config.getServiceUrl());
    postMethod.setRequestHeader(HTTP_HEADER_CONTENT_TYPE, CONTENT_TYPE_SERIALIZED_OBJECT);
    return postMethod;
}
 
开发者ID:xingmima,项目名称:dubbos,代码行数:13,代码来源:CommonsHttpInvokerRequestExecutor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java Component类代码示例发布时间:2022-05-23
下一篇:
Java EdgeNameProvider类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap