Enabling the Jersey declarative linking feature for the application

Once you have the appropriate dependency set up, the next step is to enable the declarative linking feature by registering the org.glassfish.jersey.linking.DeclarativeLinkingFeature class with the application. You can do this via the org.glassfish.jersey.server.ResourceConfig class, as shown in the following code snippet:

//Other imports are omitted for brevity 
import org.glassfish.jersey.server.ResourceConfig; 
import org.glassfish.jersey.linking.DeclarativeLinkingFeature;  
@Provider 
@javax.ws.rs.ApplicationPath("webresources") 
public class ApplicationConfig extends ResourceConfig { 
  public ApplicationConfig() { 
    // Register a class of JAX-RS component 
    register(DeclarativeLinkingFeature.class); 
    //Package that needs to be scanned for other resource 
    packages("com.packtpub.rest.ch5.service"); 
  } 
} 
..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.144.91.47