class HttpFilter extends Filter[Request, Response, Request, Response]
An HTTP filter that handles preflight (OPTIONS) requests and sets CORS response headers as described in the W3C CORS spec.
- Alphabetic
- By Inheritance
- HttpFilter
- Filter
- Function2
- AnyRef
- Any
- Hide All
- Show All
- Public
- Protected
Value Members
- final def !=(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- final def ##: Int
- Definition Classes
- AnyRef → Any
- final def ==(arg0: Any): Boolean
- Definition Classes
- AnyRef → Any
- def addExposedHeaders(response: Response): Response
If the list of exposed headers is not empty add one or more Access-Control-Expose- Headers headers, with as values the header field names given in the list of exposed headers.
If the list of exposed headers is not empty add one or more Access-Control-Expose- Headers headers, with as values the header field names given in the list of exposed headers.
By not adding the appropriate headers resource can also clear the preflight result cache of all entries where origin is a case-sensitive match for the value of the Origin header and url is a case-sensitive match for the URL of the resource.
- Attributes
- protected[this]
- def agnosticAndThen(next: TypeAgnostic): Filter[Request, Response, Request, Response]
Convert the Filter.TypeAgnostic filter to a Filter and chain it with
andThen
.Convert the Filter.TypeAgnostic filter to a Filter and chain it with
andThen
.- Definition Classes
- Filter
- def andThen(factory: ServiceFactory[Request, Response]): ServiceFactory[Request, Response]
Terminates a filter chain in a ServiceFactory.
Terminates a filter chain in a ServiceFactory. For example,
myFilter.andThen(myServiceFactory)
- factory
a service factory that takes the output request type and the input response type.
- Definition Classes
- Filter
- def andThen(service: Service[Request, Response]): Service[Request, Response]
Terminates a filter chain in a Service.
- def andThen[Req2, Rep2](next: Filter[Request, Response, Req2, Rep2]): Filter[Request, Response, Req2, Rep2]
Chains a series of filters together:
Chains a series of filters together:
myModularService = handleExceptions.andThen(thrift2Pojo.andThen(parseString))
- next
another filter to follow after this one
- Definition Classes
- Filter
- Note
synchronously thrown exceptions in the underlying service are automatically lifted into Future.exception.
- def andThenIf[Req2 >: Request, Rep2 <: Response](condAndFilter: (Boolean, Filter[Request, Response, Req2, Rep2])): Filter[Request, Response, Req2, Rep2]
Conditionally propagates requests down the filter chain.
Conditionally propagates requests down the filter chain. This may be useful if you are statically wiring together filter chains based on a configuration file, for instance.
- condAndFilter
a tuple of boolean and filter.
- Definition Classes
- Filter
- def andThenIf[Req2 >: Request, Rep2 <: Response](conditional: Boolean, filter: Filter[Request, Response, Req2, Rep2]): Filter[Request, Response, Req2, Rep2]
Conditionally propagates requests down the filter chain.
Conditionally propagates requests down the filter chain. This may be useful if you are statically wiring together filter chains based on a configuration file, for instance.
- conditional
a boolean value indicating whether the filter should be included in the filter chain.
- filter
the filter to be conditionally included.
- Definition Classes
- Filter
- def apply(request: Request, service: Service[Request, Response]): Future[Response]
Fully handle preflight requests.
Fully handle preflight requests. If a preflight request is deemed to be unacceptable, a 200 OK response is served without CORS headers.
Adds CORS response headers onto all non-preflight requests that have the 'Origin' header set to a value that is allowed by the Policy.
- request
the input request type
- service
a service that takes the output request type and the input response type
- Definition Classes
- HttpFilter → Filter → Function2
- final def asInstanceOf[T0]: T0
- Definition Classes
- Any
- def clone(): AnyRef
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.CloneNotSupportedException]) @native()
- def curried: (Request) => (Service[Request, Response]) => Future[Response]
- Definition Classes
- Function2
- Annotations
- @unspecialized()
- final def eq(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- def equals(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef → Any
- def finalize(): Unit
- Attributes
- protected[lang]
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.Throwable])
- final def getClass(): Class[_ <: AnyRef]
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- def getHeaders(request: Request): Seq[String]
Let header field-names be the values as result of parsing the Access-Control-Request-Headers headers.
Let header field-names be the values as result of parsing the Access-Control-Request-Headers headers. If there are no Access-Control-Request-Headers headers let header field-names be the empty list.
- Attributes
- protected[this]
- def getMethod(request: Request): Option[String]
Let method be the value as result of parsing the Access-Control-Request-Method header.
Let method be the value as result of parsing the Access-Control-Request-Method header.
- Attributes
- protected[this]
- def getOrigin(request: Request): Option[String]
- Attributes
- protected[this]
- def handlePreflight(request: Request): Option[Response]
https://www.w3.org/TR/cors/#resource-preflight-requests
https://www.w3.org/TR/cors/#resource-preflight-requests
- Attributes
- protected[this]
- def handleSimple(request: Request, response: Response): Response
https://www.w3.org/TR/cors/#resource-requests
https://www.w3.org/TR/cors/#resource-requests
- Attributes
- protected[this]
- def hashCode(): Int
- Definition Classes
- AnyRef → Any
- Annotations
- @native()
- final def isInstanceOf[T0]: Boolean
- Definition Classes
- Any
- final def ne(arg0: AnyRef): Boolean
- Definition Classes
- AnyRef
- final def notify(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- final def notifyAll(): Unit
- Definition Classes
- AnyRef
- Annotations
- @native()
- def setVary(response: Response): Response
Resources that wish to enable themselves to be shared with multiple Origins but do not respond uniformly with "*" must in practice generate the Access-Control-Allow-Origin header dynamically in response to every request they wish to allow.
Resources that wish to enable themselves to be shared with multiple Origins but do not respond uniformly with "*" must in practice generate the Access-Control-Allow-Origin header dynamically in response to every request they wish to allow. As a consequence, authors of such resources should send a Vary: Origin HTTP header or provide other appropriate control directives to prevent caching of such responses, which may be inaccurate if re-used across- origins.
- final def synchronized[T0](arg0: => T0): T0
- Definition Classes
- AnyRef
- def toString(): String
- Definition Classes
- Filter → Function2 → AnyRef → Any
- def tupled: ((Request, Service[Request, Response])) => Future[Response]
- Definition Classes
- Function2
- Annotations
- @unspecialized()
- final def wait(): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long, arg1: Int): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException])
- final def wait(arg0: Long): Unit
- Definition Classes
- AnyRef
- Annotations
- @throws(classOf[java.lang.InterruptedException]) @native()
- object Preflight
- Attributes
- protected[this]