mirror of
https://gitee.com/chinabugotech/hutool.git
synced 2025-07-21 15:09:48 +08:00
fix code
This commit is contained in:
@@ -41,7 +41,7 @@ public enum ContentType {
|
||||
*/
|
||||
TEXT_HTML("text/html");
|
||||
|
||||
private String value;
|
||||
private final String value;
|
||||
|
||||
ContentType(String value) {
|
||||
this.value = value;
|
||||
|
@@ -121,7 +121,7 @@ public enum Header {
|
||||
*/
|
||||
LOCATION("Location");
|
||||
|
||||
private String value;
|
||||
private final String value;
|
||||
|
||||
Header(String value) {
|
||||
this.value = value;
|
||||
|
@@ -33,8 +33,8 @@ import java.util.Map.Entry;
|
||||
*/
|
||||
public class HttpConnection {
|
||||
|
||||
private URL url;
|
||||
private Proxy proxy;
|
||||
private final URL url;
|
||||
private final Proxy proxy;
|
||||
private HttpURLConnection conn;
|
||||
|
||||
/**
|
||||
|
@@ -1,5 +1,7 @@
|
||||
package cn.hutool.http;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
import java.io.ByteArrayInputStream;
|
||||
import java.io.FileNotFoundException;
|
||||
import java.io.IOException;
|
||||
@@ -8,8 +10,6 @@ import java.util.zip.GZIPInputStream;
|
||||
import java.util.zip.Inflater;
|
||||
import java.util.zip.InflaterInputStream;
|
||||
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
|
||||
/**
|
||||
* HTTP输入流,此流用于包装Http请求响应内容的流,用于解析各种压缩、分段的响应流内容
|
||||
*
|
||||
@@ -79,11 +79,10 @@ public class HttpInputStream extends InputStream {
|
||||
try {
|
||||
this.in = (response.status < HttpStatus.HTTP_BAD_REQUEST) ? response.httpConnection.getInputStream() : response.httpConnection.getErrorStream();
|
||||
} catch (IOException e) {
|
||||
if (e instanceof FileNotFoundException) {
|
||||
// 服务器无返回内容,忽略之
|
||||
} else {
|
||||
if (false == (e instanceof FileNotFoundException)) {
|
||||
throw new HttpException(e);
|
||||
}
|
||||
// 服务器无返回内容,忽略之
|
||||
}
|
||||
|
||||
// 在一些情况下,返回的流为null,此时提供状态码说明
|
||||
|
@@ -43,7 +43,7 @@ public class HttpResponse extends HttpBase<HttpResponse> implements Closeable {
|
||||
/** 响应状态码 */
|
||||
protected int status;
|
||||
/** 是否忽略读取Http响应体 */
|
||||
private boolean ignoreBody;
|
||||
private final boolean ignoreBody;
|
||||
/** 从响应中获取的编码 */
|
||||
private Charset charsetFromResponse;
|
||||
|
||||
|
@@ -19,7 +19,7 @@ public class RootAction implements Action {
|
||||
public static final String DEFAULT_INDEX_FILE_NAME = "index.html";
|
||||
|
||||
private final String rootDir;
|
||||
private List<String> indexFileNames;
|
||||
private final List<String> indexFileNames;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
|
@@ -2,15 +2,14 @@ package cn.hutool.http.ssl;
|
||||
|
||||
import cn.hutool.core.util.ArrayUtil;
|
||||
|
||||
import javax.net.ssl.SSLSocket;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
import java.io.IOException;
|
||||
import java.net.InetAddress;
|
||||
import java.net.Socket;
|
||||
import java.security.KeyManagementException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
|
||||
import javax.net.ssl.SSLSocket;
|
||||
import javax.net.ssl.SSLSocketFactory;
|
||||
|
||||
/**
|
||||
* 自定义支持协议类型的SSLSocketFactory
|
||||
*
|
||||
@@ -18,8 +17,8 @@ import javax.net.ssl.SSLSocketFactory;
|
||||
*/
|
||||
public class CustomProtocolsSSLFactory extends SSLSocketFactory {
|
||||
|
||||
private String[] protocols;
|
||||
private SSLSocketFactory base;
|
||||
private final String[] protocols;
|
||||
private final SSLSocketFactory base;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
|
@@ -1,9 +1,9 @@
|
||||
package cn.hutool.http.useragent;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
import cn.hutool.core.util.ReUtil;
|
||||
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* User-agent信息
|
||||
*
|
||||
@@ -15,9 +15,9 @@ public class UserAgentInfo {
|
||||
public static final String NameUnknown = "Unknown";
|
||||
|
||||
/** 信息名称 */
|
||||
private String name;
|
||||
private final String name;
|
||||
/** 信息匹配模式 */
|
||||
private Pattern pattern;
|
||||
private final Pattern pattern;
|
||||
|
||||
/**
|
||||
* 构造
|
||||
|
@@ -1,11 +1,15 @@
|
||||
package cn.hutool.http.webservice;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.XmlUtil;
|
||||
import cn.hutool.http.HttpGlobalConfig;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
|
||||
import javax.xml.XMLConstants;
|
||||
import javax.xml.namespace.QName;
|
||||
@@ -18,17 +22,12 @@ import javax.xml.soap.SOAPException;
|
||||
import javax.xml.soap.SOAPHeader;
|
||||
import javax.xml.soap.SOAPHeaderElement;
|
||||
import javax.xml.soap.SOAPMessage;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.io.IoUtil;
|
||||
import cn.hutool.core.map.MapUtil;
|
||||
import cn.hutool.core.util.CharsetUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import cn.hutool.core.util.XmlUtil;
|
||||
import cn.hutool.http.HttpGlobalConfig;
|
||||
import cn.hutool.http.HttpRequest;
|
||||
import cn.hutool.http.HttpResponse;
|
||||
import java.io.IOException;
|
||||
import java.io.OutputStream;
|
||||
import java.nio.charset.Charset;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Map.Entry;
|
||||
|
||||
/**
|
||||
* SOAP客户端
|
||||
@@ -91,7 +90,7 @@ public class SoapClient {
|
||||
/**
|
||||
* 应用于方法上的命名空间URI
|
||||
*/
|
||||
private String namespaceURI;
|
||||
private final String namespaceURI;
|
||||
|
||||
/**
|
||||
* 创建SOAP客户端,默认使用soap1.1版本协议
|
||||
|
@@ -23,7 +23,7 @@ public enum SoapProtocol {
|
||||
this.value = value;
|
||||
}
|
||||
|
||||
private String value;
|
||||
private final String value;
|
||||
|
||||
/**
|
||||
* 获取版本值信息
|
||||
|
Reference in New Issue
Block a user