
com.github.joekerouac.common.tools.net.http.config.IHttpConfig Maven / Gradle / Ivy
The newest version!
// Generated by delombok at Fri Mar 14 11:41:38 CST 2025
/*
* Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE
* file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file
* to You under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the
* License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on
* an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the
* specific language governing permissions and limitations under the License.
*/
package com.github.joekerouac.common.tools.net.http.config;
import com.github.joekerouac.common.tools.io.StreamFilter;
/**
* Http请求配置,一个请求一个,全局配置可以通过{@link IHttpClientConfig IHttpClientConfig}来配置
*
* @since 1.0.0
* @author JoeKerouac
* @date 2022-10-14 14:37:00
*/
public class IHttpConfig {
/**
* 默认传输超时时间
*/
private static final int DEFAULT_SOCKET_TIMEOUT = 60 * 1000;
/**
* 默认连接超时时间
*/
private static final int DEFAULT_CONNECT_TIMEOUT = 5 * 1000;
/**
* 默认请求超时时间
*/
private static final int DEFAULT_CONNECTION_REQUEST_TIMEOUT = 5 * 1000;
/**
* 默认最大响应体,当响应体大于该值时写入本地文件缓冲,单位byte
*/
private static final int DEFAULT_WRITE_FILE_ON_LARGE = 1024 * 1024;
/**
* 数据传输超时时间,单位毫秒,默认一分钟
*/
private int socketTimeout = DEFAULT_SOCKET_TIMEOUT;
/**
* 连接建立超时,如果是TLS连接,则包含TLS握手时间,单位毫秒,默认5秒
*/
private int connectTimeout = DEFAULT_CONNECT_TIMEOUT;
/**
* 从连接池获取连接的超时时间,单位毫秒,默认5秒
*/
private int connectionRequestTimeout = DEFAULT_CONNECTION_REQUEST_TIMEOUT;
/**
* 当响应超过多大时将响应写入文件,单位byte
*/
private int writeFileOnLarge = DEFAULT_WRITE_FILE_ON_LARGE;
/**
* 初始化buffer大小,允许逐渐扩充到{@link #writeFileOnLarge}指定大小,然后将数据刷入临时文件
*/
private int initBufferSize = 1024;
/**
* 响应数据filter
*/
private StreamFilter filter;
@java.lang.SuppressWarnings("all")
@lombok.Generated
public IHttpConfig() {
}
/**
* 数据传输超时时间,单位毫秒,默认一分钟
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int getSocketTimeout() {
return this.socketTimeout;
}
/**
* 连接建立超时,如果是TLS连接,则包含TLS握手时间,单位毫秒,默认5秒
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int getConnectTimeout() {
return this.connectTimeout;
}
/**
* 从连接池获取连接的超时时间,单位毫秒,默认5秒
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int getConnectionRequestTimeout() {
return this.connectionRequestTimeout;
}
/**
* 当响应超过多大时将响应写入文件,单位byte
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int getWriteFileOnLarge() {
return this.writeFileOnLarge;
}
/**
* 初始化buffer大小,允许逐渐扩充到{@link #writeFileOnLarge}指定大小,然后将数据刷入临时文件
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int getInitBufferSize() {
return this.initBufferSize;
}
/**
* 响应数据filter
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public StreamFilter getFilter() {
return this.filter;
}
/**
* 数据传输超时时间,单位毫秒,默认一分钟
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setSocketTimeout(final int socketTimeout) {
this.socketTimeout = socketTimeout;
}
/**
* 连接建立超时,如果是TLS连接,则包含TLS握手时间,单位毫秒,默认5秒
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setConnectTimeout(final int connectTimeout) {
this.connectTimeout = connectTimeout;
}
/**
* 从连接池获取连接的超时时间,单位毫秒,默认5秒
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setConnectionRequestTimeout(final int connectionRequestTimeout) {
this.connectionRequestTimeout = connectionRequestTimeout;
}
/**
* 当响应超过多大时将响应写入文件,单位byte
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setWriteFileOnLarge(final int writeFileOnLarge) {
this.writeFileOnLarge = writeFileOnLarge;
}
/**
* 初始化buffer大小,允许逐渐扩充到{@link #writeFileOnLarge}指定大小,然后将数据刷入临时文件
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setInitBufferSize(final int initBufferSize) {
this.initBufferSize = initBufferSize;
}
/**
* 响应数据filter
*/
@java.lang.SuppressWarnings("all")
@lombok.Generated
public void setFilter(final StreamFilter filter) {
this.filter = filter;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public boolean equals(final java.lang.Object o) {
if (o == this) return true;
if (!(o instanceof IHttpConfig)) return false;
final IHttpConfig other = (IHttpConfig) o;
if (!other.canEqual((java.lang.Object) this)) return false;
if (this.getSocketTimeout() != other.getSocketTimeout()) return false;
if (this.getConnectTimeout() != other.getConnectTimeout()) return false;
if (this.getConnectionRequestTimeout() != other.getConnectionRequestTimeout()) return false;
if (this.getWriteFileOnLarge() != other.getWriteFileOnLarge()) return false;
if (this.getInitBufferSize() != other.getInitBufferSize()) return false;
final java.lang.Object this$filter = this.getFilter();
final java.lang.Object other$filter = other.getFilter();
if (this$filter == null ? other$filter != null : !this$filter.equals(other$filter)) return false;
return true;
}
@java.lang.SuppressWarnings("all")
@lombok.Generated
protected boolean canEqual(final java.lang.Object other) {
return other instanceof IHttpConfig;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public int hashCode() {
final int PRIME = 59;
int result = 1;
result = result * PRIME + this.getSocketTimeout();
result = result * PRIME + this.getConnectTimeout();
result = result * PRIME + this.getConnectionRequestTimeout();
result = result * PRIME + this.getWriteFileOnLarge();
result = result * PRIME + this.getInitBufferSize();
final java.lang.Object $filter = this.getFilter();
result = result * PRIME + ($filter == null ? 43 : $filter.hashCode());
return result;
}
@java.lang.Override
@java.lang.SuppressWarnings("all")
@lombok.Generated
public java.lang.String toString() {
return "IHttpConfig(socketTimeout=" + this.getSocketTimeout() + ", connectTimeout=" + this.getConnectTimeout() + ", connectionRequestTimeout=" + this.getConnectionRequestTimeout() + ", writeFileOnLarge=" + this.getWriteFileOnLarge() + ", initBufferSize=" + this.getInitBufferSize() + ", filter=" + this.getFilter() + ")";
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy