com.sksamuel.scruffy.processors
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.
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
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.
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