Java 类org.apache.http.HttpResponseFactory 实例源码

项目:Camel    文件:HttpTestServer.java   
/**
 * 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;
}
项目:fiware-rss    文件:ResponseHandlerTest.java   
/**
 * 
 */
@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());
}
项目:lams    文件:DefaultClientConnection.java   
@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);
}
项目:lams    文件:DefaultResponseParser.java   
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);
}
项目:lams    文件:DefaultHttpResponseParser.java   
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);
}
项目:lams    文件:HttpService.java   
/**
 * 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;
}
项目:lams    文件:HttpService.java   
/**
 * Create a new HTTP service.
 *
 * @param proc             the processor to use on requests and responses
 * @param connStrategy     the connection reuse strategy
 * @param responseFactory  the response factory
 *
 * @deprecated (4.1) use {@link HttpService#HttpService(HttpProcessor,
 *  ConnectionReuseStrategy, HttpResponseFactory, HttpRequestHandlerResolver, HttpParams)}
 */
@Deprecated
public HttpService(
        final HttpProcessor proc,
        final ConnectionReuseStrategy connStrategy,
        final HttpResponseFactory responseFactory) {
    super();
    setHttpProcessor(proc);
    setConnReuseStrategy(connStrategy);
    setResponseFactory(responseFactory);
}
项目:lams    文件:HttpService.java   
/**
 * @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;
}
项目:lams    文件:HttpResponseParser.java   
/**
 * 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);
}
项目:lams    文件:DefaultHttpResponseParser.java   
/**
 * 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);
}
项目:yaacc-code    文件:YaaccHttpService.java   
public YaaccHttpService(HttpProcessor proc,
                        ConnectionReuseStrategy connStrategy,
                        HttpResponseFactory responseFactory, Context context) {
    super(proc, connStrategy, responseFactory);
    this.context = context;

}
项目:eSDK_EC_SDK_Java    文件:DefaultClientConnection.java   
@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);
}
项目:PhET    文件:NHttpReverseProxy.java   
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;
}
项目:eSDK_IVS_Java    文件:DefaultClientConnection.java   
@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);
}
项目:remote-files-sync    文件:DefaultHttpResponseParserFactory.java   
public DefaultHttpResponseParserFactory(
        final LineParser lineParser,
        final HttpResponseFactory responseFactory) {
    super();
    this.lineParser = lineParser != null ? lineParser : BasicLineParserHC4.INSTANCE;
    this.responseFactory = responseFactory != null ? responseFactory
            : DefaultHttpResponseFactoryHC4.INSTANCE;
}
项目:remote-files-sync    文件:DefaultHttpResponseParser.java   
/**
 * @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);
}
项目:remote-files-sync    文件:DefaultHttpResponseParserFactory.java   
public DefaultHttpResponseParserFactory(final LineParser lineParser,
        final HttpResponseFactory responseFactory) {
    super();
    this.lineParser = lineParser != null ? lineParser : BasicLineParserHC4.INSTANCE;
    this.responseFactory = responseFactory != null ? responseFactory
            : DefaultHttpResponseFactoryHC4.INSTANCE;
}
项目:azkaban    文件:RestfulApiClientTest.java   
@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);
}
项目:purecloud-iot    文件:DefaultClientConnection.java   
@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);
}
项目:purecloud-iot    文件:DefaultResponseParser.java   
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);
}
项目:purecloud-iot    文件:DefaultHttpResponseParserFactory.java   
public DefaultHttpResponseParserFactory(
        final LineParser lineParser,
        final HttpResponseFactory responseFactory) {
    super();
    this.lineParser = lineParser != null ? lineParser : BasicLineParser.INSTANCE;
    this.responseFactory = responseFactory != null ? responseFactory
            : DefaultHttpResponseFactory.INSTANCE;
}
项目:purecloud-iot    文件:DefaultHttpResponseParser.java   
/**
 * @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);
}
项目:Visit    文件:DefaultHttpResponseParserFactory.java   
public DefaultHttpResponseParserFactory(
        final LineParser lineParser,
        final HttpResponseFactory responseFactory) {
    super();
    this.lineParser = lineParser != null ? lineParser : BasicLineParserHC4.INSTANCE;
    this.responseFactory = responseFactory != null ? responseFactory
            : DefaultHttpResponseFactoryHC4.INSTANCE;
}
项目:Visit    文件:DefaultHttpResponseParser.java   
/**
 * @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);
}
项目:Visit    文件:DefaultHttpResponseParserFactory.java   
public DefaultHttpResponseParserFactory(final LineParser lineParser,
        final HttpResponseFactory responseFactory) {
    super();
    this.lineParser = lineParser != null ? lineParser : BasicLineParserHC4.INSTANCE;
    this.responseFactory = responseFactory != null ? responseFactory
            : DefaultHttpResponseFactoryHC4.INSTANCE;
}
项目:cJUnit-mc626    文件:DefaultClientConnection.java   
@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);
}
项目:cJUnit-mc626    文件:DefaultResponseParser.java   
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);
}
项目:olingo-odata4    文件:CustomConnectionsHttpClientFactory.java   
@Override
protected HttpMessageParser<HttpResponse> createResponseParser(
        final SessionInputBuffer buffer,
        final HttpResponseFactory responseFactory,
        final HttpParams params) {

  return new DefaultHttpResponseParser(
          buffer,
          new MyLineParser(),
          responseFactory,
          params);
}
项目:wso2-axis2    文件:AxisHttpService.java   
public AxisHttpService(
        final HttpProcessor httpProcessor,
        final ConnectionReuseStrategy connStrategy,
        final HttpResponseFactory responseFactory,
        final ConfigurationContext configurationContext,
        final Worker worker) {
    super();
    if (httpProcessor == null) {
        throw new IllegalArgumentException("HTTP processor may not be null");
    }
    if (connStrategy == null) {
        throw new IllegalArgumentException("Connection strategy may not be null");
    }
    if (responseFactory == null) {
        throw new IllegalArgumentException("Response factory may not be null");
    }
    if (worker == null) {
        throw new IllegalArgumentException("Worker may not be null");
    }
    if (configurationContext == null) {
        throw new IllegalArgumentException("Configuration context may not be null");
    }
    this.httpProcessor = httpProcessor;
    this.connStrategy = connStrategy;
    this.responseFactory = responseFactory;
    this.configurationContext = configurationContext;
    this.worker = worker;

}
项目:MAKEYOURFACE    文件:HttpService.java   
/**
 * 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;
}
项目:MAKEYOURFACE    文件:HttpService.java   
/**
 * Create a new HTTP service.
 *
 * @param proc             the processor to use on requests and responses
 * @param connStrategy     the connection reuse strategy
 * @param responseFactory  the response factory
 *
 * @deprecated (4.1) use {@link HttpService#HttpService(HttpProcessor,
 *  ConnectionReuseStrategy, HttpResponseFactory, HttpRequestHandlerResolver, HttpParams)}
 */
@Deprecated
public HttpService(
        final HttpProcessor proc,
        final ConnectionReuseStrategy connStrategy,
        final HttpResponseFactory responseFactory) {
    super();
    setHttpProcessor(proc);
    setConnReuseStrategy(connStrategy);
    setResponseFactory(responseFactory);
}
项目:MAKEYOURFACE    文件:HttpService.java   
/**
 * @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;
}
项目:ZTLib    文件:DefaultHttpResponseParserFactory.java   
public DefaultHttpResponseParserFactory(
        final LineParser lineParser,
        final HttpResponseFactory responseFactory) {
    super();
    this.lineParser = lineParser != null ? lineParser : BasicLineParserHC4.INSTANCE;
    this.responseFactory = responseFactory != null ? responseFactory
            : DefaultHttpResponseFactoryHC4.INSTANCE;
}
项目:ZTLib    文件:DefaultHttpResponseParser.java   
/**
 * @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);
}
项目:ZTLib    文件:DefaultHttpResponseParserFactory.java   
public DefaultHttpResponseParserFactory(final LineParser lineParser,
        final HttpResponseFactory responseFactory) {
    super();
    this.lineParser = lineParser != null ? lineParser : BasicLineParserHC4.INSTANCE;
    this.responseFactory = responseFactory != null ? responseFactory
            : DefaultHttpResponseFactoryHC4.INSTANCE;
}
项目:remote-files-sync    文件:DefaultHttpResponseParserFactory.java   
public DefaultHttpResponseParserFactory(
        final HttpResponseFactory responseFactory) {
    this(null, responseFactory);
}
项目:lavaplayer    文件:HttpClientTools.java   
public GarbageAllergicHttpResponseParser(SessionInputBuffer buffer, LineParser lineParser, HttpResponseFactory responseFactory, MessageConstraints constraints) {
  super(buffer, lineParser, responseFactory, constraints);
}
项目:Camel    文件:HttpTestServer.java   
protected HttpResponseFactory newHttpResponseFactory() {
    return new DefaultHttpResponseFactory();
}
项目:purecloud-iot    文件:DefaultHttpResponseParserFactory.java   
public DefaultHttpResponseParserFactory(
        final HttpResponseFactory responseFactory) {
    this(null, responseFactory);
}
项目:openxds    文件:IheHttpFactory.java   
public HttpResponseFactory newResponseFactory() {
    return new DefaultHttpResponseFactory();
}