com.sksamuel.scruffy

StaticFileEndpoint

Related Doc: package scruffy

class StaticFileEndpoint extends HttpEndpointProvider

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

Instance Constructors

  1. new StaticFileEndpoint(base: String)

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

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

    Definition Classes
    ResponseBuilder
  5. def accepted: HttpResponse

    Definition Classes
    ResponseBuilder
  6. def add(listeners: HttpListener*): Unit

    Definition Classes
    HttpEndpointProvider
  7. def addHeader(name: HeaderName, v: Any)(f: Processor): Processor

    Definition Classes
    HeaderProcessors
  8. 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
  9. 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"

    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
  10. final def asInstanceOf[T0]: T0

    Definition Classes
    Any
  11. def badGateway: HttpResponse

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

    Definition Classes
    ResponseBuilder
  13. def badRequest: HttpResponse

    Definition Classes
    ResponseBuilder
  14. def clone(): AnyRef

    Attributes
    protected[java.lang]
    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  15. 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]"
    }
    }
    }
    

    Definition Classes
    DefaultProcessors
  16. def conflict: HttpResponse

    Definition Classes
    ResponseBuilder
  17. 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
  18. 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
  19. 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
  20. def cookieValue(name: String)(f: (String) ⇒ Processor): Processor

    Definition Classes
    CookieProcessors
  21. def created: HttpResponse

    Definition Classes
    ResponseBuilder
  22. def define(method: HttpMethod, url: String, f: Processor): HttpEndpoint

    Attributes
    protected
    Definition Classes
    HttpEndpointProvider
  23. def delete(url: String)(p: Processor): HttpEndpoint

    Definition Classes
    HttpEndpointProvider
  24. 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
  25. def entityAs[E](f: (E) ⇒ Processor)(implicit arg0: Manifest[E]): Processor

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

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

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

    Definition Classes
    AnyRef → Any
  29. var errorHandler: Option[ErrorHandler]

    Attributes
    protected[com.sksamuel.scruffy]
    Definition Classes
    HttpEndpointProvider
  30. def errors(f: ⇒ ErrorHandler): Unit

    Define error handling that will be chained to the existing error handlers.

    Define error handling that will be chained to the existing error handlers. Error handlers are invoked as a stack, so the last registered erorr handler will be the first invoked. If a particular error handler does not handle the given exceptions, then the next error handler in the stack will be invoked until the default error handling is reached. Only one error handler per endpoint provider can be registered.

    Definition Classes
    HttpEndpointProvider
  31. implicit val executor: ExecutionContext

  32. def expectationFailed: HttpResponse

    Definition Classes
    ResponseBuilder
  33. def filter(filter: HttpFilter): 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).

    Definition Classes
    HttpEndpointProvider
  34. var filters: ListBuffer[FilterHolder]

    Attributes
    protected[com.sksamuel.scruffy]
    Definition Classes
    HttpEndpointProvider
  35. def finalize(): Unit

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

    Definition Classes
    ResponseBuilder
  37. def forbidden: HttpResponse

    Definition Classes
    ResponseBuilder
  38. def found: HttpResponse

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

    Definition Classes
    ResponseImplicits
  40. def gatewayTimeout: HttpResponse

    Definition Classes
    ResponseBuilder
  41. def get(url: String)(p: Processor): HttpEndpoint

    Definition Classes
    HttpEndpointProvider
  42. final def getClass(): Class[_]

    Definition Classes
    AnyRef → Any
  43. def gone: HttpResponse

    Definition Classes
    ResponseBuilder
  44. def hashCode(): Int

    Definition Classes
    AnyRef → Any
  45. def head(url: String)(p: Processor): HttpEndpoint

    Definition Classes
    HttpEndpointProvider
  46. def header(name: HeaderName, value: Any)(f: Processor): Processor

    Definition Classes
    HeaderProcessors
  47. 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
  48. def header(name: HeaderName)(f: Processor): Processor

    Definition Classes
    HeaderProcessors
  49. 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
  50. def hostname(regex: String)(f: Processor): Processor

    Definition Classes
    DefaultProcessors
  51. def http(f: Processor): Processor

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

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

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

    Attributes
    protected[com.sksamuel.scruffy]
    Definition Classes
    HttpEndpointProvider
  53. def https(f: Processor): Processor

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

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

    Definition Classes
    DefaultProcessors
  54. def ifMatch(name: String)(f: ⇒ Processor): Processor

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

    Definition Classes
    ResponseBuilder
  56. def internalServerError: HttpResponse

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

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

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

    Definition Classes
    Any
  60. 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
  61. def lengthRequired: HttpResponse

    Definition Classes
    ResponseBuilder
  62. var listeners: ListBuffer[HttpListener]

    Attributes
    protected[com.sksamuel.scruffy]
    Definition Classes
    HttpEndpointProvider
  63. def matchesIpAddress(regex: String)(f: Processor): Processor

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

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

    Definition Classes
    DefaultProcessors
  64. def methodNotAllowed: HttpResponse

    Definition Classes
    ResponseBuilder
  65. def movedPermanently: HttpResponse

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

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

    Definition Classes
    EntityProcessors
  68. def nocontent: HttpResponse

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

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

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

    Definition Classes
    ResponseImplicits
  72. def nonAuthoritativeInformation: HttpResponse

    Definition Classes
    ResponseBuilder
  73. def notAcceptable: HttpResponse

    Definition Classes
    ResponseBuilder
  74. def notFound(f: NotFoundHandler): Unit

    Definition Classes
    HttpEndpointProvider
  75. def notFound(body: String): HttpResponse

    Definition Classes
    ResponseBuilder
  76. def notFound: HttpResponse

    Definition Classes
    ResponseBuilder
  77. var notFoundHandler: Option[NotFoundHandler]

    Attributes
    protected[com.sksamuel.scruffy]
    Definition Classes
    HttpEndpointProvider
  78. def notImplemented: HttpResponse

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

    Definition Classes
    ResponseBuilder
  80. def notModified: HttpResponse

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

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

    Definition Classes
    AnyRef
  83. 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
  84. 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
  85. 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
  86. def ok: HttpResponse

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

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

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

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

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

    Definition Classes
    ResponseImplicits
  92. def options(url: String)(p: Processor): HttpEndpoint

    Definition Classes
    HttpEndpointProvider
  93. def param(name: String, value: String)(f: Processor): Processor

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

    Definition Classes
    QueryParamProcessors
  95. def partialContent: HttpResponse

    Definition Classes
    ResponseBuilder
  96. def paymentRequired: HttpResponse

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

    Definition Classes
    ResponseBuilder
  98. def post(url: String)(p: Processor): HttpEndpoint

    Definition Classes
    HttpEndpointProvider
  99. def preconditionFailed: HttpResponse

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

    Definition Classes
    ResponseImplicits
  101. def proxyAuthenticationRequired: HttpResponse

    Definition Classes
    ResponseBuilder
  102. def put(url: String)(p: Processor): HttpEndpoint

    Definition Classes
    HttpEndpointProvider
  103. def rateLimit(requestsPerSecond: Double, warmupPeriod: FiniteDuration)(f: Processor): Processor

    Definition Classes
    DefaultProcessors
  104. def rateLimit(limiter: RateLimiter)(f: Processor): Processor

    Definition Classes
    DefaultProcessors
  105. def requestEntityTooLarge: HttpResponse

    Definition Classes
    ResponseBuilder
  106. def requestHeaderFieldsTooLarge: HttpResponse

    Definition Classes
    ResponseBuilder
  107. def requestTimeout: HttpResponse

    Definition Classes
    ResponseBuilder
  108. def requestURITooLong: HttpResponse

    Definition Classes
    ResponseBuilder
  109. def requestedRangeNotSatisfiable: HttpResponse

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

    Definition Classes
    EntityProcessors
  111. def resetContent: HttpResponse

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

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

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

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

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

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

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

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

    Definition Classes
    ResponseImplicits
  120. 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.

    Definition Classes
    DefaultProcessors
  121. def seeOther(location: String): HttpResponse

    Definition Classes
    ResponseBuilder
  122. def serviceUnavailable: HttpResponse

    Definition Classes
    ResponseBuilder
  123. 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
  124. 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
  125. 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
  126. 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
  127. def status(s: Int, reason: String): HttpResponse

    Definition Classes
    ResponseBuilder
  128. 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
  129. 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
  130. implicit def statusToEndpointFn(s: HttpStatus): Processor

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

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

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

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

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

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

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

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

    Definition Classes
    ResponseBuilder
  139. def toString(): String

    Definition Classes
    AnyRef → Any
  140. def tooManyRequests: HttpResponse

    Definition Classes
    ResponseBuilder
  141. def trace(url: String)(p: Processor): HttpEndpoint

    Definition Classes
    HttpEndpointProvider
  142. implicit def tryToEndpointFn(t: Try[_]): Processor

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

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

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

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

    Definition Classes
    ResponseImplicits
  147. def unauthorized: HttpResponse

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

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

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

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

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

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

    Definition Classes
    ResponseBuilder
  154. def unprocessableEntity: HttpResponse

    Definition Classes
    ResponseBuilder
  155. def unsupportedMediaType: HttpResponse

    Definition Classes
    ResponseBuilder
  156. def useProxy: HttpResponse

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

    Definition Classes
    HeaderProcessors
  158. 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
  159. final def wait(): Unit

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

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

    Definition Classes
    AnyRef
    Annotations
    @throws( ... )
  162. 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 HttpEndpointProvider

Inherited from DefaultProcessors

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