Package org.stellar.sdk.federation
Class FederationServer
java.lang.Object
org.stellar.sdk.federation.FederationServer
FederationServer handles a network connection to a federation
server instance and exposes an interface for requests to that instance.
For resolving a stellar address without knowing which federation server to query use Federation.resolve(String).
- See Also:
-
Constructor Summary
ConstructorsConstructorDescriptionFederationServer(String serverUri, String domain) Creates a newFederationServerinstance.FederationServer(URI serverUri, String domain) Creates a newFederationServerinstance. -
Method Summary
Modifier and TypeMethodDescriptionstatic FederationServercreateForDomain(String domain) Creates aFederationServerinstance for a given domain.Returns a domain this server is responsible for.okhttp3.HttpUrlReturns a federation server URI.resolveAddress(String address) Resolves a stellar address using a given federation server.
-
Constructor Details
-
FederationServer
Creates a newFederationServerinstance.- Parameters:
serverUri- Federation Server URIdomain- Domain name this federation server is responsible for- Throws:
FederationServerInvalidException- Federation server is invalid (malformed URL, not HTTPS, etc.)
-
FederationServer
Creates a newFederationServerinstance.- Parameters:
serverUri- Federation Server URIdomain- Domain name this federation server is responsible for- Throws:
FederationServerInvalidException- Federation server is invalid (malformed URL, not HTTPS, etc.)
-
-
Method Details
-
createForDomain
Creates aFederationServerinstance for a given domain. It tries to find a federation server URL in stellar.toml file.- Parameters:
domain- Domain to find a federation server for- Returns:
- FederationServer
- Throws:
ConnectionErrorException- Connection problemsNoFederationServerException- Stellar.toml does not contain federation server infoFederationServerInvalidException- Federation server is invalid (malformed URL, not HTTPS, etc.)StellarTomlNotFoundInvalidException- Stellar.toml file was not found or was malformed.- See Also:
-
resolveAddress
Resolves a stellar address using a given federation server.- Parameters:
address- Stellar addres, likebob*stellar.org- Returns:
- FederationResponse
- Throws:
MalformedAddressException- Address is malformedConnectionErrorException- Connection problemsNotFoundException- Stellar address not found by federation serverServerErrorException- Federation server responded with error
-
getServerUri
public okhttp3.HttpUrl getServerUri()Returns a federation server URI. -
getDomain
Returns a domain this server is responsible for.
-