参考于:如何判定一个微信图片 url 是否有效_张小川3211的博客-CSDN博客
package com.yuexin.sysadmin.rest.pointShop;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.*;
import javax.net.ssl.HttpsURLConnection;
import java.io.IOException;
import java.net.HttpURLConnection;
import java.net.URL;
import java.util.List;
import java.util.Map;
/***
* @author sqd
* @Date 2022/12/7
* */
@RestController
@RequestMapping("/test")
public class test {
@GetMapping("example")
public static boolean checkWeChatHeadImg(String url) throws Exception{
if(StringUtils.isEmpty(url)){
return false;
}
HttpURLConnection http = null;
try {
URL urlObj = new URL(url);
if(url.startsWith("https://")){