vertx-lang-scala-docs_2.12 3.4.2 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
- 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

   returns

     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
     @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).

   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.

    returns

      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 finalize(): Unit
    Attributes
      protected[java.lang]
    Definition Classes
      AnyRef
    Annotations
      @throws( classOf[java.lang.Throwable] )
15.  final def getClass(): Class[_]
    Definition Classes
      AnyRef → Any
16.  def hashCode(): Int
    Definition Classes
      AnyRef → Any
17.  final def isInstanceOf[T0]: Boolean
    Definition Classes
      Any
18.  def isMetricsEnabled(): Boolean

    Whether the metrics are enabled for this measured object

    Whether the metrics are enabled for this measured object

    returns

      true if the metrics are enabled

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

    listenHandler

      the listen handler

20.  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).

    port

      the port to listen on

    listenHandler

      the listen handler

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

    port

      the port to listen on

    returns

      a reference to this, so the API can be used fluently

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

    port

      the port to listen on

    host

      the host to listen on

    listenHandler

      the listen handler

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

    port

      the port to listen on

    host

      the host to listen on

    returns

      a reference to this, so the API can be used fluently

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

    returns

      a reference to this, so the API can be used fluently

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

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

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

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

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

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

28.  final def ne(arg0: AnyRef): Boolean
    Definition Classes
      AnyRef
29.  final def notify(): Unit
    Definition Classes
      AnyRef
30.  final def notifyAll(): Unit
    Definition Classes
      AnyRef
31.  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.

    returns

      a reference to this, so the API can be used fluently

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

    returns

      the request stream

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

    returns

      a reference to this, so the API can be used fluently

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

    returns

      the websocket stream

### Inherited from Measured

### Inherited from AnyRef

### Inherited from Any

### Ungrouped