Interface HttpServer
- All Superinterfaces:
AutoCloseable,HttpComponent<HttpServer>
- All Known Implementing Classes:
NettyHttpServer
Represents a http component which can be bound, receive and handle http messages.
- Since:
- 4.0
-
Method Summary
Modifier and TypeMethodDescriptionaddListener(int port) Binds this http server to the given port on any local address (ipv6 form:::/0) if no other listener is already listening to that port.addListener(@NonNull HostAndPort hostAndPort) Binds this network server to the given host and port if no listener is already listening on the given address.Methods inherited from interface java.lang.AutoCloseable
closeMethods inherited from interface eu.cloudnetservice.driver.network.http.HttpComponent
annotationParser, clearHandlers, httpHandlers, registerHandler, registerHandler, registerHandler, removeHandler, removeHandler, sslEnabled
-
Method Details
-
addListener
Binds this http server to the given port on any local address (ipv6 form:::/0) if no other listener is already listening to that port.- Parameters:
port- the port to which the listener should get bound.- Returns:
- a future completed exceptionally if the bind fails, normally if the bind succeeded.
- Throws:
IllegalArgumentException- if the given port exceeds the port range.
-
addListener
@NonNull @NonNull eu.cloudnetservice.common.concurrent.Task<Void> addListener(@NonNull @NonNull HostAndPort hostAndPort) Binds this network server to the given host and port if no listener is already listening on the given address.- Parameters:
hostAndPort- the address to which a listener should get bound.- Returns:
- a future completed exceptionally if the bind fails, normally if the bind succeeded.
- Throws:
NullPointerException- if the given host and port is null.
-