Class BaseRestHandler

    • Field Detail


        public static final Setting<java.lang.Boolean> MULTI_ALLOW_EXPLICIT_INDEX

        public static final java.lang.String INCLUDE_TYPE_NAME_PARAMETER
        Parameter that controls whether certain REST apis should include type names in their requests or responses. Note: Support for this parameter will be removed after the transition period to typeless APIs.
        See Also:
        Constant Field Values

        public static final boolean DEFAULT_INCLUDE_TYPE_NAME_POLICY
        See Also:
        Constant Field Values
    • Constructor Detail

      • BaseRestHandler

        protected BaseRestHandler​(Settings settings)
    • Method Detail

      • getUsageCount

        public final long getUsageCount()
      • getName

        public abstract java.lang.String getName()
        the name of this handler. The name should be human readable and should describe the action that will performed when this API is called. This name is used in the response to the RestNodesUsageAction.
      • handleRequest

        public final void handleRequest​(RestRequest request,
                                        RestChannel channel,
                                        NodeClient client)
                                 throws java.lang.Exception
        Description copied from interface: RestHandler
        Handles a rest request.
        Specified by:
        handleRequest in interface RestHandler
        request - The request to handle
        channel - The channel to write the request response to
        client - A client to use to make internal requests on behalf of the original request
      • unrecognized

        protected final java.lang.String unrecognized​(RestRequest request,
                                                      java.util.Set<java.lang.String> invalids,
                                                      java.util.Set<java.lang.String> candidates,
                                                      java.lang.String detail)
      • prepareRequest

        protected abstract BaseRestHandler.RestChannelConsumer prepareRequest​(RestRequest request,
                                                                              NodeClient client)
        Prepare the request for execution. Implementations should consume all request params before returning the runnable for actual execution. Unconsumed params will immediately terminate execution of the request. However, some params are only used in processing the response; implementations can override responseParams() to indicate such params.
        request - the request to execute
        client - client for executing actions on the local node
        the action to execute
        Throws: - if an I/O exception occurred parsing the request and preparing for execution
      • responseParams

        protected java.util.Set<java.lang.String> responseParams()
        Parameters used for controlling the response and thus might not be consumed during preparation of the request execution in prepareRequest(RestRequest, NodeClient).
        a set of parameters used to control the response and thus should not trip strict URL parameter checks.