Class DiscoveryResource<T>

java.lang.Object
org.apache.curator.x.discovery.server.rest.DiscoveryResource<T>

public abstract class DiscoveryResource<T> extends Object

The JAX-RS web service. Due to how most JAX-RS implementations are written, you must create a concrete class that extends this using your payload type. The concrete class should have the base path that you'd like to use.

Because the JAX-RS implementation can create a new instance of the resource for every request, your concrete class must use a context resolver to access the DiscoveryContext. Or, if you are using an IoC framework, you can access it that way.

Here's a version that has no payload (i.e. a Void payload):

 @Path("/")
 public class MyResource extends DiscoveryResource<Void> {
     public MyResource(@Context ContextResolver<DiscoveryContext<Void>> resolver) {
         // note: this may not work with all JAX-RS implementations
         super(resolver.getContext(DiscoveryContext.class));
     }
 }
 
  • Constructor Details

  • Method Details

    • putService

      public javax.ws.rs.core.Response putService(ServiceInstance<T> instance, String name, String id)
    • removeService

      public javax.ws.rs.core.Response removeService(String name, String id)
    • getDeprecated

      @Deprecated public javax.ws.rs.core.Response getDeprecated(String name, String id)
      Deprecated.
    • get

      public javax.ws.rs.core.Response get(String name, String id)
    • getAllNames

      public javax.ws.rs.core.Response getAllNames()
    • getAll

      public javax.ws.rs.core.Response getAll(String name)
    • getAny

      public javax.ws.rs.core.Response getAny(String name)