When you create a Web service using Netbeans function, did not create a bug ApplicationConfig.java class

All examples and tutorials I found online are explained Netbeans will automatically generate an extended Application of ApplicationConfig.java class, and by @ApplicationPath comment on the edit such that I can configure the URI Web service URI where will have access. In fact, if I have to start from scratch to create a new Java EE applications, and then call from New Patterns in -> RESTful Web Services, this is how it works. But when I use my Netbeans project being developed to try, do not create ApplicationConfig.java.

 

You can add your own

package server;

import java.util.Set;
import javax.ws.rs.core.Application;

/**
 *
 * @author hb
 */
@javax.ws.rs.ApplicationPath("webresources")
public class ApplicationConfig extends Application {

    @Override
    public Set<Class<?>> getClasses() {
        Set<Class<?>> resources = new java.util.HashSet<>();
        addRestResourceClasses(resources);
        return resources;
    }

    /**
     * Do not modify addRestResourceClasses() method.
     * It is automatically populated with
     * all resources defined in the project.
     * If required, comment out calling this method in getClasses().
     */
    private void addRestResourceClasses(Set<Class<?>> resources) {
        resources.add(server.GenericResource.class);
    }
    
}

 

The original question:

https://answer-id.com/37056220

BUG:

https://netbeans.org/bugzilla/show_bug.cgi?id=245331

Guess you like

Origin www.cnblogs.com/ppCola/p/11257569.html