Class HttpAuthorizationHandler
- java.lang.Object
-
- net.webpdf.wsclient.session.connection.http.HttpAuthorizationHandler
-
- All Implemented Interfaces:
HttpExecChainHandler,org.apache.hc.client5.http.classic.ExecChainHandler
public class HttpAuthorizationHandler extends Object implements HttpExecChainHandler
An instance of
HttpAuthorizationHandlermay be used for aClassicHttpRequestas aExecChainHandlerto provide authorization in the context of theExecChain.
-
-
Constructor Summary
Constructors Constructor Description HttpAuthorizationHandler(@NotNull Session session)Instantiates a newHttpAuthorizationHandlerfor a givenSession.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description org.apache.hc.core5.http.ClassicHttpResponseexecute(@NotNull org.apache.hc.core5.http.ClassicHttpRequest classicHttpRequest, org.apache.hc.client5.http.classic.ExecChain.Scope scope, @NotNull org.apache.hc.client5.http.classic.ExecChain execChain)When this method is called theHttpAuthorizationHandleracts as aExecChainHandlerin the context of aExecChain.@NotNull StringgetExecChainHandlerName()Provides a name for theHttpAuthorizationHandlerin the context of aExecChain.
-
-
-
Constructor Detail
-
HttpAuthorizationHandler
public HttpAuthorizationHandler(@NotNull @NotNull Session session)Instantiates a newHttpAuthorizationHandlerfor a givenSession.- Parameters:
session- TheSessionto provide authorization for.
-
-
Method Detail
-
execute
public org.apache.hc.core5.http.ClassicHttpResponse execute(@NotNull @NotNull org.apache.hc.core5.http.ClassicHttpRequest classicHttpRequest, @NotNull org.apache.hc.client5.http.classic.ExecChain.Scope scope, @NotNull @NotNull org.apache.hc.client5.http.classic.ExecChain execChain) throws IOException, org.apache.hc.core5.http.HttpExceptionWhen this method is called the
HttpAuthorizationHandleracts as aExecChainHandlerin the context of aExecChain. It will check whether the given request contains anHttpHeaders.AUTHORIZATIONHeaderand in case it is missing it shall provide such aHeaderaccording to the provided and activeSession.- Specified by:
executein interfaceorg.apache.hc.client5.http.classic.ExecChainHandler- Parameters:
classicHttpRequest- the actual request.scope- the execution scope.execChain- the next element in the request execution chain.- Throws:
IOExceptionorg.apache.hc.core5.http.HttpException
-
getExecChainHandlerName
@NotNull public @NotNull String getExecChainHandlerName()
Provides a name for theHttpAuthorizationHandlerin the context of aExecChain.- Specified by:
getExecChainHandlerNamein interfaceHttpExecChainHandler- Returns:
- A name for the
HttpAuthorizationHandlerin the context of aExecChain.
-
-