java.lang.Object
org.miaixz.bus.http.plugin.httpx.HttpProxy
Represents the configuration for an HTTP proxy server. This class holds the address, port, credentials, and type of
the proxy.
- Since:
- Java 17+
- Author:
- Kimi Liu
-
Field Summary
FieldsModifier and TypeFieldDescriptionfinal StringThe proxy server's hostname or IP address.final StringThe password for proxy authentication.final intThe proxy server's port number.final Proxy.TypeThe type of proxy (e.g., HTTP, SOCKS).final StringThe username for proxy authentication. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionCreates anAuthenticatorfor this proxy configuration.proxy()Creates aProxyobject from this configuration.
-
Field Details
-
hostAddress
The proxy server's hostname or IP address. -
port
public final int portThe proxy server's port number. -
user
The username for proxy authentication. Can be null if no authentication is required. -
password
The password for proxy authentication. Can be null if no authentication is required. -
type
The type of proxy (e.g., HTTP, SOCKS).
-
-
Constructor Details
-
HttpProxy
Constructs a new proxy configuration.- Parameters:
hostAddress- The hostname or IP address of the proxy server (e.g., "proxy.example.com", "192.168.1.1").port- The port number of the proxy server.user- The username for authentication, or null if not required.password- The password for authentication, or null if not required.type- The type of the proxy (e.g.,Proxy.Type.HTTP).
-
HttpProxy
Constructs a new HTTP proxy configuration without authentication.- Parameters:
hostAddress- The hostname or IP address of the proxy server.port- The port number of the proxy server.
-
-
Method Details
-
proxy
Creates aProxyobject from this configuration.- Returns:
- A
Proxyinstance suitable for use with an HTTP client.
-
authenticator
Creates anAuthenticatorfor this proxy configuration. This authenticator adds the 'Proxy-Authorization' header with Basic authentication credentials.- Returns:
- An
Authenticatorinstance.
-