1

It's probably a duplicate of How to deploy a JAX-RS application? but the answer doesn't match the intelliJ fact.

So here the problem :

I have a root class that normally expose n webservices :

@ApplicationPath("/api")
public class API extends Application {

    @Override
    public Set<Class<?>> getClasses() {
        return getRestResourceClasses();
    }

    /**
     * Get the Rest resource classes.
     * @return the rest resource classes
     */
    private Set<Class<?>> getRestResourceClasses() {
        Set<Class<?>> resources = new java.util.HashSet<Class<?>>();
        resources.add(com.xxx.services.AuthService.class);
        ...
        resources.add(com.xxx.services.SimpleService.class);
        resources.add(com.xxx.tools.ResponseCorsFilter.class);
        return resources;
    }
}

and a RESTService class like :

@Path("/math")
@Produces(MediaType.APPLICATION_JSON)
public class SimpleService {

    private static Integer stack;

    @GET
    @Path("/add/{a}/{b}")
    public String add(@PathParam("a") Integer a, @PathParam("b") Integer b) {
        return Integer.toString(a + b);
    }

    @GET
    @Path("/mult/{a}/{b}")
    public String mult(@PathParam("a") Integer a, @PathParam("b") Integer b) {
        return Integer.toString(a * b);
    }

    @PUT
    @Path("/stack")
    public String put(final Integer toStack) {
        stack = toStack;
        return Integer.toString(stack);
    }

}

Normally, after adding a glassfish server like : Debug/Run Configuration

and run the solution with intelliJ, I can access to my webservice like :

http://localhost:8080/mediaweb/api/math/add/2/3

but nothing ... glassfish throw a 404.

but intelliJ still show me all my webservices in the debugger :

Java enterprise tab in intelliJ

How can I debug this ?

Community
  • 1
  • 1
Thomas Leduc
  • 1,092
  • 1
  • 20
  • 44

0 Answers0