Package org.xlightweb

Examples of org.xlightweb.HttpRequest


    // create exchange
    ClientExchange exchange = new ClientExchange(this, getWorkerpool());
   
    // create data body sink / data body source pair
    IBodySinkPair pair = HttpClientConnection.newBodySinkPair(null, exchange.getExecutor(), requestHeader.getCharacterEncoding());
    IHttpRequest request = new HttpRequest(requestHeader, pair.getBodyDataSource());

    // init and process it
    exchange.init(request, responseHandler);
    httpClientRequestHandlerChain.onRequest(exchange);
     
View Full Code Here


      }
    }
   
    IHttpRequest wrappedRequest = null;
    if (request.hasBody()) {
      wrappedRequest = new HttpRequest(new NonSSLRequestHeaderWrapper(request.getRequestHeader()), request.getNonBlockingBody());
    } else {
      wrappedRequest = new HttpRequest(new NonSSLRequestHeaderWrapper(request.getRequestHeader()));
    }
   
    exchange.forward(wrappedRequest);
  }
View Full Code Here

 
  private BodyDataSink sendInternal(IHttpRequestHeader requestHeader, IHttpResponseHandler responseHandler) throws IOException, ConnectException {
    lastTimeRequestSentMillis = System.currentTimeMillis();
   
    BodyDataSink dataSink = HttpClientConnection.newInMemoryBodyDataSink(requestHeader.getCharacterEncoding(), pool.getWorkerpool());
    IHttpRequest request = new HttpRequest(requestHeader, HttpClientConnection.getDataSourceOfInMemoryBodyDataSink(dataSink));

    send(request, responseHandler);   
    return dataSink;
  }
View Full Code Here

      }
    }
   
    IHttpRequest wrappedRequest = null;
    if (request.hasBody()) {
      wrappedRequest = new HttpRequest(new NonSSLRequestHeaderWrapper(request.getRequestHeader()), request.getNonBlockingBody());
    } else {
      wrappedRequest = new HttpRequest(new NonSSLRequestHeaderWrapper(request.getRequestHeader()));
    }
   
    exchange.forward(wrappedRequest);
  }
View Full Code Here

                            public void onException(IOException ioe) throws IOException {
                                exchange.sendError(ioe);
                            }
                        };
                       
                        httpClient.send(new HttpRequest(requestHeader), respHdl);
                    } catch (IOException ioe) {
                        exchange.sendError(ioe);
                    }
                }
            };
View Full Code Here

               
                @Override
                public void onComplete() {
                    if (currentSize < cache.getMaxSizeCacheEntry()) {
                        try {
                            interaction.setRequest(new HttpRequest(headerCopy, bodyCopy));
                        } catch (IOException ioe) {
                            if (LOG.isLoggable(Level.FINE)) {
                                LOG.fine("error occured by creating/registering cachedResponse " + ioe.toString());
                            }
                        }
                    } else {
                        if (LOG.isLoggable(Level.FINE)) {
                            LOG.fine("do not cache interaction (to large or request not complete)");
                        }
                    }
                }                       
            };
           
            dataSource.setDataHandler(bodyForwarder);
           
           
        } else {
            interaction.setRequest(new HttpRequest(headerCopy));
           
            ForwarderResponseHandler forwardResponseHandler = new ForwarderResponseHandler(interaction, exchange);
            exchange.forward(exchange.getRequest(), forwardResponseHandler);
        }       
  }
View Full Code Here

 
  private BodyDataSink sendInternal(IHttpRequestHeader requestHeader, IHttpResponseHandler responseHandler) throws IOException, ConnectException {
    lastTimeRequestSentMillis = System.currentTimeMillis();
   
    BodyDataSink dataSink = HttpClientConnection.newInMemoryBodyDataSink(requestHeader.getCharacterEncoding(), pool.getWorkerpool());
    IHttpRequest request = new HttpRequest(requestHeader, HttpClientConnection.getDataSourceOfInMemoryBodyDataSink(dataSink));

    send(request, responseHandler);   
    return dataSink;
  }
View Full Code Here

      }
    }
   
    IHttpRequest wrappedRequest = null;
    if (request.hasBody()) {
      wrappedRequest = new HttpRequest(new NonSSLRequestHeaderWrapper(request.getRequestHeader()), request.getNonBlockingBody());
    } else {
      wrappedRequest = new HttpRequest(new NonSSLRequestHeaderWrapper(request.getRequestHeader()));
    }
   
    exchange.forward(wrappedRequest);
  }
View Full Code Here

    server.start();
   
    HttpClientConnection con = new HttpClientConnection("localhost", server.getLocalPort());
   
    for (int i = 0; i < 5; i++) {
      HttpRequest request = new HttpRequest("OPTIONS", "/");
      IHttpResponse response = con.call(request);
     
      Assert.assertEquals(200, response.getStatus());
      Assert.assertTrue(response.getHeader("allow").indexOf("GET") != -1);
     
View Full Code Here

    proxy.start();
   
    HttpClientConnection con = new HttpClientConnection("localhost", proxy.getLocalPort());
   
    // setup a tunnel
    HttpRequest request = new HttpRequest("CONNECT", "localhost:" + securedServer.getLocalPort());
    IHttpResponse response = con.call(request);
     
    Assert.assertEquals(200, response.getStatus());
   
View Full Code Here

TOP

Related Classes of org.xlightweb.HttpRequest

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.