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.
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.
Processor that requires the request to identify itself as an ajax request by incuding the X-Requested-With header set to value "XMLRequest"
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]" } } }
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.
A processor that sets the content type of the request.
A processor that sets the content type of the request.
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.
the cookie name that must be present on the request
this
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.
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.
the header that must be present on the request
this
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.
the header that must be present on the request
this
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 HTTPS / secure
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
Processes request only if the ipaddress in the request matches the given regex.
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.
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.
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.
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.
the inner processor function that accepts a String, which is the schema value.
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.
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.
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
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.
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
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
The regex to match on the user agent
The regex to match on the user agent
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.