Builder to assist in creating SlingHttpServletResponse
objects.
Type Params | Return Type | Name and description |
---|---|---|
|
MockSlingHttpServletResponse |
build() Build a Sling response with default values. |
|
MockSlingHttpServletResponse |
build(Closure closure) Build a Sling response using a closure to set response properties. |
Build a Sling response with default values.
Build a Sling response using a closure to set response properties. The closure delegates to an instance of MockSlingHttpServletResponse, so methods on the response instance may be called directly in the closure (see example below).
new ResponseBuilder().build { status = 200 characterEncoding = "UTF-8" contentType = "application/json" addHeader "Connection", "close" }
closure
- closure that delegates to MockSlingHttpServletResponse