Package net.officefloor.server.http.mock
Interface MockHttpRequestBuilder
-
public interface MockHttpRequestBuilder
Builder for a mockHttpRequest
.- Author:
- Daniel Sagenschneider
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description HttpRequest
build()
Builds a mockHttpRequest
from thisMockHttpRequestBuilder
configuration.MockHttpRequestBuilder
cookie(java.lang.String name, java.lang.String value)
Adds aHttpRequestCookie
.MockHttpRequestBuilder
cookies(MockHttpResponse response)
Adds all the appropriateWritableHttpCookie
instances from theMockHttpResponse
.MockHttpRequestBuilder
entity(java.lang.String entity)
Sets the HTTP entity.java.io.OutputStream
getHttpEntity()
Obtains theOutputStream
to write the HTTP entity.MockHttpRequestBuilder
header(java.lang.String name, java.lang.String value)
Adds aHttpHeader
.MockHttpRequestBuilder
method(HttpMethod method)
Specifies theHttpMethod
.MockHttpRequestBuilder
secure(boolean isSecure)
Flags with theHttpRequest
is secure.MockHttpRequestBuilder
setEfficientForStressTests(boolean isStress)
Flags to turn off checks forHttpRequest
and provide efficient processing.MockHttpRequestBuilder
uri(java.lang.String requestUri)
Specifies the request URI.MockHttpRequestBuilder
version(HttpVersion version)
Specifies theHttpVersion
.
-
-
-
Method Detail
-
secure
MockHttpRequestBuilder secure(boolean isSecure)
Flags with theHttpRequest
is secure.- Parameters:
isSecure
-true
if secureHttpRequest
.- Returns:
this
.
-
method
MockHttpRequestBuilder method(HttpMethod method)
Specifies theHttpMethod
.- Parameters:
method
-HttpMethod
.- Returns:
this
.
-
uri
MockHttpRequestBuilder uri(java.lang.String requestUri)
Specifies the request URI.- Parameters:
requestUri
- Request URI.- Returns:
this
.
-
version
MockHttpRequestBuilder version(HttpVersion version)
Specifies theHttpVersion
.- Parameters:
version
-HttpVersion
.- Returns:
this
.
-
header
MockHttpRequestBuilder header(java.lang.String name, java.lang.String value)
Adds aHttpHeader
.- Parameters:
name
-HttpHeader
name.value
-HttpHeader
value.- Returns:
this
.
-
cookie
MockHttpRequestBuilder cookie(java.lang.String name, java.lang.String value)
Adds aHttpRequestCookie
.- Parameters:
name
-HttpRequestCookie
name.value
-HttpRequestCookie
value.- Returns:
this
.
-
cookies
MockHttpRequestBuilder cookies(MockHttpResponse response)
Adds all the appropriate
WritableHttpCookie
instances from theMockHttpResponse
.This is a convenience method to enable sending back
HttpRequestCookie
instances received on a previousMockHttpResponse
.- Parameters:
response
-MockHttpResponse
.- Returns:
this
.
-
entity
MockHttpRequestBuilder entity(java.lang.String entity)
Sets the HTTP entity.- Parameters:
entity
- Entity content.- Returns:
this
.
-
getHttpEntity
java.io.OutputStream getHttpEntity()
Obtains theOutputStream
to write the HTTP entity.- Returns:
OutputStream
to write the HTTP entity.
-
setEfficientForStressTests
MockHttpRequestBuilder setEfficientForStressTests(boolean isStress)
Flags to turn off checks forHttpRequest
and provide efficient processing.- Parameters:
isStress
-true
to turn off checks and process more efficiently.- Returns:
this
.
-
build
HttpRequest build()
Builds a mock
HttpRequest
from thisMockHttpRequestBuilder
configuration.This is useful for testing to create a mock
HttpRequest
.- Returns:
- Mock
HttpRequest
.
-
-