Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Dropwizard : New admin resource

I'm using Drowpizard 0.7.1, but perhaps I will upgrade to 0.8.4 very soon.

Does anyone know how to add a admin resource to dropwizard, that is shown in Operational Menu like the example below?

Operational Menu

    Metrics
    Ping
    Threads
    Healthcheck
    CustomAdminXy
like image 360
heaphach Avatar asked Sep 24 '15 14:09

heaphach


1 Answers

I don't think you can do this easily.

The AdminServlet is created when the ServerFactory is built. It may be possible to extend DefaultServerFactory and override createAdminServlet to create a custom Admin servlet with your links etc... (You would then have to set your server factory via configuration.)

It seems like this would involve some duplication of code and could be quite fragile.

It might be easier to just register your own admin servlet (in addition to the regular one), e.g.:

environment.admin().addServlet("custom-admin", new CustomAdminServlet())
    .addMapping("/custom-admin");

Probably not ideal either.

like image 131
Jonathan Avatar answered Sep 21 '22 03:09

Jonathan