Class RandomHandler
java.lang.Object
org.apache.hc.client5.testing.classic.RandomHandler
- All Implemented Interfaces:
org.apache.hc.core5.http.io.HttpRequestHandler
A handler that generates random data.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
An entity that generates random data. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
handle
(org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.ClassicHttpResponse response, org.apache.hc.core5.http.protocol.HttpContext context) Handles a request by generating random data.
-
Constructor Details
-
RandomHandler
public RandomHandler()
-
-
Method Details
-
handle
public void handle(org.apache.hc.core5.http.ClassicHttpRequest request, org.apache.hc.core5.http.ClassicHttpResponse response, org.apache.hc.core5.http.protocol.HttpContext context) throws org.apache.hc.core5.http.HttpException, IOException Handles a request by generating random data. The length of the response can be specified in the request URI as a number after the last /. For example /random/whatever/20 will generate 20 random bytes in the printable ASCII range. If the request URI ends with /, a random number of random bytes is generated, but at least one.- Specified by:
handle
in interfaceorg.apache.hc.core5.http.io.HttpRequestHandler
- Parameters:
request
- the requestresponse
- the responsecontext
- the context- Throws:
org.apache.hc.core5.http.HttpException
- in case of a problemIOException
- in case of an IO problem
-