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


Java HttpResponseFactory类代码示例

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


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


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