public abstract class RestServerEndpoint extends Object implements AutoCloseableAsync
Modifier and Type | Class and Description |
---|---|
static class |
RestServerEndpoint.RestHandlerUrlComparator
Comparator for Rest URLs.
|
Modifier and Type | Field and Description |
---|---|
protected org.slf4j.Logger |
log |
protected Map<String,String> |
responseHeaders |
protected Path |
uploadDir |
Constructor and Description |
---|
RestServerEndpoint(RestServerEndpointConfiguration configuration) |
Modifier and Type | Method and Description |
---|---|
CompletableFuture<Void> |
closeAsync()
Trigger the closing of the resource and return the corresponding close future.
|
String |
getRestBaseUrl()
Returns the base URL of the REST server endpoint.
|
InetSocketAddress |
getServerAddress()
Returns the address on which this endpoint is accepting requests.
|
protected abstract List<Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>> |
initializeHandlers(CompletableFuture<String> localAddressFuture)
This method is called at the beginning of
start() to setup all handlers that the
REST server endpoint implementation requires. |
protected CompletableFuture<Void> |
shutDownInternal()
Stops this REST server endpoint.
|
void |
start()
Starts this REST server endpoint.
|
protected abstract void |
startInternal()
Hook to start sub class specific services.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close
protected final org.slf4j.Logger log
protected final Path uploadDir
public RestServerEndpoint(RestServerEndpointConfiguration configuration) throws IOException
IOException
protected abstract List<Tuple2<RestHandlerSpecification,org.apache.flink.shaded.netty4.io.netty.channel.ChannelInboundHandler>> initializeHandlers(CompletableFuture<String> localAddressFuture)
start()
to setup all handlers that the
REST server endpoint implementation requires.localAddressFuture
- future rest address of the RestServerEndpointpublic final void start() throws Exception
Exception
- if we cannot start the RestServerEndpointprotected abstract void startInternal() throws Exception
Exception
- if an error occurred@Nullable public InetSocketAddress getServerAddress()
public String getRestBaseUrl()
public CompletableFuture<Void> closeAsync()
AutoCloseableAsync
closeAsync
in interface AutoCloseableAsync
protected CompletableFuture<Void> shutDownInternal()
Copyright © 2014–2021 The Apache Software Foundation. All rights reserved.