Enum ExecutorType
- java.lang.Object
-
- java.lang.Enum<ExecutorType>
-
- net.lenni0451.commons.httpclient.executor.ExecutorType
-
- All Implemented Interfaces:
java.io.Serializable,java.lang.Comparable<ExecutorType>
public enum ExecutorType extends java.lang.Enum<ExecutorType>
-
-
Enum Constant Summary
Enum Constants Enum Constant Description AUTOAutomatically choose the best executor type for the current Java version.
This will try to use the other types in reverse order and use the first one that is available.
e.g. ifHTTP_CLIENTis available it will be used, otherwiseURL_CONNECTIONwill be used.HTTP_CLIENTUse the new HttpClient executor which was added in Java 11.
This implementation is faster than the URLConnection executor and supports HTTP/2.
Sadly the only supported proxy type is HTTP, SOCKS is not supported.URL_CONNECTIONUse the default URLConnection executor.
This is the default executor for Java 10 and below.
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidinit()protected abstract RequestExecutorinitExecutor(HttpClient client)booleanisAvailable()RequestExecutormakeExecutor(HttpClient client)static ExecutorTypevalueOf(java.lang.String name)Returns the enum constant of this type with the specified name.static ExecutorType[]values()Returns an array containing the constants of this enum type, in the order they are declared.
-
-
-
Enum Constant Detail
-
AUTO
public static final ExecutorType AUTO
Automatically choose the best executor type for the current Java version.
This will try to use the other types in reverse order and use the first one that is available.
e.g. ifHTTP_CLIENTis available it will be used, otherwiseURL_CONNECTIONwill be used.
-
URL_CONNECTION
public static final ExecutorType URL_CONNECTION
Use the default URLConnection executor.
This is the default executor for Java 10 and below.
-
HTTP_CLIENT
public static final ExecutorType HTTP_CLIENT
Use the new HttpClient executor which was added in Java 11.
This implementation is faster than the URLConnection executor and supports HTTP/2.
Sadly the only supported proxy type is HTTP, SOCKS is not supported.
-
-
Method Detail
-
values
public static ExecutorType[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:for (ExecutorType c : ExecutorType.values()) System.out.println(c);
- Returns:
- an array containing the constants of this enum type, in the order they are declared
-
valueOf
public static ExecutorType valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)- Parameters:
name- the name of the enum constant to be returned.- Returns:
- the enum constant with the specified name
- Throws:
java.lang.IllegalArgumentException- if this enum type has no constant with the specified namejava.lang.NullPointerException- if the argument is null
-
isAvailable
public final boolean isAvailable()
-
makeExecutor
public final RequestExecutor makeExecutor(HttpClient client)
-
init
protected void init() throws java.lang.Throwable- Throws:
java.lang.Throwable
-
initExecutor
protected abstract RequestExecutor initExecutor(HttpClient client) throws java.lang.Throwable
- Throws:
java.lang.Throwable
-
-