Skip to content

Custom Http Handlers don't work anymore with latest v23.1.2-SNAPSHOT #798

@vic0824

Description

@vic0824

ArcadeDB Version: v23.1.2-SNAPSHOT (build 45102bd/1674545889139/main)

JDK Version: openjdk 11.0.12 2021-07-20 LTS

OS: CentOS release 6.9 (Final)

Expected behavior

Custom handlers continue to work as before

Actual behavior

Custom handlers are not invoked: the server returns a 404 response for any request sent to the endpoint configured for a custom handler

Steps to reproduce

  1. Create a class that implements the ServerPlugin interface
  2. Follow the instructions contained in the ArcadeDB manual to implement the registerAPI method
  3. Follow the instructions contained in the ArcadeDB manual to create a custom Http Handler
  4. start the server
  5. send a request to the endpoint configured in the custom handler
  6. verify that the server responds with a 404

This is the test plugin I have used:

public class OrchestratorPlugin implements ServerPlugin {

    @Override
    public void startService() {

    }

    @Override
    public void registerAPI(HttpServer httpServer, final PathHandler routes) {
        final RoutingHandler orchestratorRoutes = Handlers.routing();
        routes.addPrefixPath("/orchestrator", orchestratorRoutes.get("/test", new TestHandler(httpServer)));
    }
}

This is the test Http Handler I have used:

public class TestHandler extends AbstractHandler {
    public TestHandler(HttpServer httpServer) {
        super(httpServer);
    }

    @Override
    protected void execute(HttpServerExchange exchange, ServerSecurityUser user) throws Exception {
        exchange.getResponseHeaders().put(Headers.CONTENT_TYPE, "application/json");
        JSONObject jsonObject = new JSONObject();
        jsonObject.put("result", "ok");
        String body = jsonObject.toString();
        exchange.setStatusCode(200);
        exchange.getResponseSender().send(body);
    }

The log messages show that the plugin has been loaded, but when I send the following request:
http://192.168.163.128:8080/orchestrator/test
I get a 404 response.
The server correctly returns my static content (placed on the classpath), which is handled by the fallback handler. The following request:
http://192.168.163.128:8080/supervisor
is handled correctly (the html page is displayed).
Requests sent to the configured prefix (in my case "/orchestrator") are not handled

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions