com.sksamuel.scruffy

HttpEndpointProvider

Related Doc: package scruffy

trait HttpEndpointProvider extends ResponseBuilder with ResponseConversions with DefaultProcessors

A trait that provides the entry point to the DSL.

Classes / objects that contain the endpoints for your application should extend this trait and call the get/post/delete/etc methods, providing the path to match on and the function chain.

Linear Supertypes
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. HttpEndpointProvider
  2. DefaultProcessors
  3. SessionProcessors
  4. QueryParamProcessors
  5. HeaderProcessors
  6. EntityProcessors
  7. CookieProcessors
  8. ContentTypeProcessors
  9. ResponseConversions
  10. ResponseBuilder
  11. AnyRef
  12. Any
  1. Hide All
  2. Show all
Learn more about member selection
Visibility
  1. Public
  2. All

Type Members

  1. implicit class FutureOps[T] extends AnyRef

    Definition Classes
    ResponseConversions

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. implicit def ToFutureOps[A](a: A): HttpEndpointProvider.FutureOps[A] { def self: A }

    Definition Classes
    ResponseBuilder
  5. var _errorHandler: Option[ErrorHandler]

  6. def accepted: Response

    Definition Classes
    ResponseBuilder
  7. def ajax(f: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Processor that requires the request to identify itself as an ajax request by incuding the X-Requested-With header set to value "XMLRequest"

    Processor that requires the request to identify itself as an ajax request by incuding the X-Requested-With header set to value "XMLRequest"

    Definition Classes
    DefaultProcessors
  8. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  9. def badGateway: Response

    Definition Classes
    ResponseBuilder
  10. def badRequest(reason: String): Response

    Definition Classes
    ResponseBuilder
  11. def badRequest: Response

    Definition Classes
    ResponseBuilder
  12. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  13. def conflict: Response

    Definition Classes
    ResponseBuilder
  14. def consumes(mediaTypes: MediaType*)(p: ⇒ Future[Response])(implicit req: Request): Future[Response]

    A Processor that will reject a request with 415 Unsupported Media Type if the content type of the request does not match one of the given content types.

    A Processor that will reject a request with 415 Unsupported Media Type if the content type of the request does not match one of the given content types.

    mediaTypes

    the media types accepted by this processor

    p

    the inner processor

    req

    the outer http request

    returns

    the inner processors http response

    Definition Classes
    ContentTypeProcessors
  15. def contentTypeOverride(mediaType: MediaType)(p: (Request) ⇒ Future[Response])(implicit req: Request): Future[Response]

    A processor that sets the content type of the request.

    A processor that sets the content type of the request.

    Definition Classes
    ContentTypeProcessors
  16. def cookie(name: String)(f: (Cookie) ⇒ Future[Response])(implicit req: Request): Future[Response]

    Adds a processor to the pipeline that requires the request to have a cookie with the given name.

    Adds a processor to the pipeline that requires the request to have a cookie with the given name. If the request does not contain the cookie then processing will skip to the next endpoint. The processor does not inspect the cookie value.

    name

    the cookie name that must be present on the request

    returns

    this

    Definition Classes
    CookieProcessors
  17. def created: Response

    Definition Classes
    ResponseBuilder
  18. def define(method: HttpMethod, url: String, p: (Request) ⇒ Future[Response]): HttpEndpoint

    Attributes
    protected
  19. def delete(url: String)(p: (Request) ⇒ Future[Response]): HttpEndpoint

  20. def emptyBody(f: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Definition Classes
    EntityProcessors
  21. def entityAs[E](f: (E) ⇒ Future[Response])(implicit arg0: Manifest[E], req: Request): Future[Response]

    Definition Classes
    EntityProcessors
  22. implicit def entityFutureToResponseFuture(f: Future[Any]): Future[Response]

    Definition Classes
    ResponseConversions
  23. def entitySizeLimit(size: Int)(f: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Definition Classes
    EntityProcessors
  24. implicit def entityToResponseFuture(any: Any): Future[Response]

    Definition Classes
    ResponseConversions
  25. final def eq(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  26. def equals(arg0: Any): Boolean

    Definition Classes
    AnyRef → Any
  27. def errorHandler(f: ⇒ ErrorHandler): Unit

  28. implicit val executor: ExecutionContext

  29. def expectationFailed: Response

    Definition Classes
    ResponseBuilder
  30. def filter(filter: Filter): Unit

    Adds a filter that will run before each of the endpoints defined in this provider.

    Adds a filter that will run before each of the endpoints defined in this provider.

    Filters are only executed once per request, so if an endpoint skips to another endpoint, the filter will not be re-executed.

    Note: Endpoint Provider specific filters (ie, filters added here) will be executed after server-wide specific filters (those registered with the endpoint container).

  31. var filters: ListBuffer[FilterHolder]

    Attributes
    protected[com.sksamuel.scruffy]
  32. def finalize(): Unit

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( classOf[java.lang.Throwable] )
  33. def forbidden(reason: String): Response

    Definition Classes
    ResponseBuilder
  34. def forbidden: Response

    Definition Classes
    ResponseBuilder
  35. def found: Response

    Definition Classes
    ResponseBuilder
  36. def gatewayTimeout: Response

    Definition Classes
    ResponseBuilder
  37. def get(url: String)(p: (Request) ⇒ Future[Response]): HttpEndpoint

  38. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  39. def gone: Response

    Definition Classes
    ResponseBuilder
  40. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  41. def head(url: String)(p: (Request) ⇒ Future[Response]): HttpEndpoint

  42. def header(name: String, value: Any)(f: ⇒ Future[Response])(implicit req: Request): Future[Response]

    A processor that requires the request to have a header with the given name and value.

    A processor that requires the request to have a header with the given name and value. If the request does not contain the header then processing will skip to the next endpoint.

    Definition Classes
    HeaderProcessors
  43. def header(name: HeaderName, value: Any)(f: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Definition Classes
    HeaderProcessors
  44. def header(name: String)(f: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Adds a processor to the pipeline that requires the request to have a header with the given name.

    Adds a processor to the pipeline that requires the request to have a header with the given name. The value is not inspected as part of this pipeline. If the request does not contain the header then processing will skip to the next endpoint.

    name

    the header that must be present on the request

    returns

    this

    Definition Classes
    HeaderProcessors
  45. def header(name: HeaderName)(f: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Adds a processor to the pipeline that requires the request to have a header with the given name.

    Adds a processor to the pipeline that requires the request to have a header with the given name. The value is not inspected as part of this pipeline. If the request does not contain the header then processing will skip to the next endpoint.

    name

    the header that must be present on the request

    returns

    this

    Definition Classes
    HeaderProcessors
  46. def hostname(regex: String)(f: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Definition Classes
    DefaultProcessors
  47. def http(f: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Definition Classes
    DefaultProcessors
  48. val httpEndpoints: ListBuffer[HttpEndpoint]

    Attributes
    protected[com.sksamuel.scruffy]
  49. def https(f: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Definition Classes
    DefaultProcessors
  50. def ifMatch(name: String)(f: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Definition Classes
    DefaultProcessors
  51. def internalServerError(reason: String): Response

    Definition Classes
    ResponseBuilder
  52. def internalServerError: Response

    Definition Classes
    ResponseBuilder
  53. def internalServerError(e: Throwable): Response

    Definition Classes
    ResponseBuilder
  54. def ipAddress(regex: String)(f: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Definition Classes
    DefaultProcessors
  55. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  56. def json(p: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Adjusts the response from the inner processor by setting its content type to json

    Adjusts the response from the inner processor by setting its content type to json

    Definition Classes
    ContentTypeProcessors
  57. def lengthRequired: Response

    Definition Classes
    ResponseBuilder
  58. def methodNotAllowed: Response

    Definition Classes
    ResponseBuilder
  59. def movedPermanently: Response

    Definition Classes
    ResponseBuilder
  60. final def ne(arg0: AnyRef): Boolean

    Definition Classes
    AnyRef
  61. def nocontent: Response

    Definition Classes
    ResponseBuilder
  62. implicit def nodeToResponseFuture(node: Node): Future[Response]

    Definition Classes
    ResponseConversions
  63. def nonAuthoritativeInformation: Response

    Definition Classes
    ResponseBuilder
  64. def nonEmptyBody(f: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Definition Classes
    EntityProcessors
  65. def notAcceptable: Response

    Definition Classes
    ResponseBuilder
  66. def notFound(body: String): Response

    Definition Classes
    ResponseBuilder
  67. def notFound: Response

    Definition Classes
    ResponseBuilder
  68. def notImplemented: Response

    Definition Classes
    ResponseBuilder
  69. def notImplemented(reason: String): Response

    Definition Classes
    ResponseBuilder
  70. def notModified: Response

    Definition Classes
    ResponseBuilder
  71. final def notify(): Unit

    Definition Classes
    AnyRef
  72. final def notifyAll(): Unit

    Definition Classes
    AnyRef
  73. def ok(ent: Any, contentType: MediaType): Response

    Creates a Response, which is a 200 OK, with the given entity set as the payload with the given content-type.

    Creates a Response, which is a 200 OK, with the given entity set as the payload with the given content-type.

    Definition Classes
    ResponseBuilder
  74. def ok(ent: Any, contentType: String): Response

    Creates a Response, which is a 200 OK, with the given entity set as the payload with the given content-type.

    Creates a Response, which is a 200 OK, with the given entity set as the payload with the given content-type.

    Definition Classes
    ResponseBuilder
  75. def ok(e: Any): Response

    Creaes a 200 ok response with the entity set to the given value, and the content type inferred.

    Creaes a 200 ok response with the entity set to the given value, and the content type inferred.

    Definition Classes
    ResponseBuilder
  76. def ok: Response

    Definition Classes
    ResponseBuilder
  77. def option2response(option: Option[_]): Response

    Definition Classes
    ResponseConversions
  78. implicit def optionFutureToResponseFuture(f: Future[Option[_]]): Future[Response]

    Definition Classes
    ResponseConversions
  79. implicit def optionToResponseFuture(o: Option[_]): Future[Response]

    Definition Classes
    ResponseConversions
  80. def options(url: String)(p: (Request) ⇒ Future[Response]): HttpEndpoint

  81. def param(name: String, value: String)(f: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Definition Classes
    QueryParamProcessors
  82. def param(name: String)(f: (String) ⇒ Future[Response])(implicit req: Request): Future[Response]

    Definition Classes
    QueryParamProcessors
  83. def partialContent: Response

    Definition Classes
    ResponseBuilder
  84. def paymentRequired: Response

    Definition Classes
    ResponseBuilder
  85. def permanentRedirect(location: String): Response

    Definition Classes
    ResponseBuilder
  86. def post(url: String)(p: (Request) ⇒ Future[Response]): HttpEndpoint

  87. def preconditionFailed: Response

    Definition Classes
    ResponseBuilder
  88. def proxyAuthenticationRequired: Response

    Definition Classes
    ResponseBuilder
  89. def put(url: String)(p: (Request) ⇒ Future[Response]): HttpEndpoint

  90. def rateLimit(requestsPerSecond: Double, warmupPeriod: FiniteDuration)(f: ⇒ Future[Response]): Future[Response]

    Definition Classes
    DefaultProcessors
  91. def rateLimit(limiter: RateLimiter)(f: ⇒ Future[Response]): Future[Response]

    Definition Classes
    DefaultProcessors
  92. def requestEntityTooLarge: Response

    Definition Classes
    ResponseBuilder
  93. def requestHeaderFieldsTooLarge: Response

    Definition Classes
    ResponseBuilder
  94. def requestTimeout: Response

    Definition Classes
    ResponseBuilder
  95. def requestURITooLong: Response

    Definition Classes
    ResponseBuilder
  96. def requestedRangeNotSatisfiable: Response

    Definition Classes
    ResponseBuilder
  97. def resetContent: Response

    Definition Classes
    ResponseBuilder
  98. implicit def responseToResponseFuture(resp: Response): Future[Response]

    Definition Classes
    ResponseConversions
  99. implicit def scalazValidation2responseFuture(v: ValidationNel[_, _]): Future[Response]

    Definition Classes
    ResponseConversions
  100. implicit def scalazValidationFuture2responseFuture(f: Future[ValidationNel[_, _]]): Future[Response]

    Definition Classes
    ResponseConversions
  101. def seeOther(location: String): Response

    Definition Classes
    ResponseBuilder
  102. def serviceUnavailable: Response

    Definition Classes
    ResponseBuilder
  103. def session(f: (Session) ⇒ Future[Response])(implicit req: Request): Future[Response]

    Extracts the current session.

    Extracts the current session. If no such session exists then will exit the route with a 500 Internal Service Error.

    Definition Classes
    SessionProcessors
  104. def sessionManager(manager: SessionManager)(f: (Session) ⇒ Future[Response])(implicit req: Request): Future[Response]

    Definition Classes
    SessionProcessors
  105. def sessionProperty[T](key: SessionKey[T])(f: (T) ⇒ Future[Response])(implicit req: Request): Future[Response]

    Extracts a property from the session.

    Extracts a property from the session. If the session does not exist then the endpoint will return a 500 Internal Service Error. If the property does not exist in the session then the route will return a 500 Internal Service Error.

    Definition Classes
    SessionProcessors
  106. def status(s: Int): Response

    Builds a Response with the status code set to a HttpStatus which has the value of the given int.

    Builds a Response with the status code set to a HttpStatus which has the value of the given int.

    Eg, status(200) will return a Response of 200

    Definition Classes
    ResponseBuilder
  107. def status(s: HttpStatus): Response

    Builds a Response with the status code set the given HttpStatus

    Builds a Response with the status code set the given HttpStatus

    Eg, status(HttpStatus.OK) will return a Response of 200

    Definition Classes
    ResponseBuilder
  108. implicit def statusToResponse(s: HttpStatus): Response

    Definition Classes
    ResponseConversions
  109. implicit def statusToResponseFuture(s: HttpStatus): Future[Response]

    Definition Classes
    ResponseConversions
  110. implicit def stringFutureToResponseFuture(f: Future[String]): Future[Response]

    Definition Classes
    ResponseConversions
  111. implicit def stringToResponseFuture(str: String): Future[Response]

    Definition Classes
    ResponseConversions
  112. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  113. def temporaryRedirect(location: String): Response

    Definition Classes
    ResponseBuilder
  114. def toString(): String

    Definition Classes
    AnyRef → Any
  115. def tooManyRequests: Response

    Definition Classes
    ResponseBuilder
  116. def trace(url: String)(p: (Request) ⇒ Future[Response]): HttpEndpoint

  117. def try2response(t: Try[_]): Response

    Definition Classes
    ResponseConversions
  118. implicit def try2responseFuture(t: Try[_]): Future[Response]

    Definition Classes
    ResponseConversions
  119. implicit def tryFuture2responseFuture(f: Future[Try[_]]): Future[Response]

    Definition Classes
    ResponseConversions
  120. def unauthorized: Response

    Definition Classes
    ResponseBuilder
  121. def unit2response(unit: Unit): Response

    Definition Classes
    ResponseConversions
  122. implicit def unit2responseFuture(unit: Unit): Future[Response]

    Definition Classes
    ResponseConversions
  123. implicit def unitFuture2responseFuture(f: Future[Unit]): Future[Response]

    Definition Classes
    ResponseConversions
  124. def unprocessableEntity(reason: String): Response

    Definition Classes
    ResponseBuilder
  125. def unprocessableEntity: Response

    Definition Classes
    ResponseBuilder
  126. def unsupportedMediaType: Response

    Definition Classes
    ResponseBuilder
  127. def useProxy: Response

    Definition Classes
    ResponseBuilder
  128. def userAgent(regex: String)(f: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Definition Classes
    HeaderProcessors
  129. final def wait(): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  130. final def wait(arg0: Long, arg1: Int): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  131. final def wait(arg0: Long): Unit

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  132. def xml(p: ⇒ Future[Response])(implicit req: Request): Future[Response]

    Creates a Response, which is a 200 OK, with the given entity set as an XML payload.

    Creates a Response, which is a 200 OK, with the given entity set as an XML payload.

    Definition Classes
    ContentTypeProcessors

Inherited from DefaultProcessors

Inherited from SessionProcessors

Inherited from QueryParamProcessors

Inherited from HeaderProcessors

Inherited from EntityProcessors

Inherited from CookieProcessors

Inherited from ContentTypeProcessors

Inherited from ResponseConversions

Inherited from ResponseBuilder

Inherited from AnyRef

Inherited from Any

Ungrouped