Class SimpleRequest.Builder
java.lang.Object
com.atlassian.oai.validator.model.SimpleRequest.Builder
- Enclosing class:
- SimpleRequest
A builder for constructing new
SimpleRequest instances.-
Constructor Summary
ConstructorsConstructorDescriptionBuilder(Request.Method method, String path) Creates aSimpleRequest.Builderwith the given HTTPRequest.Methodand path.Builder(Request.Method method, String path, boolean queryParametersCaseSensitive) Creates aSimpleRequest.Builderwith the given HTTPRequest.Methodand path including the specification if the query parameters are handled case sensitive or not.Creates aSimpleRequest.Builderwith the given HTTP method and path.Creates aSimpleRequest.Builderwith the given HTTP method and path including the specification if the query parameters are handled case sensitive or not. -
Method Summary
Modifier and TypeMethodDescriptionbuild()Builds aSimpleRequestout of this builder.static SimpleRequest.BuilderA convenience method for creating aSimpleRequest.Builderwith HTTP method DELETE and the given path.static SimpleRequest.BuilderA convenience method for creating aSimpleRequest.Builderwith HTTP method GET and the given path.static SimpleRequest.BuilderA convenience method for creating aSimpleRequest.Builderwith HTTP method HEAD and the given path.static SimpleRequest.BuilderA convenience method for creating aSimpleRequest.Builderwith HTTP method OPTIONS and the given path.static SimpleRequest.BuilderA convenience method for creating aSimpleRequest.Builderwith HTTP method PATCH and the given path.static SimpleRequest.BuilderA convenience method for creating aSimpleRequest.Builderwith HTTP method POST and the given path.static SimpleRequest.BuilderA convenience method for creating aSimpleRequest.Builderwith HTTP method PUT and the given path.static SimpleRequest.BuilderA convenience method for creating aSimpleRequest.Builderwith HTTP method TRACE and the given path.withAccept(String... accept) Sets the accept header on this builder.withAuthorization(String auth) Sets the authorization header on this builder.withBody(byte[] content) Adds a request body as byte array to this builder.Adds a requestBodyto this builder.withBody(InputStream content) Adds a request body asInputStreamto this builder.Adds a request body asStringto this builder.withContentType(String contentType) Sets the content type header on this builder.withHeader(String name, String... values) Adds a request header to this builder.withHeader(String name, List<String> values) Adds a request header to this builder.withQueryParam(String name, String... values) Adds a query parameter to this request builder.withQueryParam(String name, List<String> values) Adds a query parameter to this request builder.
-
Constructor Details
-
Builder
Creates aSimpleRequest.Builderwith the given HTTP method and path.- Parameters:
method- the HTTP methodpath- the requests path
-
Builder
Creates aSimpleRequest.Builderwith the given HTTPRequest.Methodand path.- Parameters:
method- the HTTP methodpath- the requests path
-
Builder
Creates aSimpleRequest.Builderwith the given HTTP method and path including the specification if the query parameters are handled case sensitive or not.- Parameters:
method- the HTTP methodpath- the requests pathqueryParametersCaseSensitive- flag if the query parameters are handled case sensitive or not
-
Builder
Creates aSimpleRequest.Builderwith the given HTTPRequest.Methodand path including the specification if the query parameters are handled case sensitive or not.- Parameters:
method- the HTTP methodpath- the requests pathqueryParametersCaseSensitive- flag if the query parameters are handled case sensitive or not
-
-
Method Details
-
get
A convenience method for creating aSimpleRequest.Builderwith HTTP method GET and the given path.- Parameters:
path- the requests path- Returns:
- a prepared
SimpleRequest.Builder
-
put
A convenience method for creating aSimpleRequest.Builderwith HTTP method PUT and the given path.- Parameters:
path- the requests path- Returns:
- a prepared
SimpleRequest.Builder
-
post
A convenience method for creating aSimpleRequest.Builderwith HTTP method POST and the given path.- Parameters:
path- the requests path- Returns:
- a prepared
SimpleRequest.Builder
-
delete
A convenience method for creating aSimpleRequest.Builderwith HTTP method DELETE and the given path.- Parameters:
path- the requests path- Returns:
- a prepared
SimpleRequest.Builder
-
patch
A convenience method for creating aSimpleRequest.Builderwith HTTP method PATCH and the given path.- Parameters:
path- the requests path- Returns:
- a prepared
SimpleRequest.Builder
-
head
A convenience method for creating aSimpleRequest.Builderwith HTTP method HEAD and the given path.- Parameters:
path- the requests path- Returns:
- a prepared
SimpleRequest.Builder
-
options
A convenience method for creating aSimpleRequest.Builderwith HTTP method OPTIONS and the given path.- Parameters:
path- the requests path- Returns:
- a prepared
SimpleRequest.Builder
-
trace
A convenience method for creating aSimpleRequest.Builderwith HTTP method TRACE and the given path.- Parameters:
path- the requests path- Returns:
- a prepared
SimpleRequest.Builder
-
withBody
Adds a request body asStringto this builder.The charset of the request body will be extracted from the content-type header during
build(). If no such header is specified UTF-8 is used.For better performance use
withBody(byte[])orwithBody(InputStream)if possible.- Parameters:
content- the request body- Returns:
- this builder
- See Also:
-
withBody
Adds a request body asStringand itsCharsetto this builder.For better performance use
withBody(byte[])orwithBody(InputStream)if possible.- Parameters:
content- the request bodycharset- theCharsetof the request body- Returns:
- this builder
-
withBody
Adds a request body as byte array to this builder.- Parameters:
content- the request body- Returns:
- this builder
-
withBody
Adds a request body asInputStreamto this builder.- Parameters:
content- the request body stream- Returns:
- this builder
-
withBody
Adds a requestBodyto this builder.- Parameters:
content- the requestBody- Returns:
- this builder
-
withHeader
Adds a request header to this builder. If there was already a header with this name the values will be added.Headers are treated case insensitive.
- Parameters:
name- the header namevalues- the values for this header- Returns:
- this builder
-
withHeader
Adds a request header to this builder. If there was already a header with this name the values will be added.Headers are treated case insensitive.
- Parameters:
name- the header namevalues- the values for this header- Returns:
- this builder
-
withContentType
Sets the content type header on this builder.Equivalent to:
withHeader("Content-Type", contentType);- Parameters:
contentType- The content type to set- Returns:
- this builder
-
withAccept
Sets the accept header on this builder.Equivalent to:
withHeader("Accept", contentType);- Parameters:
accept- The accept type(s) to set- Returns:
- this builder
-
withAuthorization
Sets the authorization header on this builder.Equivalent to:
withHeader("Authorization", contentType);- Parameters:
auth- The authorization header to set- Returns:
- this builder
-
withQueryParam
Adds a query parameter to this request builder. If there was already a query parameter with this name the values will be added.The case sensitivity can be set by this builder's Builder(Method, String, boolean) constructor.
- Parameters:
name- the header namevalues- the values for this header- Returns:
- this builder
-
withQueryParam
Adds a query parameter to this request builder. If there was already a query parameter with this name the values will be added.The case sensitivity can be set by this builder's Builder(String, String, boolean) constructor.
- Parameters:
name- the header namevalues- the values for this header- Returns:
- this builder
-
build
Builds aSimpleRequestout of this builder.- Returns:
- the build
SimpleRequest
-