object Server

Utilities for creating a server that runs around a block of code.

Source
Server.scala
Linear Supertypes
AnyRef, Any
Ordering
  1. Alphabetic
  2. By Inheritance
Inherited
  1. Server
  2. AnyRef
  3. Any
  1. Hide All
  2. Show All
Visibility
  1. Public
  2. Protected

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. final def asInstanceOf[T0]: T0
    Definition Classes
    Any
  5. def clone(): AnyRef
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.CloneNotSupportedException]) @native()
  6. final def eq(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  7. def equals(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef → Any
  8. def finalize(): Unit
    Attributes
    protected[lang]
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.Throwable])
  9. final def getClass(): Class[_ <: AnyRef]
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  10. def hashCode(): Int
    Definition Classes
    AnyRef → Any
    Annotations
    @native()
  11. final def isInstanceOf[T0]: Boolean
    Definition Classes
    Any
  12. final def ne(arg0: AnyRef): Boolean
    Definition Classes
    AnyRef
  13. final def notify(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  14. final def notifyAll(): Unit
    Definition Classes
    AnyRef
    Annotations
    @native()
  15. final def synchronized[T0](arg0: => T0): T0
    Definition Classes
    AnyRef
  16. def toString(): String
    Definition Classes
    AnyRef → Any
  17. final def wait(): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  18. final def wait(arg0: Long, arg1: Int): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException])
  19. final def wait(arg0: Long): Unit
    Definition Classes
    AnyRef
    Annotations
    @throws(classOf[java.lang.InterruptedException]) @native()
  20. def withApplication[T](application: api.Application, config: ServerConfig = ServerConfig(port = Some(0), mode = Mode.Test))(block: (Port) => T)(implicit provider: ServerProvider): T

    Run a block of code with a server for the given application.

    Run a block of code with a server for the given application.

    The passed in block takes the port that the application is running on. By default, this will be a random ephemeral port. This can be changed by passing in an explicit port with the config parameter.

    application

    The application for the server to server.

    config

    The configuration for the server. Defaults to test config with the http port bound to a random ephemeral port.

    block

    The block of code to run.

    provider

    The server provider.

    returns

    The result of the block of code.

  21. def withApplicationFromContext[T](config: ServerConfig = ServerConfig(port = Some(0), mode = Mode.Test))(appProducer: (Context) => api.Application)(block: (Port) => T)(implicit provider: ServerProvider): T

    Run a block of code with a server for the application containing routes.

    Run a block of code with a server for the application containing routes.

    The passed in block takes the port that the application is running on. By default, this will be a random ephemeral port. This can be changed by passing in an explicit port with the config parameter.

    An easy way to set up an application with given routes is to use play.api.BuiltInComponentsFromContext with any extra components needed:

     Server.withApplicationFromContext(ServerConfig(mode = Mode.Prod, port = Some(0))) { context =>
       new BuiltInComponentsFromContext(context) with AssetsComponents with play.filters.HttpFiltersComponents {
        override def router: Router = Router.from {
          case req => assets.versioned("/testassets", req.path)
        }
      }.application
    } { withClient(block)(_) }
    config

    The configuration for the server. Defaults to test config with the http port bound to a random ephemeral port.

    appProducer

    A function that takes an ApplicationLoader.Context and produces play.api.Application

    block

    The block of code to run.

    provider

    The server provider.

    returns

    The result of the block of code.

  22. def withRouter[T](config: ServerConfig = ServerConfig(port = Some(0), mode = Mode.Test))(routes: PartialFunction[RequestHeader, Handler])(block: (Port) => T)(implicit provider: ServerProvider): T

    Run a block of code with a server for the given routes.

    Run a block of code with a server for the given routes.

    The passed in block takes the port that the application is running on. By default, this will be a random ephemeral port. This can be changed by passing in an explicit port with the config parameter.

    config

    The configuration for the server. Defaults to test config with the http port bound to a random ephemeral port.

    routes

    The routes for the server to server.

    block

    The block of code to run.

    provider

    The server provider.

    returns

    The result of the block of code.

  23. def withRouterFromComponents[T](config: ServerConfig = ServerConfig(port = Some(0), mode = Mode.Test))(routes: (api.BuiltInComponents) => PartialFunction[RequestHeader, Handler])(block: (Port) => T)(implicit provider: ServerProvider): T

    Run a block of code with a server for the given routes, obtained from the application components

    Run a block of code with a server for the given routes, obtained from the application components

    The passed in block takes the port that the application is running on. By default, this will be a random ephemeral port. This can be changed by passing in an explicit port with the config parameter.

    config

    The configuration for the server. Defaults to test config with the http port bound to a random ephemeral port.

    routes

    A function that obtains the routes from the server from the application components.

    block

    The block of code to run.

    provider

    The server provider.

    returns

    The result of the block of code.

  24. object ServerStoppedReason extends Reason with Product with Serializable

Inherited from AnyRef

Inherited from Any

Ungrouped