Is your feature request related to a problem?
In https://github.com/opensearch-project/opensearch-sdk-java/blob/main/src/main/java/org/opensearch/sdk/sample/rest/RestHelloAction.java#L37 the developer has to implement a handleRequest that acts as a router that checks for methods, e.g.
if (Method.GET.equals(method) && "/hello".equals(uri)) {
return new BytesRestResponse(OK, GREETING);
}
This is unnecessarily verbose.
What solution would you like?
Provide a higher level implementation that implements ExtensionRestHandler . As a developer I would like to write something shorter:
public class RestHelloAction extends GenericExtensionRestHandler {
@Override
public List<Route> routes() {
return singletonList(
new RouteHandler(GET, "/hello", this.handleHello),
new RouteHandler(GET, "/world", this.handleWorld)
);
}
public RestResponse handleHello(...) {
}
public RestResponse handleWorld(...) {
}
}
Alternatives?
There might be an HTTP handler library that provides routing out of the box that we could optionally plug in, e.g. https://github.com/undertow-io/undertow like so.
Is your feature request related to a problem?
In https://github.com/opensearch-project/opensearch-sdk-java/blob/main/src/main/java/org/opensearch/sdk/sample/rest/RestHelloAction.java#L37 the developer has to implement a
handleRequestthat acts as a router that checks for methods, e.g.This is unnecessarily verbose.
What solution would you like?
Provide a higher level implementation that implements
ExtensionRestHandler. As a developer I would like to write something shorter:Alternatives?
There might be an HTTP handler library that provides routing out of the box that we could optionally plug in, e.g. https://github.com/undertow-io/undertow like so.