Class RedirectingAsyncDecorator
- java.lang.Object
-
- org.apache.hc.client5.testing.async.RedirectingAsyncDecorator
-
- All Implemented Interfaces:
org.apache.hc.core5.http.nio.AsyncDataConsumer
,org.apache.hc.core5.http.nio.AsyncDataExchangeHandler
,org.apache.hc.core5.http.nio.AsyncDataProducer
,org.apache.hc.core5.http.nio.AsyncServerExchangeHandler
,org.apache.hc.core5.http.nio.ResourceHolder
public class RedirectingAsyncDecorator extends java.lang.Object implements org.apache.hc.core5.http.nio.AsyncServerExchangeHandler
-
-
Field Summary
Fields Modifier and Type Field Description private org.apache.hc.core5.http.nio.AsyncServerExchangeHandler
exchangeHandler
private java.util.concurrent.atomic.AtomicBoolean
redirecting
private RedirectResolver
redirectResolver
-
Constructor Summary
Constructors Constructor Description RedirectingAsyncDecorator(org.apache.hc.core5.http.nio.AsyncServerExchangeHandler exchangeHandler, RedirectResolver redirectResolver)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description int
available()
void
consume(java.nio.ByteBuffer src)
private org.apache.hc.core5.http.HttpResponse
createRedirectResponse(Redirect redirect)
void
failed(java.lang.Exception cause)
void
handleRequest(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.EntityDetails entityDetails, org.apache.hc.core5.http.nio.ResponseChannel responseChannel, org.apache.hc.core5.http.protocol.HttpContext context)
void
produce(org.apache.hc.core5.http.nio.DataStreamChannel channel)
void
releaseResources()
private Redirect
resolveRedirect(org.apache.hc.core5.http.HttpRequest request)
void
streamEnd(java.util.List<? extends org.apache.hc.core5.http.Header> trailers)
void
updateCapacity(org.apache.hc.core5.http.nio.CapacityChannel capacityChannel)
-
-
-
Field Detail
-
exchangeHandler
private final org.apache.hc.core5.http.nio.AsyncServerExchangeHandler exchangeHandler
-
redirectResolver
private final RedirectResolver redirectResolver
-
redirecting
private final java.util.concurrent.atomic.AtomicBoolean redirecting
-
-
Constructor Detail
-
RedirectingAsyncDecorator
public RedirectingAsyncDecorator(org.apache.hc.core5.http.nio.AsyncServerExchangeHandler exchangeHandler, RedirectResolver redirectResolver)
-
-
Method Detail
-
resolveRedirect
private Redirect resolveRedirect(org.apache.hc.core5.http.HttpRequest request) throws org.apache.hc.core5.http.HttpException
- Throws:
org.apache.hc.core5.http.HttpException
-
createRedirectResponse
private org.apache.hc.core5.http.HttpResponse createRedirectResponse(Redirect redirect)
-
handleRequest
public void handleRequest(org.apache.hc.core5.http.HttpRequest request, org.apache.hc.core5.http.EntityDetails entityDetails, org.apache.hc.core5.http.nio.ResponseChannel responseChannel, org.apache.hc.core5.http.protocol.HttpContext context) throws org.apache.hc.core5.http.HttpException, java.io.IOException
- Specified by:
handleRequest
in interfaceorg.apache.hc.core5.http.nio.AsyncServerExchangeHandler
- Throws:
org.apache.hc.core5.http.HttpException
java.io.IOException
-
updateCapacity
public final void updateCapacity(org.apache.hc.core5.http.nio.CapacityChannel capacityChannel) throws java.io.IOException
- Specified by:
updateCapacity
in interfaceorg.apache.hc.core5.http.nio.AsyncDataConsumer
- Throws:
java.io.IOException
-
consume
public final void consume(java.nio.ByteBuffer src) throws java.io.IOException
- Specified by:
consume
in interfaceorg.apache.hc.core5.http.nio.AsyncDataConsumer
- Throws:
java.io.IOException
-
streamEnd
public final void streamEnd(java.util.List<? extends org.apache.hc.core5.http.Header> trailers) throws org.apache.hc.core5.http.HttpException, java.io.IOException
- Specified by:
streamEnd
in interfaceorg.apache.hc.core5.http.nio.AsyncDataConsumer
- Throws:
org.apache.hc.core5.http.HttpException
java.io.IOException
-
available
public int available()
- Specified by:
available
in interfaceorg.apache.hc.core5.http.nio.AsyncDataProducer
-
produce
public void produce(org.apache.hc.core5.http.nio.DataStreamChannel channel) throws java.io.IOException
- Specified by:
produce
in interfaceorg.apache.hc.core5.http.nio.AsyncDataProducer
- Throws:
java.io.IOException
-
failed
public void failed(java.lang.Exception cause)
- Specified by:
failed
in interfaceorg.apache.hc.core5.http.nio.AsyncDataExchangeHandler
-
releaseResources
public void releaseResources()
- Specified by:
releaseResources
in interfaceorg.apache.hc.core5.http.nio.ResourceHolder
-
-