Skip to content

[FEATURE] Create an ExtensionRequestHandler class to pair with NamedRoutes #856

@dbwiddis

Description

@dbwiddis

Is your feature request related to a problem?

In opensearch-project/OpenSearch#7957, the NamedRoute class is being implemented to replace existing extension Route and RouteHandler options. For the security implementation it will be required that Extensions implement this.

One of the builder's required arguments is a handler with type Function<RestRequest, RestResponse>. Extensions are expected to use the ExtensionRestResponse class whose entire reason for existence is to communicate a list of consumed parameters, and a consumed content boolean, to OpenSearch.

Enforcing the ExtensionRestResponse type is most easily done with a subclass, but NamedRoute does not permit inheritance.

What solution would you like?

We can create an ExtensionRequestHandler class which either enforces the ExtensionRestResponse type, or better yet, handles all the checking of consumed params within the SDK and includes some of the "exceptional Response" handling we currently get in the BaseExtensionRestHandler class.

We've already had to special-case consuming params and content on the OpenSearch side of transport for the case of exceptions; we could just make that the default if it's always handled on the SDK side.

What alternatives have you considered?

Lots more type checks in the existing code.

Do you have any additional context?

Some of this may be handled in #622

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions