Skip to content

Cannot visit custom resource on the test endpoint #7

Description

@colonelpopcorn

I'm trying to get this package to work and I got all the way to end of the README. However, when I visit my /admin/test endpoint I get a 404 not found error. From my perspective everything should be working since I can see in my logs that my custom resource was sucessfully registered on the test endpoint. Any ideas?

Screenshot 2023-08-11 at 10 28 49 AM
Screenshot 2023-08-11 at 10 28 05 AM

My custom resource:

package com.example.resources;

import javax.ws.rs.GET;
import javax.ws.rs.Path;

@Path("/test")
public class AdminResource {
    @GET
    public String helloWorld() {
        return "Hello world!";
    }
}

My main class:

package com.example.app;

import com.github.mtakaki.dropwizard.admin.AdminResourceBundle;
import com.example.resources.AdminResource;
import com.example.configuration.AppServiceConfiguration;
import io.dropwizard.jersey.jackson.JacksonBinder;
import io.dropwizard.jersey.setup.JerseyEnvironment;
import io.dropwizard.setup.Environment;

public class IntegrationServiceApplication extends Application<AppServiceConfiguration> {
    private final AdminResourceBundle adminResourceBundle = new AdminResourceBundle();


    public static void main(final String[] args) throws Exception {
        new IntegrationServiceApplication().run(args);
    }

    @Override
    public String getName() {
        return "AppService";
    }

    @Override
    public void initialize(final Bootstrap<AppServiceConfiguration> bootstrap) {
        bootstrap.addBundle(adminResourceBundle);
    }

    @Override
    public void run(final IntegrationServiceConfiguration configuration,
                    final Environment environment) {

        //region AdminResource Setup
        final JerseyEnvironment adminJerseyEnvironment = this.adminResourceBundle
                .getJerseyEnvironment();
        //endregion

        //region API Resources
        final AdminResource adminResource = new AdminResource();
        //endregion
        
        //region Jersey Registration
        adminJerseyEnvironment.register(adminResource);
        //endregion
    }
}

This is on dropwizard@1.3.8, btw.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions