hi, all
when i google "Ansyc non-blocking http client" and i found the eclipse jetty http client, Waaa! that's what i want. however, there is litter reference about it.... then i use testng write a dome, but i found there is no response when i use get http://www.google.com, WHY?? client = new HttpClient(); client.setConnectorType(HttpClient.CONNECTOR_SELECT_CHANNEL); client.setMaxConnectionsPerAddress(4); // max 200 concurrent connections to every address client.setThreadPool(new QueuedThreadPool(250)); // max 250 threads client.setTimeout(1000); // 30 seconds timeout; if no server reply, the request expires client.start(); HttpExchange exchange = new HttpExchange(); // Optionally set the HTTP method exchange.setMethod("GET"); // Or, equivalently, this: exchange.setURL("http://www.google.com/"); client.send(exchange); System.out.println("Exchange sent - " + exchange.toString()); int exchangeState = exchange.waitForDone(); if (exchangeState == HttpExchange.STATUS_COMPLETED) { System.out.println("STATUS_COMPLETED"); System.out.println(exchange.getRequestContent()); } else if (exchangeState == HttpExchange.STATUS_EXCEPTED) { } else if (exchangeState == HttpExchange.STATUS_EXPIRED) { } the console stdout is null? why is null. then i use the exchange.setURL("http://localhost:9090/helloworld") which established by maven jetty plugin, the response is also null? why? why? the STATUS is COMPLETED thx in advanced 2010-12-08 12:19:43,300 DEBUG log:231 - Logging to org.slf4j.impl.JCLLoggerAdapter(org.eclipse.jetty.util.log) via org.eclipse.jetty.util.log.Slf4jLog 2010-12-08 12:19:43,303 DEBUG log:231 - Starting org.eclipse.jetty.client.httpcli...@4b1c2b67 2010-12-08 12:19:43,304 DEBUG log:231 - Starting qtp1076825585{8<=0<=0/250,-1} 2010-12-08 12:19:43,307 DEBUG log:231 - STARTED qtp1076825585{8<=8<=8/250,0} 2010-12-08 12:19:43,315 DEBUG log:231 - Starting org.eclipse.jetty.client.selectconnec...@6aba4211 2010-12-08 12:19:43,315 DEBUG log:231 - Starting org.eclipse.jetty.client.selectconnector$mana...@6a47a0d4 2010-12-08 12:19:43,322 DEBUG log:231 - STARTED org.eclipse.jetty.client.selectconnector$mana...@6a47a0d4 2010-12-08 12:19:44,206 DEBUG log:231 - STARTED org.eclipse.jetty.client.selectconnec...@6aba4211 2010-12-08 12:19:44,207 DEBUG log:231 - STARTED org.eclipse.jetty.client.httpcli...@4b1c2b67 Exchange sent - httpexcha...@85878700=get//www.google.com:80/#1 STATUS_COMPLETED null 2010-12-08 12:19:44,528 DEBUG log:231 - STOPPED org.eclipse.jetty.client.selectconnector$mana...@6a47a0d4 2010-12-08 12:19:44,528 DEBUG log:231 - STOPPED org.eclipse.jetty.client.selectconnec...@6aba4211 2010-12-08 12:19:44,581 DEBUG log:231 - STOPPED qtp1076825585{8<=0<=0/250,0} 2010-12-08 12:19:44,582 DEBUG log:231 - STOPPED org.eclipse.jetty.client.httpcli...@4b1c2b67
_______________________________________________ jetty-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/jetty-users
