| 
					
				 | 
			
			
				@@ -1,12 +1,19 @@ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 package com.tzld.piaoquan.longarticle.controller; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import cn.hutool.http.HttpRequest; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import cn.hutool.http.HttpResponse; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import com.tzld.piaoquan.longarticle.service.local.impl.MatchVideoServiceImpl; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import lombok.extern.slf4j.Slf4j; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.checkerframework.checker.units.qual.A; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.beans.factory.annotation.Autowired; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.GetMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.RequestMapping; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import org.springframework.web.bind.annotation.RestController; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import static com.tzld.piaoquan.longarticle.common.constants.ProxyConstant.PROXY_HOST; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import static com.tzld.piaoquan.longarticle.common.constants.ProxyConstant.PROXY_PORT; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+@Slf4j 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @RestController 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @RequestMapping("/") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 public class IndexController { 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -22,4 +29,20 @@ public class IndexController { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    @GetMapping("/test") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    public String test() { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 目标网站 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        String url = "https://www.baidu.com"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        // 发送请求 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        HttpResponse result = HttpRequest.get(url) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .setHttpProxy(PROXY_HOST, PROXY_PORT) 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .timeout(20000)//设置超时,毫秒 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                .execute(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        log.info("test={}", result.body()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+        return "ok"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 } 
			 |