Package net.shibboleth.utilities.java.support.httpclient

# Class HttpClientSupport

java.lang.Object
net.shibboleth.utilities.java.support.httpclient.HttpClientSupport

@Deprecated(since="9.0.0", forRemoval=true) public final class HttpClientSupport extends Object
Deprecated, for removal: This API element is subject to removal in a future version.
Old support class for using `HttpClient` and related components.

Replaced by `HttpClientSupport`.

## Constructor Summary

Constructors
Modifier
Constructor
Description
`private`
`HttpClientSupport()`
Deprecated, for removal: This API element is subject to removal in a future version.
Constructor to prevent instantiation.

## Method Summary

Modifier and Type
Method
Description
`static void`
`addDynamicContextHandlerFirst(org.apache.hc.client5.http.protocol.HttpClientContext context, HttpClientContextHandler handler)`
Deprecated, for removal: This API element is subject to removal in a future version.
Add the specified instance of `HttpClientContextHandler` to the `HttpClientContext` in the first handler list position.
`static void`
`addDynamicContextHandlerFirst(org.apache.hc.client5.http.protocol.HttpClientContext context, HttpClientContextHandler handler, boolean uniqueType)`
Deprecated, for removal: This API element is subject to removal in a future version.
Add the specified instance of `HttpClientContextHandler` to the `HttpClientContext` in the first handler list position.
`static void`
`addDynamicContextHandlerLast(org.apache.hc.client5.http.protocol.HttpClientContext context, HttpClientContextHandler handler)`
Deprecated, for removal: This API element is subject to removal in a future version.
Add the specified instance of `HttpClientContextHandler` to the `HttpClientContext` in the last handler list position.
`static void`
`addDynamicContextHandlerLast(org.apache.hc.client5.http.protocol.HttpClientContext context, HttpClientContextHandler handler, boolean uniqueType)`
Deprecated, for removal: This API element is subject to removal in a future version.
Add the specified instance of `HttpClientContextHandler` to the `HttpClientContext` in the last handler list position.
`static org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory`
`buildNoTrustTLSSocketFactory()`
Deprecated, for removal: This API element is subject to removal in a future version.
Build a TLS-capable instance of `LayeredConnectionSocketFactory` which accepts all peer certificates and performs no hostname verification.
`static X509TrustManager`
`buildNoTrustX509TrustManager()`
Deprecated, for removal: This API element is subject to removal in a future version.
Build an instance of `X509TrustManager` which trusts all certificates.
`static org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory`
`buildStrictTLSSocketFactory()`
Deprecated, for removal: This API element is subject to removal in a future version.
Build an instance of TLS-capable `LayeredConnectionSocketFactory` which uses the standard JSSE default `SSLContext` and which performs strict hostname verification.
`private static void`
`deprecation()`
Deprecated, for removal: This API element is subject to removal in a future version.
Log deprecation warning.
`static List<HttpClientContextHandler>`
`getDynamicContextHandlerList(org.apache.hc.client5.http.protocol.HttpClientContext context)`
Deprecated, for removal: This API element is subject to removal in a future version.
Get the list of `HttpClientContextHandler` for the `HttpClientContext`.
`static String`
`toString(org.apache.hc.core5.http.HttpEntity entity, int maxLength)`
Deprecated, for removal: This API element is subject to removal in a future version.
Read the contents of an entity and return it as a String.
`static String`
`toString(org.apache.hc.core5.http.HttpEntity entity, String defaultCharset, int maxLength)`
Deprecated, for removal: This API element is subject to removal in a future version.
Get the entity content as a String, using the provided default character set if none is found in the entity.
`static String`
`toString(org.apache.hc.core5.http.HttpEntity entity, Charset defaultCharset, int maxLength)`
Deprecated, for removal: This API element is subject to removal in a future version.
Get the entity content as a String, using the provided default character set if none is found in the entity.

### Methods inherited from class java.lang.Object

`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Details

### HttpClientSupport

private HttpClientSupport()
Deprecated, for removal: This API element is subject to removal in a future version.
Constructor to prevent instantiation.

## Method Details

### deprecation

private static void deprecation()
Deprecated, for removal: This API element is subject to removal in a future version.
Log deprecation warning.

### buildStrictTLSSocketFactory

@Nonnull public static org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory buildStrictTLSSocketFactory()
Deprecated, for removal: This API element is subject to removal in a future version.
Build an instance of TLS-capable `LayeredConnectionSocketFactory` which uses the standard JSSE default `SSLContext` and which performs strict hostname verification.

Returns:
  a new instance of HttpClient SSL connection socket factory

### buildNoTrustTLSSocketFactory

@Nonnull public static org.apache.hc.client5.http.socket.LayeredConnectionSocketFactory buildNoTrustTLSSocketFactory()
Deprecated, for removal: This API element is subject to removal in a future version.
Build a TLS-capable instance of `LayeredConnectionSocketFactory` which accepts all peer certificates and performs no hostname verification.

Returns:
  a new instance of HttpClient SSL connection socket factory

### buildNoTrustX509TrustManager

@Nonnull public static X509TrustManager buildNoTrustX509TrustManager()
Deprecated, for removal: This API element is subject to removal in a future version.
Build an instance of `X509TrustManager` which trusts all certificates.

Returns:
  a new trust manager instance

### getDynamicContextHandlerList

@Nonnull public static List<HttpClientContextHandler> getDynamicContextHandlerList(@Nonnull org.apache.hc.client5.http.protocol.HttpClientContext context)
Deprecated, for removal: This API element is subject to removal in a future version.
Get the list of `HttpClientContextHandler` for the `HttpClientContext`.

Parameters:
  `context` - the client context
Returns:
  the handler list

### addDynamicContextHandlerFirst

public static void addDynamicContextHandlerFirst(@Nonnull org.apache.hc.client5.http.protocol.HttpClientContext context, @Nonnull HttpClientContextHandler handler)
Deprecated, for removal: This API element is subject to removal in a future version.
Add the specified instance of `HttpClientContextHandler` to the `HttpClientContext` in the first handler list position.

Parameters:
  `context` - the client context
  `handler` - the handler to add

### addDynamicContextHandlerFirst

public static void addDynamicContextHandlerFirst(@Nonnull org.apache.hc.client5.http.protocol.HttpClientContext context, @Nonnull HttpClientContextHandler handler, boolean uniqueType)
Deprecated, for removal: This API element is subject to removal in a future version.
Add the specified instance of `HttpClientContextHandler` to the `HttpClientContext` in the first handler list position.

Parameters:
  `context` - the client context
  `handler` - the handler to add
  `uniqueType` - whether to only add the handler if an instance of its (exact) class is not already present

### addDynamicContextHandlerLast

public static void addDynamicContextHandlerLast(@Nonnull org.apache.hc.client5.http.protocol.HttpClientContext context, @Nonnull HttpClientContextHandler handler)
Deprecated, for removal: This API element is subject to removal in a future version.
Add the specified instance of `HttpClientContextHandler` to the `HttpClientContext` in the last handler list position.

Parameters:
  `context` - the client context
  `handler` - the handler to add

### addDynamicContextHandlerLast

public static void addDynamicContextHandlerLast(@Nonnull org.apache.hc.client5.http.protocol.HttpClientContext context, @Nonnull HttpClientContextHandler handler, boolean uniqueType)
Deprecated, for removal: This API element is subject to removal in a future version.
Add the specified instance of `HttpClientContextHandler` to the `HttpClientContext` in the last handler list position.

Parameters:
  `context` - the client context
  `handler` - the handler to add
  `uniqueType` - whether to only add the handler if an instance of its (exact) class is not already present

### toString

@Nullable public static String toString(@Nonnull org.apache.hc.core5.http.HttpEntity entity, @Nullable Charset defaultCharset, int maxLength) throws IOException, org.apache.hc.core5.http.ParseException
Deprecated, for removal: This API element is subject to removal in a future version.
Get the entity content as a String, using the provided default character set if none is found in the entity.

If defaultCharset is null, the default "ISO-8859-1" is used.

Parameters:
  `entity` - must not be null
  `defaultCharset` - character set to be applied if none found in the entity
  `maxLength` - limit on size of content
Returns:
  the entity content as a String. May be null if `HttpEntity.getContent()` is null.
Throws:
  `org.apache.hc.core5.http.ParseException` - if header elements cannot be parsed
  `IOException` - if an error occurs reading the input stream, or the size exceeds limits
  `UnsupportedCharsetException` - when the content's charset is not available

### toString

@Nullable public static String toString(@Nonnull org.apache.hc.core5.http.HttpEntity entity, @Nullable String defaultCharset, int maxLength) throws IOException, org.apache.hc.core5.http.ParseException
Deprecated, for removal: This API element is subject to removal in a future version.
Get the entity content as a String, using the provided default character set if none is found in the entity. If defaultCharset is null, the default "ISO-8859-1" is used.

Parameters:
  `entity` - must not be null
  `defaultCharset` - character set to be applied if none found in the entity
  `maxLength` - limit on size of content
Returns:
  the entity content as a String. May be null if `HttpEntity.getContent()` is null.
Throws:
  `org.apache.hc.core5.http.ParseException` - if header elements cannot be parsed
  `IOException` - if an error occurs reading the input stream, or the size exceeds limits
  `UnsupportedCharsetException` - when the content's charset is not available

### toString

@Nullable public static String toString(@Nonnull org.apache.hc.core5.http.HttpEntity entity, int maxLength) throws IOException, org.apache.hc.core5.http.ParseException
Deprecated, for removal: This API element is subject to removal in a future version.
Read the contents of an entity and return it as a String. The content is converted using the character set from the entity (if any), failing that, "ISO-8859-1" is used.

Parameters:
  `entity` - the entity to convert to a string; must not be null
  `maxLength` - limit on size of content
Returns:
  the entity content as a String. May be null if `HttpEntity.getContent()` is null.
Throws:
  `org.apache.hc.core5.http.ParseException` - if header elements cannot be parsed
  `IOException` - if an error occurs reading the input stream, or the size exceeds limits
  `UnsupportedCharsetException` - when the content's charset is not available