org.apache.http.protocol.HttpProcessor Java Examples
The following examples show how to use
org.apache.http.protocol.HttpProcessor.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: MockHttpClient.java From google-http-java-client with Apache License 2.0 | 6 votes |
@Override protected RequestDirector createClientRequestDirector( HttpRequestExecutor requestExec, ClientConnectionManager conman, ConnectionReuseStrategy reustrat, ConnectionKeepAliveStrategy kastrat, HttpRoutePlanner rouplan, HttpProcessor httpProcessor, HttpRequestRetryHandler retryHandler, RedirectHandler redirectHandler, AuthenticationHandler targetAuthHandler, AuthenticationHandler proxyAuthHandler, UserTokenHandler stateHandler, HttpParams params) { return new RequestDirector() { @Beta public HttpResponse execute(HttpHost target, HttpRequest request, HttpContext context) throws HttpException, IOException { return new BasicHttpResponse(HttpVersion.HTTP_1_1, responseCode, null); } }; }
Example #2
Source File: TestHttpServer.java From brooklyn-server with Apache License 2.0 | 6 votes |
public TestHttpServer start() { checkNotStarted(); HttpProcessor httpProcessor = new ImmutableHttpProcessor(requestInterceptors, responseInterceptors); int port = Networking.nextAvailablePort(basePort); ServerBootstrap bootstrap = ServerBootstrap.bootstrap() .setListenerPort(port) .setLocalAddress(getLocalAddress()) .setHttpProcessor(httpProcessor); for (HandlerTuple tuple : handlers) { bootstrap.registerHandler(tuple.path, tuple.handler); } server = bootstrap.create(); try { server.start(); } catch (IOException e) { throw Exceptions.propagate(e); } return this; }
Example #3
Source File: HttpConnectorVerifierTest.java From syndesis with Apache License 2.0 | 5 votes |
private static HttpProcessor getHttpProcessor() { return new ImmutableHttpProcessor( Arrays.asList( new RequestBasicAuth() ), Arrays.asList( new ResponseContent(), new ResponseBasicUnauthorized()) ); }
Example #4
Source File: IheHttpFactory.java From openxds with Apache License 2.0 | 5 votes |
public HttpProcessor newHttpProcessor() { BasicHttpProcessor httpProcessor = new BasicHttpProcessor(); httpProcessor.addInterceptor(new RequestSessionCookie()); httpProcessor.addInterceptor(new ResponseDate()); httpProcessor.addInterceptor(new ResponseServer()); httpProcessor.addInterceptor(new ResponseContent()); httpProcessor.addInterceptor(new ResponseConnControl()); httpProcessor.addInterceptor(new ResponseSessionCookie()); return httpProcessor; }
Example #5
Source File: LibHttpClient.java From YiBo with Apache License 2.0 | 5 votes |
@Override protected RequestDirector createClientRequestDirector( final HttpRequestExecutor requestExec, final ClientConnectionManager conman, final ConnectionReuseStrategy reustrat, final ConnectionKeepAliveStrategy kastrat, final HttpRoutePlanner rouplan, final HttpProcessor httpProcessor, final HttpRequestRetryHandler retryHandler, final RedirectHandler redirectHandler, final AuthenticationHandler targetAuthHandler, final AuthenticationHandler proxyAuthHandler, final UserTokenHandler stateHandler, final HttpParams params) { return new LibRequestDirector( requestExec, conman, reustrat, kastrat, rouplan, httpProcessor, retryHandler, redirectHandler, targetAuthHandler, proxyAuthHandler, stateHandler, params); }
Example #6
Source File: JsonRpcHttpAsyncClient.java From jsonrpc4j with MIT License | 5 votes |
private void initialize() { if (initialized.getAndSet(true)) { return; } IOReactorConfig.Builder config = createConfig(); // params.setParameter(CoreProtocolPNames.USER_AGENT, "jsonrpc4j/1.0"); final ConnectingIOReactor ioReactor = createIoReactor(config); createSslContext(); int socketBufferSize = Integer.getInteger("com.googlecode.jsonrpc4j.async.socket.buffer", 8 * 1024); final ConnectionConfig connectionConfig = ConnectionConfig.custom().setBufferSize(socketBufferSize).build(); BasicNIOConnFactory nioConnFactory = new BasicNIOConnFactory(sslContext, null, connectionConfig); pool = new BasicNIOConnPool(ioReactor, nioConnFactory, Integer.getInteger("com.googlecode.jsonrpc4j.async.connect.timeout", 30000)); pool.setDefaultMaxPerRoute(Integer.getInteger("com.googlecode.jsonrpc4j.async.max.inflight.route", 500)); pool.setMaxTotal(Integer.getInteger("com.googlecode.jsonrpc4j.async.max.inflight.total", 500)); Thread t = new Thread(new Runnable() { @Override public void run() { try { HttpAsyncRequestExecutor protocolHandler = new HttpAsyncRequestExecutor(); IOEventDispatch ioEventDispatch = new DefaultHttpClientIODispatch(protocolHandler, sslContext, connectionConfig); ioReactor.execute(ioEventDispatch); } catch (InterruptedIOException ex) { System.err.println("Interrupted"); } catch (IOException e) { System.err.println("I/O error: " + e.getMessage()); } } }, "jsonrpc4j HTTP IOReactor"); t.setDaemon(true); t.start(); HttpProcessor httpProcessor = new ImmutableHttpProcessor(new RequestContent(), new RequestTargetHost(), new RequestConnControl(), new RequestUserAgent(), new RequestExpectContinue(false)); requester = new HttpAsyncRequester(httpProcessor, new DefaultConnectionReuseStrategy()); }
Example #7
Source File: HttpServerConnectionUpnpStream.java From TVRemoteIME with GNU General Public License v2.0 | 4 votes |
public UpnpHttpService(HttpProcessor processor, ConnectionReuseStrategy reuse, HttpResponseFactory responseFactory) { super(processor, reuse, responseFactory); }
Example #8
Source File: HttpServerConnectionUpnpStream.java From DroidDLNA with GNU General Public License v3.0 | 4 votes |
public UpnpHttpService(HttpProcessor processor, ConnectionReuseStrategy reuse, HttpResponseFactory responseFactory) { super(processor, reuse, responseFactory); }
Example #9
Source File: LibRequestDirector.java From YiBo with Apache License 2.0 | 4 votes |
public LibRequestDirector( final HttpRequestExecutor requestExec, final ClientConnectionManager conman, final ConnectionReuseStrategy reustrat, final ConnectionKeepAliveStrategy kastrat, final HttpRoutePlanner rouplan, final HttpProcessor httpProcessor, final HttpRequestRetryHandler retryHandler, final RedirectHandler redirectHandler, final AuthenticationHandler targetAuthHandler, final AuthenticationHandler proxyAuthHandler, final UserTokenHandler userTokenHandler, final HttpParams params) { if (requestExec == null) { throw new IllegalArgumentException("Request executor may not be null."); } if (conman == null) { throw new IllegalArgumentException("Client connection manager may not be null."); } if (reustrat == null) { throw new IllegalArgumentException("Connection reuse strategy may not be null."); } if (kastrat == null) { throw new IllegalArgumentException("Connection keep alive strategy may not be null."); } if (rouplan == null) { throw new IllegalArgumentException("Route planner may not be null."); } if (httpProcessor == null) { throw new IllegalArgumentException("HTTP protocol processor may not be null."); } if (retryHandler == null) { throw new IllegalArgumentException("HTTP request retry handler may not be null."); } if (redirectHandler == null) { throw new IllegalArgumentException("Redirect handler may not be null."); } if (targetAuthHandler == null) { throw new IllegalArgumentException("Target authentication handler may not be null."); } if (proxyAuthHandler == null) { throw new IllegalArgumentException("Proxy authentication handler may not be null."); } if (userTokenHandler == null) { throw new IllegalArgumentException("User token handler may not be null."); } if (params == null) { throw new IllegalArgumentException("HTTP parameters may not be null"); } this.requestExec = requestExec; this.connManager = conman; this.reuseStrategy = reustrat; this.keepAliveStrategy = kastrat; this.routePlanner = rouplan; this.httpProcessor = httpProcessor; this.retryHandler = retryHandler; this.redirectHandler = redirectHandler; this.targetAuthHandler = targetAuthHandler; this.proxyAuthHandler = proxyAuthHandler; this.userTokenHandler = userTokenHandler; this.params = params; this.managedConn = null; this.execCount = 0; this.redirectCount = 0; this.maxRedirects = this.params.getIntParameter(ClientPNames.MAX_REDIRECTS, 100); this.targetAuthState = new AuthState(); this.proxyAuthState = new AuthState(); }