Multiple Resource Classes for REST using Jersey jax-rs

I have two classes that are given as a resource to a jdk http server: Namenode and Datanode. Both have a different path, as can be seen on these interfaces:

@Path(Namenode.PATH)

public interface Namenode {

static final String PATH="/namenode";

@GET

@Path("/list/")

@Produces(MediaType.APPLICATION_JSON)

List list( @QueryParam("prefix") String prefix);

// 200 OK [empty List]

@GET

@Path("/{name}")

@Produces(MediaType.APPLICATION_JSON)

List read(@PathParam("name") String name);

// 200 OK | 404 Not Found

@POST

@Path("/{name}")

@Consumes(MediaType.APPLICATION_JSON)

void create(@PathParam("name") String name, List blocks);

// 204 No Content | 409 Conflict

@PUT

@Path("/{name}")

@Consumes(MediaType.APPLICATION_JSON)

void update(@PathParam("name") String name, List blocks);

// 204 No Content | 404 Not Found

@DELETE

@Path("/list/")

void delete( @QueryParam("prefix") String prefix);

// 204 No Content | 404 Not Found

}

and

@Path( Datanode.PATH )...

Read More »

By: StackOverFlow - Saturday, 14 April

Related Posts