RestHandlerpublic class DeprecationRestHandler extends java.lang.Object implements RestHandler
DeprecationRestHandler provides a proxy for any existing RestHandler so that usage of the handler can be
logged using the DeprecationLogger.| Constructor | Description |
|---|---|
DeprecationRestHandler(RestHandler handler,
java.lang.String deprecationMessage,
DeprecationLogger deprecationLogger) |
Create a
DeprecationRestHandler that encapsulates the handler using the deprecationLogger to log
deprecation warning. |
| Modifier and Type | Method | Description |
|---|---|---|
void |
handleRequest(RestRequest request,
RestChannel channel,
NodeClient client) |
Handles a rest request.
|
static java.lang.String |
requireValidHeader(java.lang.String value) |
Throw an exception if the
value is not a valid header. |
static boolean |
validHeaderValue(java.lang.String value) |
This does a very basic pass at validating that a header's value contains only expected characters according to RFC-5987, and those
that it references.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitcanTripCircuitBreaker, supportsContentStreampublic DeprecationRestHandler(RestHandler handler, java.lang.String deprecationMessage, DeprecationLogger deprecationLogger)
DeprecationRestHandler that encapsulates the handler using the deprecationLogger to log
deprecation warning.handler - The rest handler to deprecate (it's possible that the handler is reused with a different name!)deprecationMessage - The message to warn users with when they use the handlerdeprecationLogger - The deprecation loggerjava.lang.NullPointerException - if any parameter except deprecationMessage is nulljava.lang.IllegalArgumentException - if deprecationMessage is not a valid headerpublic void handleRequest(RestRequest request, RestChannel channel, NodeClient client) throws java.lang.Exception
Usage is logged via the DeprecationLogger so that the actual response can be notified of deprecation as well.
handleRequest in interface RestHandlerrequest - The request to handlechannel - The channel to write the request response toclient - A client to use to make internal requests on behalf of the original requestjava.lang.Exceptionpublic static boolean validHeaderValue(java.lang.String value)
https://tools.ietf.org/html/rfc5987
This is only expected to be used for assertions. The idea is that only readable US-ASCII characters are expected; the rest must be encoded with percent encoding, which makes checking for a valid character range very simple.
value - The header value to checktrue if the value is not obviously wrong.public static java.lang.String requireValidHeader(java.lang.String value)
value is not a valid header.value - The header value to checkvalue.java.lang.IllegalArgumentException - if value is not a valid header.