com.sksamuel.scruffy.processors

DefaultProcessors

Related Doc: package processors

trait DefaultProcessors extends ResponseImplicits with ContentTypeProcessors with CookieProcessors with EntityProcessors with HeaderProcessors with QueryParamProcessors with SessionProcessors

Linear Supertypes
Known Subclasses
Ordering
  1. Alphabetic
  2. By inheritance
Inherited
  1. DefaultProcessors
  2. SessionProcessors
  3. QueryParamProcessors
  4. HeaderProcessors
  5. EntityProcessors
  6. CookieProcessors
  7. ContentTypeProcessors
  8. ResponseImplicits
  9. Processors
  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
    ResponseImplicits
  2. type Processor = (HttpRequest) ⇒ Future[HttpResponse]

    A Processor is a function that is applied with the HttpRequest and returns a Future of a HttpResponse.

    A Processor is a function that is applied with the HttpRequest and returns a Future of a HttpResponse. The HttpResponse (response) that is returned will be returned to the user if the status code is non zero.

    The function returns a response, rather than a modified HttpRequest, because we want to allow the DSL to return responses that do not require the exchange to be wrapped. Eg,

    someprocessor { req => "literal string" }

    If the Processor was HttpRequest => HttpRequest (or some other container class) then the final processor would need to be something like:

    someprocessor { req => req withResponse "literal string" }

    Which is just ugly, and more hassle.

    Definition Classes
    Processors

Abstract Value Members

  1. implicit abstract val executor: ExecutionContext

    Definition Classes
    DefaultProcessorsResponseImplicits

Concrete 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): DefaultProcessors.FutureOps[A] { def self: A }

    Definition Classes
    ResponseBuilder
  5. def accepted: HttpResponse

    Definition Classes
    ResponseBuilder
  6. def addHeader(name: HeaderName, v: Any)(f: Processor): Processor

    Definition Classes
    HeaderProcessors
  7. def addHeader(name: String, v: Any)(f: Processor): Processor

    Adds a processor that adds a header with the given name and value to the response.

    Adds a processor that adds a header with the given name and value to the response. This is an alternative way of doing response.withHeader(h, v) on the response object.

    Definition Classes
    HeaderProcessors
  8. def ajax(f: Processor): Processor

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

  9. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  10. def badGateway: HttpResponse

    Definition Classes
    ResponseBuilder
  11. def badRequest(reason: String): HttpResponse

    Definition Classes
    ResponseBuilder
  12. def badRequest: HttpResponse

    Definition Classes
    ResponseBuilder
  13. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  14. def complete(f: Processor): Processor

    This processor can be used when the last processor in an endpoint pipeline uses multiple parameters and you don't like the param => req => handler syntax.

    This processor can be used when the last processor in an endpoint pipeline uses multiple parameters and you don't like the param => req => handler syntax.

    Eg,

    get("myurl") {
    cookie("session") { sessionId => req =>
    s"My sessionId is $sessionId [$req]"
    }
    }
    
    can be re-written as
    
    get("myurl") {
    cookie("session") { sessionId => {
    complete { req =>
    s"My sessionId is $sessionId [$req]"
    }
    }
    }
    

  15. def conflict: HttpResponse

    Definition Classes
    ResponseBuilder
  16. def consumes(mediaTypes: MediaType*)(f: Processor): Processor

    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.

    Definition Classes
    ContentTypeProcessors
  17. def contentTypeOverride(mediaType: MediaType)(f: Processor): Processor

    A processor that sets the content type of the request.

    A processor that sets the content type of the request.

    Definition Classes
    ContentTypeProcessors
  18. def cookie(name: String)(f: (Cookie) ⇒ Processor): Processor

    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
  19. def cookieValue(name: String)(f: (String) ⇒ Processor): Processor

    Definition Classes
    CookieProcessors
  20. def created: HttpResponse

    Definition Classes
    ResponseBuilder
  21. def deleteCookie(name: String)(f: ⇒ Processor): Processor

    A Processor that requests the removal of a cookie on the client side, by setting a cookie with the given name to a nonsense value, and a max age of -1.

    A Processor that requests the removal of a cookie on the client side, by setting a cookie with the given name to a nonsense value, and a max age of -1.

    Definition Classes
    CookieProcessors
  22. def entityAs[E](f: (E) ⇒ Processor)(implicit arg0: Manifest[E]): Processor

    Definition Classes
    EntityProcessors
  23. def entitySizeLimit(size: Int)(f: Processor): Processor

    Definition Classes
    EntityProcessors
  24. final def eq(arg0: AnyRef): Boolean

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

    Definition Classes
    AnyRef → Any
  26. def expectationFailed: HttpResponse

    Definition Classes
    ResponseBuilder
  27. def finalize(): Unit

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

    Definition Classes
    ResponseBuilder
  29. def forbidden: HttpResponse

    Definition Classes
    ResponseBuilder
  30. def found: HttpResponse

    Definition Classes
    ResponseBuilder
  31. implicit def futureTeeToFutureResponse[T](f: Future[T])(implicit fn: (T) ⇒ HttpResponse): Future[HttpResponse]

    Definition Classes
    ResponseImplicits
  32. def gatewayTimeout: HttpResponse

    Definition Classes
    ResponseBuilder
  33. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  34. def gone: HttpResponse

    Definition Classes
    ResponseBuilder
  35. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  36. def header(name: HeaderName, value: Any)(f: Processor): Processor

    Definition Classes
    HeaderProcessors
  37. def header(name: String, value: Any)(f: Processor): Processor

    Adds a processor to the pipeline 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.

    Adds a processor to the pipeline 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.

    name

    the header that must be present on the request

    returns

    this

    Definition Classes
    HeaderProcessors
  38. def header(name: HeaderName)(f: Processor): Processor

    Definition Classes
    HeaderProcessors
  39. def header(name: String)(f: Processor): Processor

    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
  40. def hostname(regex: String)(f: Processor): Processor

  41. def http(f: Processor): Processor

    A Processor that only handles the request if the request is HTTP / un-secured

  42. def https(f: Processor): Processor

    A Processor that only handles the request if the request is HTTPS / secure

  43. def ifMatch(name: String)(f: ⇒ Processor): Processor

    Definition Classes
    HeaderProcessors
  44. def internalServerError(reason: String): HttpResponse

    Definition Classes
    ResponseBuilder
  45. def internalServerError: HttpResponse

    Definition Classes
    ResponseBuilder
  46. def internalServerError(e: Throwable): HttpResponse

    Definition Classes
    ResponseBuilder
  47. def ipAddress(f: (String) ⇒ Processor): Processor

  48. final def isInstanceOf[T0]: Boolean

    Definition Classes
    Any
  49. def json(f: Processor): Processor

    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
  50. def lengthRequired: HttpResponse

    Definition Classes
    ResponseBuilder
  51. def matchesIpAddress(regex: String)(f: Processor): Processor

    Processes request only if the ipaddress in the request matches the given regex.

  52. def methodNotAllowed: HttpResponse

    Definition Classes
    ResponseBuilder
  53. def movedPermanently: HttpResponse

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

    Definition Classes
    AnyRef
  55. def noEntity(f: Processor): Processor

    Definition Classes
    EntityProcessors
  56. def nocontent: HttpResponse

    Definition Classes
    ResponseBuilder
  57. implicit def nodeToEndpointFn(node: Node): Processor

    Definition Classes
    ResponseImplicits
  58. implicit def nodeToFuture(node: Node): Future[HttpResponse]

    Definition Classes
    ResponseImplicits
  59. implicit def nodeToResponse(node: Node): HttpResponse

    Definition Classes
    ResponseImplicits
  60. def nonAuthoritativeInformation: HttpResponse

    Definition Classes
    ResponseBuilder
  61. def notAcceptable: HttpResponse

    Definition Classes
    ResponseBuilder
  62. def notFound(body: String): HttpResponse

    Definition Classes
    ResponseBuilder
  63. def notFound: HttpResponse

    Definition Classes
    ResponseBuilder
  64. def notImplemented: HttpResponse

    Definition Classes
    ResponseBuilder
  65. def notImplemented(reason: String): HttpResponse

    Definition Classes
    ResponseBuilder
  66. def notModified: HttpResponse

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

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

    Definition Classes
    AnyRef
  69. def ok(ent: Any, contentType: MediaType): HttpResponse

    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
  70. def ok(ent: Any, contentType: String): HttpResponse

    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
  71. def ok(e: Any): HttpResponse

    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
  72. def ok: HttpResponse

    Definition Classes
    ResponseBuilder
  73. implicit def optionToEndpointFn(o: Option[_]): Processor

    Definition Classes
    ResponseImplicits
  74. implicit def optionToEndpointFn(f: Future[Option[_]]): Processor

    Definition Classes
    ResponseImplicits
  75. implicit def optionToFuture(o: Option[_]): Future[HttpResponse]

    Definition Classes
    ResponseImplicits
  76. implicit def optionToFuture(f: Future[Option[_]]): Future[HttpResponse]

    Definition Classes
    ResponseImplicits
  77. implicit def optionToResponse(option: Option[_]): HttpResponse

    Definition Classes
    ResponseImplicits
  78. def param(name: String, value: String)(f: Processor): Processor

    Definition Classes
    QueryParamProcessors
  79. def param(name: String)(f: (String) ⇒ Processor): Processor

    Definition Classes
    QueryParamProcessors
  80. def partialContent: HttpResponse

    Definition Classes
    ResponseBuilder
  81. def paymentRequired: HttpResponse

    Definition Classes
    ResponseBuilder
  82. def permanentRedirect(location: String): HttpResponse

    Definition Classes
    ResponseBuilder
  83. def preconditionFailed: HttpResponse

    Definition Classes
    ResponseBuilder
  84. implicit def productToFuture(prod: Product): Future[Product]

    Definition Classes
    ResponseImplicits
  85. def proxyAuthenticationRequired: HttpResponse

    Definition Classes
    ResponseBuilder
  86. def rateLimit(requestsPerSecond: Double, warmupPeriod: FiniteDuration)(f: Processor): Processor

  87. def rateLimit(limiter: RateLimiter)(f: Processor): Processor

  88. def requestEntityTooLarge: HttpResponse

    Definition Classes
    ResponseBuilder
  89. def requestHeaderFieldsTooLarge: HttpResponse

    Definition Classes
    ResponseBuilder
  90. def requestTimeout: HttpResponse

    Definition Classes
    ResponseBuilder
  91. def requestURITooLong: HttpResponse

    Definition Classes
    ResponseBuilder
  92. def requestedRangeNotSatisfiable: HttpResponse

    Definition Classes
    ResponseBuilder
  93. def requiresEntity(f: Processor): Processor

    Definition Classes
    EntityProcessors
  94. def resetContent: HttpResponse

    Definition Classes
    ResponseBuilder
  95. implicit def responseFutureToProcessor(resp: Future[HttpResponse]): Processor

    Definition Classes
    ResponseImplicits
  96. implicit def responseToFuture(resp: HttpResponse): Future[HttpResponse]

    Definition Classes
    ResponseImplicits
  97. implicit def responseToProcessorFn(resp: HttpResponse): Processor

    Definition Classes
    ResponseImplicits
  98. implicit def scalazValToEndpointFn(v: ValidationNel[_, _]): Processor

    Definition Classes
    ResponseImplicits
  99. implicit def scalazValToEndpointFn(f: Future[ValidationNel[_, _]]): Processor

    Definition Classes
    ResponseImplicits
  100. implicit def scalazValToFuture(f: Future[ValidationNel[_, _]]): Future[HttpResponse]

    Definition Classes
    ResponseImplicits
  101. implicit def scalazValToFuture(v: ValidationNel[_, _]): Future[HttpResponse]

    Definition Classes
    ResponseImplicits
  102. implicit def scalazValToResponse(v: ValidationNel[_, _]): HttpResponse

    Definition Classes
    ResponseImplicits
  103. def schema(f: (String) ⇒ Processor): Processor

    A Processor that extracts the scheme from the request and makes it available in the inner processor.

    A Processor that extracts the scheme from the request and makes it available in the inner processor.

    f

    the inner processor function that accepts a String, which is the schema value.

  104. def seeOther(location: String): HttpResponse

    Definition Classes
    ResponseBuilder
  105. def serviceUnavailable: HttpResponse

    Definition Classes
    ResponseBuilder
  106. def session(f: (Session) ⇒ Processor): Processor

    Extracts the current session.

    Extracts the current session. If no such session exists then a 500 Internal Server Error response will be generated and returned.

    Definition Classes
    SessionProcessors
  107. def sessionOption(f: (Option[Session]) ⇒ Processor): Processor

    Extracts the current session as an Option.

    Extracts the current session as an Option. If no session exists then the value will be a None. This method will not create a session if one does not already exist.

    Definition Classes
    SessionProcessors
  108. def sessionProperty[T](key: SessionKey[T])(f: (T) ⇒ Processor): Processor

    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 endpoint will return a 500 Interal Service Error

    Definition Classes
    SessionProcessors
  109. def sessionPropertyOption[T](key: SessionKey[T])(f: (Option[T]) ⇒ Processor): Processor

    Extracts an optional property from the session.

    Extracts an optional 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 then the nested processor will be invoked with a None.

    Definition Classes
    SessionProcessors
  110. def status(s: Int, reason: String): HttpResponse

    Definition Classes
    ResponseBuilder
  111. def status(s: Int): HttpResponse

    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
  112. def status(s: HttpStatus): HttpResponse

    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
  113. implicit def statusToEndpointFn(s: HttpStatus): Processor

    Definition Classes
    ResponseImplicits
  114. implicit def statusToFuture(s: HttpStatus): Future[HttpResponse]

    Definition Classes
    ResponseImplicits
  115. implicit def statusToResponse(s: HttpStatus): HttpResponse

    Definition Classes
    ResponseImplicits
  116. implicit def stringToFuture(str: String): Future[HttpResponse]

    Definition Classes
    ResponseImplicits
  117. implicit def stringToFuture(f: Future[String]): Future[HttpResponse]

    Definition Classes
    ResponseImplicits
  118. implicit def stringToProcessor(str: String): Processor

    Definition Classes
    ResponseImplicits
  119. implicit def stringToProcessor(f: Future[String]): Processor

    Definition Classes
    ResponseImplicits
  120. final def synchronized[T0](arg0: ⇒ T0): T0

    Definition Classes
    AnyRef
  121. def temporaryRedirect(location: String): HttpResponse

    Definition Classes
    ResponseBuilder
  122. def toString(): String

    Definition Classes
    AnyRef → Any
  123. def tooManyRequests: HttpResponse

    Definition Classes
    ResponseBuilder
  124. implicit def tryToEndpointFn(t: Try[_]): Processor

    Definition Classes
    ResponseImplicits
  125. implicit def tryToEndpointFn(f: Future[Try[_]]): Processor

    Definition Classes
    ResponseImplicits
  126. implicit def tryToFuture(t: Try[_]): Future[HttpResponse]

    Definition Classes
    ResponseImplicits
  127. implicit def tryToFuture(f: Future[Try[_]]): Future[HttpResponse]

    Definition Classes
    ResponseImplicits
  128. implicit def tryToResponse(t: Try[_]): HttpResponse

    Definition Classes
    ResponseImplicits
  129. def unauthorized: HttpResponse

    Definition Classes
    ResponseBuilder
  130. implicit def unitToEndpointFn(unit: Unit): Processor

    Definition Classes
    ResponseImplicits
  131. implicit def unitToEndpointFn(f: Future[Unit]): Processor

    Definition Classes
    ResponseImplicits
  132. implicit def unitToFuture(unit: Unit): Future[HttpResponse]

    Definition Classes
    ResponseImplicits
  133. implicit def unitToFuture(f: Future[Unit]): Future[HttpResponse]

    Definition Classes
    ResponseImplicits
  134. implicit def unitToResponse(unit: Unit): HttpResponse

    Definition Classes
    ResponseImplicits
  135. def unprocessableEntity(reason: String): HttpResponse

    Definition Classes
    ResponseBuilder
  136. def unprocessableEntity: HttpResponse

    Definition Classes
    ResponseBuilder
  137. def unsupportedMediaType: HttpResponse

    Definition Classes
    ResponseBuilder
  138. def useProxy: HttpResponse

    Definition Classes
    ResponseBuilder
  139. def userAgent(regex: String)(f: Processor): Processor

    Definition Classes
    HeaderProcessors
  140. def userAgent(regex: Regex)(f: Processor): Processor

    The regex to match on the user agent

    The regex to match on the user agent

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

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  144. def xml(f: Processor): Processor

    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 SessionProcessors

Inherited from QueryParamProcessors

Inherited from HeaderProcessors

Inherited from EntityProcessors

Inherited from CookieProcessors

Inherited from ContentTypeProcessors

Inherited from ResponseImplicits

Inherited from Processors

Inherited from ResponseBuilder

Inherited from AnyRef

Inherited from Any

Ungrouped