Package org.xlightweb.client

Examples of org.xlightweb.client.HttpClient.addInterceptor()


    HttpClient httpClient = new HttpClient();

    RequestHandlerChain chain = new RequestHandlerChain();
    chain.addLast(new HeaderEnhancer());
    chain.addLast(new AuditHandler());
    httpClient.addInterceptor(chain);

    IHttpResponse response = httpClient.call(new PostRequest("http://localhost:" + server.getLocalPort()+ "/", "text/plain", "fest123456"));
   
   
    Assert.assertEquals(200, response.getStatus());
View Full Code Here


    server.start();
   
    HttpClient httpClient = new HttpClient();
 
    InvokeOnMessageRequestHandler interceptor = new InvokeOnMessageRequestHandler ();
    httpClient.addInterceptor(interceptor);

   
    ResponseHandler respHdl = new ResponseHandler();
    BodyDataSink outChannel = httpClient.send(new HttpRequestHeader("POST", "http://localhost:" + server.getLocalPort()+ "/", "text/plain"), respHdl);
    outChannel.write("test1234567");
View Full Code Here

    HttpClient httpClient = new HttpClient();

    RequestHandlerChain chain = new RequestHandlerChain();
    chain.addLast(new HeaderEnhancer());
    chain.addLast(new AuditHandler());
    httpClient.addInterceptor(chain);

    IHttpResponse response = httpClient.call(new PostRequest("http://localhost:" + server.getLocalPort()+ "/", "text/plain", "test123456"));
   
   
    Assert.assertEquals(200, response.getStatus());
View Full Code Here

   
    HttpClient httpClient = new HttpClient();
    httpClient.setFollowsRedirect(true);
   
    AuditHandler interceptor = new AuditHandler();
    httpClient.addInterceptor(interceptor);

   
    String url = URLEncoder.encode("http://localhost:" + server.getLocalPort() + "/test");
    httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort()+ "/redirect/?target=" + url));
View Full Code Here

   
    HttpClient httpClient = new HttpClient();
    httpClient.setFollowsRedirect(true);
   
    AuditHandler interceptor = new AuditHandler();
    httpClient.addInterceptor(interceptor);

   
    String url = URLEncoder.encode("http://localhost:" + server.getLocalPort() + "/test");
    httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort()+ "/redirect/?target=" + url));
View Full Code Here

               
                byte[] data = request.getBlockingBody().readBytes();
                exchange.forward(new HttpRequest(request.getRequestHeader(), data));
            }
        };
        httpClient.addInterceptor(interceptor);

        File file = QAUtil.createTestfile_400k();

        PostRequest request = new PostRequest("http://localhost:" + server.getLocalPort() + "/", file);
        IHttpResponse response = httpClient.call(request);
View Full Code Here

        HttpServer server = new HttpServer(reqHdl);
        server.start();
           
       
        HttpClient httpClient = new HttpClient();
        httpClient.addInterceptor(new Interceptor());
       

        MultipartRequest req = new MultipartRequest("POST", "http://localhost:" + server.getLocalPort()+ "/test");
       
        File file1 = QAUtil.createTestfile_50byte();
View Full Code Here

               
                byte[] data = request.getBody().readBytes();
                exchange.forward(new HttpRequest(request.getRequestHeader(), data));
            }
        };
        httpClient.addInterceptor(interceptor);

        File file = QAUtil.createTestfile_400k();

        PostRequest request = new PostRequest("http://localhost:" + server.getLocalPort() + "/", file);
        IHttpResponse response = httpClient.call(request);
View Full Code Here

    HttpClient httpClient = new HttpClient();
    ConnectionUtils.registerMBean(httpClient);
   
    LogHandler clientLogHandler = new LogHandler("[client]");
    httpClient.addInterceptor(clientLogHandler);
   
    IHttpResponse resp = httpClient.call(new GetRequest("http://localhost:" + server.getLocalPort() + "/"));
    Assert.assertEquals(200, resp.getStatus());
    Assert.assertTrue(clientLogHandler.getElapsedNanoLastCall() > serverLogHandler.getElapsedNanoLastCall());
   
View Full Code Here

               
                byte[] data = request.getBody().readBytes();
                exchange.forward(new HttpRequest(request.getRequestHeader(), data));
            }
        };
        httpClient.addInterceptor(interceptor);

        File file = QAUtil.createTestfile_400k();

        PostRequest request = new PostRequest("http://localhost:" + server.getLocalPort() + "/", file);
        IHttpResponse response = httpClient.call(request);
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.