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 and Description |
---|
DiscoveryResource(DiscoveryContext<T> context) |
Modifier and Type | Method and Description |
---|---|
javax.ws.rs.core.Response |
get(String name,
String id) |
javax.ws.rs.core.Response |
getAll(String name) |
javax.ws.rs.core.Response |
getAllNames() |
javax.ws.rs.core.Response |
getAny(String name) |
javax.ws.rs.core.Response |
getDeprecated(String name,
String id)
Deprecated.
|
javax.ws.rs.core.Response |
putService(ServiceInstance<T> instance,
String name,
String id) |
javax.ws.rs.core.Response |
removeService(String name,
String id) |
public DiscoveryResource(DiscoveryContext<T> context)
public javax.ws.rs.core.Response putService(ServiceInstance<T> instance, String name, String id)
@Deprecated public javax.ws.rs.core.Response getDeprecated(String name, String id)
public javax.ws.rs.core.Response getAllNames()
public javax.ws.rs.core.Response getAll(String name)
public javax.ws.rs.core.Response getAny(String name)
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.