You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
package com.fr.plugin; |
|
|
|
import com.fr.base.FRContext; |
|
import com.fr.base.ServerConfig; |
|
import com.fr.base.TemplateUtils; |
|
import com.fr.log.FineLoggerFactory; |
|
import com.fr.stable.StringUtils; |
|
import com.fr.third.org.apache.commons.io.IOUtils; |
|
|
|
import javax.servlet.http.HttpServletRequest; |
|
import java.io.*; |
|
import java.net.HttpURLConnection; |
|
import java.net.URL; |
|
import java.net.URLEncoder; |
|
import java.nio.charset.StandardCharsets; |
|
import java.util.Base64; |
|
import java.util.Iterator; |
|
import java.util.Map; |
|
import java.util.Set; |
|
|
|
/** |
|
* http请求工具类 |
|
* |
|
* @author 0246 |
|
*/ |
|
public class HttpUtils { |
|
|
|
|
|
|
|
/** |
|
* 返回当前系统的根路径 |
|
* |
|
* @return |
|
*/ |
|
public static String getDefaultUrl(HttpServletRequest req) { |
|
StringBuilder url = new StringBuilder(); |
|
try { |
|
url.append(req.getScheme()); |
|
url.append("://"); |
|
url.append(req.getServerName()); |
|
if (req.getServerPort() != 80) { |
|
url.append(":"); |
|
url.append(req.getServerPort()); |
|
} |
|
url.append(TemplateUtils.render("${fineServletURL}")); |
|
} catch (Exception e) { |
|
FineLoggerFactory.getLogger().error(e.getMessage(), e); |
|
} |
|
return url.toString(); |
|
} |
|
|
|
}
|
|
|