class HttpServer extends Measured
An HTTP and WebSockets server.
You receive HTTP requests by providing a io.vertx.scala.core.http.HttpServer#requestHandler. As requests arrive on the server the handler will be called with the requests.
You receive WebSockets by providing a io.vertx.scala.core.http.HttpServer#websocketHandler. As WebSocket connections arrive on the server, the WebSocket is passed to the handler.
- Alphabetic
- By Inheritance
- HttpServer
- Measured
- AnyRef
- Any
- Hide All
- Show All
- Public
- All
Instance Constructors
- new HttpServer(_asJava: AnyRef)
Value Members
-
final
def
!=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
final
def
##(): Int
- Definition Classes
- AnyRef → Any
-
final
def
==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
actualPort(): Int
The actual port the server is listening on.
The actual port the server is listening on. This is useful if you bound the server specifying 0 as port number signifying an ephemeral port * @return the actual port the server is listening on.
-
final
def
asInstanceOf[T0]: T0
- Definition Classes
- Any
-
def
asJava: AnyRef
- Definition Classes
- HttpServer → Measured
-
def
clone(): AnyRef
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
close(completionHandler: Handler[AsyncResult[Unit]]): Unit
Like io.vertx.scala.core.http.HttpServer#close but supplying a handler that will be called when the server is actually closed (or has failed).
Like io.vertx.scala.core.http.HttpServer#close but supplying a handler that will be called when the server is actually closed (or has failed). * @param completionHandler the handler
-
def
close(): Unit
Close the server.
Close the server. Any open HTTP connections will be closed.
The close happens asynchronously and the server may not be closed until some time after the call has returned.
-
def
closeFuture(): scala.concurrent.Future[Unit]
Like close but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
def
connectionHandler(handler: Handler[HttpConnection]): HttpServer
Set a connection handler for the server.
Set a connection handler for the server. * @return a reference to this, so the API can be used fluently
-
final
def
eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
def
equals(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
-
def
exceptionHandler(handler: Handler[Throwable]): HttpServer
Set an exception handler called for socket errors happening before the HTTP connection is established, e.g during the TLS handshake.
Set an exception handler called for socket errors happening before the HTTP connection is established, e.g during the TLS handshake. * @param handler the handler to set
- returns
a reference to this, so the API can be used fluently
-
def
finalize(): Unit
- Attributes
- protected[java.lang]
- Definition Classes
- AnyRef
- Annotations
- @throws( classOf[java.lang.Throwable] )
-
final
def
getClass(): Class[_]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
def
hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
-
final
def
isInstanceOf[T0]: Boolean
- Definition Classes
- Any
-
def
isMetricsEnabled(): Boolean
Whether the metrics are enabled for this measured object * @return
true
if metrics are enabledWhether the metrics are enabled for this measured object * @return
true
if metrics are enabled- Definition Classes
- HttpServer → Measured
-
def
listen(listenHandler: Handler[AsyncResult[HttpServer]]): HttpServer
Like io.vertx.scala.core.http.HttpServer#listen but supplying a handler that will be called when the server is actually listening (or has failed).
Like io.vertx.scala.core.http.HttpServer#listen but supplying a handler that will be called when the server is actually listening (or has failed). * @param listenHandler the listen handler
-
def
listen(port: Int, listenHandler: Handler[AsyncResult[HttpServer]]): HttpServer
Like io.vertx.scala.core.http.HttpServer#listen but supplying a handler that will be called when the server is actually listening (or has failed).
Like io.vertx.scala.core.http.HttpServer#listen but supplying a handler that will be called when the server is actually listening (or has failed). * @param port the port to listen on
- listenHandler
the listen handler
-
def
listen(port: Int): HttpServer
Like io.vertx.scala.core.http.HttpServer#listen but the server will listen on host "0.0.0.0" and port specified here ignoring any value in the HttpServerOptions that was used when creating the server.
Like io.vertx.scala.core.http.HttpServer#listen but the server will listen on host "0.0.0.0" and port specified here ignoring any value in the HttpServerOptions that was used when creating the server. * @param port the port to listen on
- returns
a reference to this, so the API can be used fluently
-
def
listen(address: SocketAddress, listenHandler: Handler[AsyncResult[HttpServer]]): HttpServer
Tell the server to start listening on the given address supplying a handler that will be called when the server is actually listening (or has failed).
Tell the server to start listening on the given address supplying a handler that will be called when the server is actually listening (or has failed). * @param address the address to listen on
- listenHandler
the listen handler
-
def
listen(port: Int, host: String, listenHandler: Handler[AsyncResult[HttpServer]]): HttpServer
Like io.vertx.scala.core.http.HttpServer#listen but supplying a handler that will be called when the server is actually listening (or has failed).
Like io.vertx.scala.core.http.HttpServer#listen but supplying a handler that will be called when the server is actually listening (or has failed). * @param port the port to listen on
- host
the host to listen on
- listenHandler
the listen handler
-
def
listen(port: Int, host: String): HttpServer
Tell the server to start listening.
Tell the server to start listening. The server will listen on the port and host specified here, ignoring any value set in the HttpServerOptions that was used when creating the server.
The listen happens asynchronously and the server may not be listening until some time after the call has returned. * @param port the port to listen on
- host
the host to listen on
- returns
a reference to this, so the API can be used fluently
-
def
listen(): HttpServer
Tell the server to start listening.
Tell the server to start listening. The server will listen on the port and host specified in the HttpServerOptions that was used when creating the server.
The listen happens asynchronously and the server may not be listening until some time after the call has returned. * @return a reference to this, so the API can be used fluently
-
def
listenFuture(): scala.concurrent.Future[HttpServer]
Like listen but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
def
listenFuture(port: Int): scala.concurrent.Future[HttpServer]
Like listen but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
def
listenFuture(address: SocketAddress): scala.concurrent.Future[HttpServer]
Like listen but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
def
listenFuture(port: Int, host: String): scala.concurrent.Future[HttpServer]
Like listen but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.
-
final
def
ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
-
final
def
notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
final
def
notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
-
def
requestHandler(handler: Handler[HttpServerRequest]): HttpServer
Set the request handler for the server to
requestHandler
.Set the request handler for the server to
requestHandler
. As HTTP requests are received by the server, instances of io.vertx.scala.core.http.HttpServerRequest will be created and passed to this handler. * @return a reference to this, so the API can be used fluently -
def
requestStream(): ReadStream[HttpServerRequest]
Return the request stream for the server.
Return the request stream for the server. As HTTP requests are received by the server, instances of io.vertx.scala.core.http.HttpServerRequest will be created and passed to the stream . * @return the request stream
-
final
def
synchronized[T0](arg0: ⇒ T0): T0
- Definition Classes
- AnyRef
-
def
toString(): String
- Definition Classes
- AnyRef → Any
-
final
def
wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws( ... )
-
final
def
wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @native() @throws( ... )
-
def
websocketHandler(handler: Handler[ServerWebSocket]): HttpServer
Set the websocket handler for the server to
wsHandler
.Set the websocket handler for the server to
wsHandler
. If a websocket connect handshake is successful a new io.vertx.scala.core.http.ServerWebSocket instance will be created and passed to the handler. * @return a reference to this, so the API can be used fluently -
def
websocketStream(): ReadStream[ServerWebSocket]
Return the websocket stream for the server.
Return the websocket stream for the server. If a websocket connect handshake is successful a new io.vertx.scala.core.http.ServerWebSocket instance will be created and passed to the stream . * @return the websocket stream