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

Java HttpResponseFactory类代码示例

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

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



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

示例1: HttpTestServer

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
/**
 * Creates a new test server.
 *
 * @param proc      the HTTP processors to be used by the server, or
 *                  <code>null</code> to use a
 *                  {@link #newProcessor default} processor
 * @param reuseStrat the connection reuse strategy to be used by the
 *                  server, or <code>null</code> to use
 *                  {@link #newConnectionReuseStrategy() default}
 *                  strategy.
 * @param params    the parameters to be used by the server, or
 *                  <code>null</code> to use
 *                  {@link #newDefaultParams default} parameters
 * @param sslcontext optional SSL context if the server is to leverage
 *                   SSL/TLS transport security
 */
public HttpTestServer(
        final BasicHttpProcessor proc,
        final ConnectionReuseStrategy reuseStrat,
        final HttpResponseFactory responseFactory,
        final HttpExpectationVerifier expectationVerifier,
        final HttpParams params,
        final SSLContext sslcontext) {
    this.handlerRegistry = new HttpRequestHandlerRegistry();
    this.workers = Collections.synchronizedSet(new HashSet<Worker>());
    this.httpservice = new HttpService(
        proc != null ? proc : newProcessor(),
        reuseStrat != null ? reuseStrat : newConnectionReuseStrategy(),
        responseFactory != null ? responseFactory : newHttpResponseFactory(),
        handlerRegistry,
        expectationVerifier,
        params != null ? params : newDefaultParams());
    this.sslcontext = sslcontext;
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:35,代码来源:HttpTestServer.java


示例2: handleResponseTest

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
/**
 * 
 */
@Test
public void handleResponseTest() throws Exception {
    ResponseHandler handler = new ResponseHandler();
    HttpResponseFactory factory = new DefaultHttpResponseFactory();
    HttpResponse responseSent = factory.newHttpResponse(new BasicStatusLine(HttpVersion.HTTP_1_1, HttpStatus.SC_OK,
        "reason"), null);
    HttpResponse response = handler.handleResponse(responseSent);
    Assert.assertEquals(handler.getStatus(), HttpStatus.SC_OK);
    Assert.assertFalse(handler.hasContent());
    // response with content.
    BasicHttpEntity entity = new BasicHttpEntity();
    InputStream inputStream = new ByteArrayInputStream("new content".getBytes());
    entity.setContent(inputStream);
    entity.setContentLength("new content".length()); // sets the length
    response.setEntity(entity);
    response = handler.handleResponse(responseSent);
    Assert.assertEquals("new content", handler.getResponseContent());
}
 
开发者ID:conwetlab,项目名称:fiware-rss,代码行数:22,代码来源:ResponseHandlerTest.java


示例3: createResponseParser

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
@Override
protected HttpMessageParser<HttpResponse> createResponseParser(
        final SessionInputBuffer buffer,
        final HttpResponseFactory responseFactory,
        final HttpParams params) {
    // override in derived class to specify a line parser
    return new DefaultHttpResponseParser
        (buffer, null, responseFactory, params);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:10,代码来源:DefaultClientConnection.java


示例4: DefaultResponseParser

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
public DefaultResponseParser(
        final SessionInputBuffer buffer,
        final LineParser parser,
        final HttpResponseFactory responseFactory,
        final HttpParams params) {
    super(buffer, parser, params);
    if (responseFactory == null) {
        throw new IllegalArgumentException
            ("Response factory may not be null");
    }
    this.responseFactory = responseFactory;
    this.lineBuf = new CharArrayBuffer(128);
    this.maxGarbageLines = getMaxGarbageLines(params);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:15,代码来源:DefaultResponseParser.java


示例5: DefaultHttpResponseParser

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
public DefaultHttpResponseParser(
        final SessionInputBuffer buffer,
        final LineParser parser,
        final HttpResponseFactory responseFactory,
        final HttpParams params) {
    super(buffer, parser, params);
    if (responseFactory == null) {
        throw new IllegalArgumentException
            ("Response factory may not be null");
    }
    this.responseFactory = responseFactory;
    this.lineBuf = new CharArrayBuffer(128);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:14,代码来源:DefaultHttpResponseParser.java


示例6: HttpService

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
/**
 * Create a new HTTP service.
 *
 * @param processor            the processor to use on requests and responses
 * @param connStrategy         the connection reuse strategy
 * @param responseFactory      the response factory
 * @param handlerResolver      the handler resolver. May be null.
 * @param expectationVerifier  the expectation verifier. May be null.
 * @param params               the HTTP parameters
 *
 * @since 4.1
 */
public HttpService(
        final HttpProcessor processor,
        final ConnectionReuseStrategy connStrategy,
        final HttpResponseFactory responseFactory,
        final HttpRequestHandlerResolver handlerResolver,
        final HttpExpectationVerifier expectationVerifier,
        final HttpParams params) {
    super();
    if (processor == null) {
        throw new IllegalArgumentException("HTTP processor may not be null");
    }
    if (connStrategy == null) {
        throw new IllegalArgumentException("Connection reuse strategy may not be null");
    }
    if (responseFactory == null) {
        throw new IllegalArgumentException("Response factory may not be null");
    }
    if (params == null) {
        throw new IllegalArgumentException("HTTP parameters may not be null");
    }
    this.processor = processor;
    this.connStrategy = connStrategy;
    this.responseFactory = responseFactory;
    this.handlerResolver = handlerResolver;
    this.expectationVerifier = expectationVerifier;
    this.params = params;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:40,代码来源:HttpService.java


示例7: setResponseFactory

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
/**
 * @deprecated (4.1) set {@link HttpResponseFactory} using constructor
 */
@Deprecated
public void setResponseFactory(final HttpResponseFactory responseFactory) {
    if (responseFactory == null) {
        throw new IllegalArgumentException("Response factory may not be null");
    }
    this.responseFactory = responseFactory;
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:11,代码来源:HttpService.java


示例8: HttpResponseParser

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
/**
 * Creates an instance of this class.
 *
 * @param buffer the session input buffer.
 * @param parser the line parser.
 * @param responseFactory the factory to use to create
 *    {@link HttpResponse}s.
 * @param params HTTP parameters.
 */
public HttpResponseParser(
        final SessionInputBuffer buffer,
        final LineParser parser,
        final HttpResponseFactory responseFactory,
        final HttpParams params) {
    super(buffer, parser, params);
    if (responseFactory == null) {
        throw new IllegalArgumentException("Response factory may not be null");
    }
    this.responseFactory = responseFactory;
    this.lineBuf = new CharArrayBuffer(128);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:HttpResponseParser.java


示例9: DefaultHttpResponseParser

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
/**
 * Creates an instance of this class.
 *
 * @param buffer the session input buffer.
 * @param parser the line parser.
 * @param responseFactory the factory to use to create
 *    {@link HttpResponse}s.
 * @param params HTTP parameters.
 */
public DefaultHttpResponseParser(
        final SessionInputBuffer buffer,
        final LineParser parser,
        final HttpResponseFactory responseFactory,
        final HttpParams params) {
    super(buffer, parser, params);
    if (responseFactory == null) {
        throw new IllegalArgumentException("Response factory may not be null");
    }
    this.responseFactory = responseFactory;
    this.lineBuf = new CharArrayBuffer(128);
}
 
开发者ID:lamsfoundation,项目名称:lams,代码行数:22,代码来源:DefaultHttpResponseParser.java


示例10: YaaccHttpService

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
public YaaccHttpService(HttpProcessor proc,
                        ConnectionReuseStrategy connStrategy,
                        HttpResponseFactory responseFactory, Context context) {
    super(proc, connStrategy, responseFactory);
    this.context = context;

}
 
开发者ID:theopenbit,项目名称:yaacc-code,代码行数:8,代码来源:YaaccHttpService.java


示例11: createResponseParser

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
@Override
protected HttpMessageParser<HttpResponse> createResponseParser(final SessionInputBuffer buffer,
    final HttpResponseFactory responseFactory, final HttpParams params)
{
    // override in derived class to specify a line parser
    return new DefaultHttpResponseParser(buffer, null, responseFactory, params);
}
 
开发者ID:Huawei,项目名称:eSDK_EC_SDK_Java,代码行数:8,代码来源:DefaultClientConnection.java


示例12: ListeningHandler

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
public ListeningHandler(
        final HttpHost targetHost,
        final ConnectingIOReactor connectingIOReactor,
        final HttpProcessor httpProcessor, 
        final HttpResponseFactory responseFactory,
        final ConnectionReuseStrategy connStrategy,
        final HttpParams params) {
    super();
    this.targetHost = targetHost;
    this.connectingIOReactor = connectingIOReactor;
    this.httpProcessor = httpProcessor;
    this.connStrategy = connStrategy;
    this.responseFactory = responseFactory;
    this.params = params;
}
 
开发者ID:mleoking,项目名称:PhET,代码行数:16,代码来源:NHttpReverseProxy.java


示例13: DefaultHttpResponseParserFactory

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
public DefaultHttpResponseParserFactory(
        final LineParser lineParser,
        final HttpResponseFactory responseFactory) {
    super();
    this.lineParser = lineParser != null ? lineParser : BasicLineParserHC4.INSTANCE;
    this.responseFactory = responseFactory != null ? responseFactory
            : DefaultHttpResponseFactoryHC4.INSTANCE;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:9,代码来源:DefaultHttpResponseParserFactory.java


示例14: DefaultHttpResponseParser

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
/**
 * @deprecated (4.3) use {@link DefaultHttpResponseParser#DefaultHttpResponseParser(
 *   SessionInputBuffer, LineParser, HttpResponseFactory, MessageConstraints)}
 */
@Deprecated
public DefaultHttpResponseParser(
        final SessionInputBuffer buffer,
        final LineParser parser,
        final HttpResponseFactory responseFactory,
        final HttpParams params) {
    super(buffer, parser, params);
    Args.notNull(responseFactory, "Response factory");
    this.responseFactory = responseFactory;
    this.lineBuf = new CharArrayBuffer(128);
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:16,代码来源:DefaultHttpResponseParser.java


示例15: DefaultHttpResponseParserFactory

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
public DefaultHttpResponseParserFactory(final LineParser lineParser,
        final HttpResponseFactory responseFactory) {
    super();
    this.lineParser = lineParser != null ? lineParser : BasicLineParserHC4.INSTANCE;
    this.responseFactory = responseFactory != null ? responseFactory
            : DefaultHttpResponseFactoryHC4.INSTANCE;
}
 
开发者ID:xxonehjh,项目名称:remote-files-sync,代码行数:8,代码来源:DefaultHttpResponseParserFactory.java


示例16: sendAndReturn

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
@Override
protected String sendAndReturn(HttpUriRequest request) throws IOException{
  HttpResponseFactory factory = new DefaultHttpResponseFactory();

  HttpResponse response = factory.newHttpResponse(
      new BasicStatusLine(HttpVersion.HTTP_1_1, this.status, null),null);

  StringBuilder sb = new StringBuilder();
  sb.append(String.format("%s = %s;", "METHOD", request.getMethod()));
  sb.append(String.format("%s = %s;", "URI", request.getURI()));

  if (request.getAllHeaders().length > 0){
    sb.append("HEADER_EXISTS");
  }

  for (Header h : request.getAllHeaders()){
    sb.append(String.format("%s = %s;", h.getName(), h.getValue()));
  }

  if (request instanceof HttpEntityEnclosingRequestBase){
    HttpEntity entity = ((HttpEntityEnclosingRequestBase)request).getEntity();
    if (entity != null){
      sb.append("BODY_EXISTS");
      sb.append(String.format("%s = %s;", "BODY", EntityUtils.toString(entity)));
    }
  }

  response.setEntity(new StringEntity(sb.toString()));
  return parseResponse(response);
}
 
开发者ID:JasonBian,项目名称:azkaban,代码行数:31,代码来源:RestfulApiClientTest.java


示例17: DefaultResponseParser

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
public DefaultResponseParser(
        final SessionInputBuffer buffer,
        final LineParser parser,
        final HttpResponseFactory responseFactory,
        final HttpParams params) {
    super(buffer, parser, params);
    Args.notNull(responseFactory, "Response factory");
    this.responseFactory = responseFactory;
    this.lineBuf = new CharArrayBuffer(128);
    this.maxGarbageLines = getMaxGarbageLines(params);
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:12,代码来源:DefaultResponseParser.java


示例18: DefaultHttpResponseParserFactory

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
public DefaultHttpResponseParserFactory(
        final LineParser lineParser,
        final HttpResponseFactory responseFactory) {
    super();
    this.lineParser = lineParser != null ? lineParser : BasicLineParser.INSTANCE;
    this.responseFactory = responseFactory != null ? responseFactory
            : DefaultHttpResponseFactory.INSTANCE;
}
 
开发者ID:MyPureCloud,项目名称:purecloud-iot,代码行数:9,代码来源:DefaultHttpResponseParserFactory.java


示例19: createResponseParser

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
@Override
protected HttpMessageParser createResponseParser(
        final SessionInputBuffer buffer,
        final HttpResponseFactory responseFactory, 
        final HttpParams params) {
    // override in derived class to specify a line parser
    return new DefaultResponseParser
        (buffer, null, responseFactory, params);
}
 
开发者ID:tdopires,项目名称:cJUnit-mc626,代码行数:10,代码来源:DefaultClientConnection.java


示例20: DefaultResponseParser

import org.apache.http.HttpResponseFactory; //导入依赖的package包/类
public DefaultResponseParser(
        final SessionInputBuffer buffer,
        final LineParser parser,
        final HttpResponseFactory responseFactory,
        final HttpParams params) {
    super(buffer, parser, params);
    if (responseFactory == null) {
        throw new IllegalArgumentException
            ("Response factory may not be null");
    }
    this.responseFactory = responseFactory;
    this.lineBuf = new CharArrayBuffer(128);
    this.maxGarbageLines = params.getIntParameter(
        ConnConnectionPNames.MAX_STATUS_LINE_GARBAGE, Integer.MAX_VALUE);
}
 
开发者ID:tdopires,项目名称:cJUnit-mc626,代码行数:16,代码来源:DefaultResponseParser.java



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


鲜花

握手

雷人

路过

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

请发表评论

全部评论

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

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

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

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

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