users@jersey.java.net

[Jersey] Jersey REST Resource Config

From: Robert Middleton <osfan6313_at_gmail.com>
Date: Fri, 11 Dec 2015 08:55:56 -0500

Hello,

I'm using Jersey to create a REST-based web service, and I've got a
question as to how to set Jersey up.

My situtation is that I'm using jersey-container-servlet(2.22.1) from maven
central on Tomcat 8. I have an application that looks like the following:

@ApplicationPath( "foo" )
public class MyApplication extends ResourceConfig {

    public MyApplication(){
        //register( new LoggingFilter() );
        property( ServerProperties.PROVIDER_CLASSPATH,
"com.rm5248.testmavenjersey" );
    }
}

This works fine, until I un-comment the first line in the constructor( the
call to register() ). At that point, I get a 404 error whenever I try to
hit any of the REST endpoints. Am I doing something wrong here? From the
documentation that I have read, it seems like this should work.

-Robert Middleton