Package org.xlightweb.client

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


    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

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.