http connetion test

import jodd.http.HttpRequest;
import jodd.http.HttpResponse;

public class HttpColletionTest2 {
	
	public static void main(String[] args) throws Exception{
		
		     HttpRequest httpRequest = null;
			 String baseURI="http://";
			 httpRequest = HttpRequest.get(baseURI);
			 
			 
			 
			/**
			 *   Connection: Close
				Host: www.cmall.com
				User-Agent: Jodd HTTP
				
				
				======================
				HTTP/1.1 200 OK
				Access-Control-Allow-Headers: X-Requested-With
				Access-Control-Allow-Methods: GET,POST,OPTIONS
				Access-Control-Allow-Origin: *
				Connection: close
				Content-Type: application/json;charset=UTF-8
				Date: Thu, 03 Aug 2017 16:42:42 GMT
				Server: CMALL
				Set-Cookie: route=8aa603b3548f673b35ac7966ba75624a; Path=/
				Transfer-Encoding: chunked
			 */
			 httpRequest.header("Connection","keep-alive");
			 
			 /**
			  * GET /goodsSite/home/productReservationList?parentCode=0 HTTP/1.1
				Connection: Close
				Connection: keep-alive
				Host: www.cmall.com
				User-Agent: Jodd HTTP
				
				
				======================
				HTTP/1.1 200 OK
				Access-Control-Allow-Headers: X-Requested-With
				Access-Control-Allow-Methods: GET,POST,OPTIONS
				Access-Control-Allow-Origin: *
				Connection: keep-alive
				Content-Type: application/json;charset=UTF-8
				Date: Thu, 03 Aug 2017 16:43:34 GMT
				Server: CMALL
				Set-Cookie: route=aef33fdd73cd29076cd5a1a84fcaf98c; Path=/
				Transfer-Encoding: chunked
			  */
			 
			 HttpResponse response = httpRequest.send();
			 
			 System.out.println(httpRequest);
			 System.out.println("======================");
			 
			 System.out.println(response);
				 
		 }
	
	
	
	
	

}

猜你喜欢

转载自m635674608.iteye.com/blog/2388248
今日推荐