vertx-lang-scala-docs_2.12 3.6.0 API < Back
 

# Packages

-  package root
  Definition Classes
    root
-  package io
  Definition Classes
    root
-  package vertx
  Definition Classes
    io
-  package scala
  Definition Classes
    vertx
-  package core
  Definition Classes
    scala
-  package http
  Definition Classes
    core
- GoAway
- Http2Settings
- HttpClient
- HttpClientOptions
- HttpClientRequest
- HttpClientResponse
- HttpConnection
- HttpFrame
- HttpServer
- HttpServerFileUpload
- HttpServerOptions
- HttpServerRequest
- HttpServerResponse
- RequestOptions
- ServerWebSocket
- StreamPriority
- WebSocket
- WebSocketBase
- WebSocketFrame

c

io.vertx.scala.core.http

# HttpServer 

###
Companion object HttpServer

#### 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.

Linear Supertypes
Measured, AnyRef, Any
 
Ordering

1. Alphabetic
2. By Inheritance

Inherited

1. HttpServer
2. Measured
3. AnyRef
4. Any

1. Hide All
2. Show All

Visibility

1. Public
2. All

### Instance Constructors

1.  new HttpServer(_asJava: AnyRef)

### Value Members

1.  final def !=(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
2.  final def ##(): Int
   Definition Classes
     AnyRef → Any
3.  final def ==(arg0: Any): Boolean
   Definition Classes
     AnyRef → Any
4.  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.

5.  final def asInstanceOf[T0]: T0
   Definition Classes
     Any
6.  def asJava: AnyRef
   Definition Classes
     HttpServer → Measured
7.  def clone(): AnyRef
   Attributes
     protected[java.lang]
   Definition Classes
     AnyRef
   Annotations
     @native() @throws( ... )
8.  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

9.  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.

10.  def closeFuture(): scala.concurrent.Future[Unit]

    Like close but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

11.  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

12.  final def eq(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
13.  def equals(arg0: Any): Boolean
    Definition Classes
      AnyRef → Any
14.  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

15.  def finalize(): Unit
    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )
16.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
17.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
    Annotations
      @native()
18.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
19.  def isMetricsEnabled(): Boolean

    Whether the metrics are enabled for this measured object * @return `true` if metrics are enabled

    Whether the metrics are enabled for this measured object * @return `true` if metrics are enabled

    Definition Classes
      HttpServer → Measured
20.  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

21.  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

22.  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

23.  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

24.  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

25.  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

26.  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

27.  def listenFuture(): scala.concurrent.Future[HttpServer]

    Like listen but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

28.  def listenFuture(port: Int): scala.concurrent.Future[HttpServer]

    Like listen but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

29.  def listenFuture(address: SocketAddress): scala.concurrent.Future[HttpServer]

    Like listen but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

30.  def listenFuture(port: Int, host: String): scala.concurrent.Future[HttpServer]

    Like listen but returns a scala.concurrent.Future instead of taking an AsyncResultHandler.

31.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
32.  final def notify(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
33.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
    Annotations
      @native()
34.  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

35.  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

36.  final def synchronized[T0](arg0: ⇒ T0): T0
    Definition Classes
      AnyRef
37.  def toString(): String
    Definition Classes
      AnyRef → Any
38.  final def wait(): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
39.  final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
      AnyRef
    Annotations
      @throws( ... )
40.  final def wait(arg0: Long): Unit
    Definition Classes
      AnyRef
    Annotations
      @native() @throws( ... )
41.  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

42.  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

### Inherited from Measured

### Inherited from AnyRef

### Inherited from Any

### Ungrouped