@Provider public class StringDiscoveryContext extends Object implements DiscoveryContext<String>, javax.ws.rs.ext.ContextResolver<DiscoveryContext<String>>
DiscoveryContext
that uses a string as the
payloadConstructor and Description |
---|
StringDiscoveryContext(ServiceDiscovery<String> serviceDiscovery,
ProviderStrategy<String> providerStrategy,
int instanceRefreshMs) |
Modifier and Type | Method and Description |
---|---|
DiscoveryContext<String> |
getContext(Class<?> type) |
int |
getInstanceRefreshMs()
Return the threshold in milliseconds to consider a registration stale
|
ProviderStrategy<String> |
getProviderStrategy()
Return the provider strategy to use for
DiscoveryResource.getAny(String) |
ServiceDiscovery<String> |
getServiceDiscovery()
Return the service singleton
|
void |
marshallJson(com.fasterxml.jackson.databind.node.ObjectNode node,
String fieldName,
String payload)
Serialize your payload
|
String |
unMarshallJson(com.fasterxml.jackson.databind.JsonNode node)
Deserialize your payload
|
public StringDiscoveryContext(ServiceDiscovery<String> serviceDiscovery, ProviderStrategy<String> providerStrategy, int instanceRefreshMs)
public ProviderStrategy<String> getProviderStrategy()
DiscoveryContext
DiscoveryResource.getAny(String)
getProviderStrategy
in interface DiscoveryContext<String>
public int getInstanceRefreshMs()
DiscoveryContext
getInstanceRefreshMs
in interface DiscoveryContext<String>
public ServiceDiscovery<String> getServiceDiscovery()
DiscoveryContext
getServiceDiscovery
in interface DiscoveryContext<String>
public void marshallJson(com.fasterxml.jackson.databind.node.ObjectNode node, String fieldName, String payload) throws Exception
DiscoveryContext
marshallJson
in interface DiscoveryContext<String>
node
- the node to serialize intofieldName
- field name to usepayload
- the payload value (can be null)Exception
- any errorspublic String unMarshallJson(com.fasterxml.jackson.databind.JsonNode node) throws Exception
DiscoveryContext
unMarshallJson
in interface DiscoveryContext<String>
node
- the node that has the payloadException
- any errorspublic DiscoveryContext<String> getContext(Class<?> type)
getContext
in interface javax.ws.rs.ext.ContextResolver<DiscoveryContext<String>>
Copyright © 2011–2023 The Apache Software Foundation. All rights reserved.