public static class DefaultRequest.DefaultRequestBuilder extends Object implements Request.Builder
| Constructor and Description |
|---|
DefaultRequestBuilder(HttpClient httpClient) |
| Modifier and Type | Method and Description |
|---|---|
DefaultRequest |
build() |
ResponsePromise |
delete()
Executes this request through the
HttpClient service as a DELETE operation. |
ResponsePromise |
execute(Request.Method method)
Executes this request through the
HttpClient service using the given HTTP method. |
ResponsePromise |
get()
Executes this request through the
HttpClient service as a GET operation. |
ResponsePromise |
head()
Executes this request through the
HttpClient service as a HEAD operation. |
ResponsePromise |
options()
Executes this request through the
HttpClient service as a OPTIONS operation. |
ResponsePromise |
post()
Executes this request through the
HttpClient service as a POST operation. |
ResponsePromise |
put()
Executes this request through the
HttpClient service as a PUT operation. |
DefaultRequest.DefaultRequestBuilder |
setAccept(String accept)
Sets the Accept header for the request.
|
DefaultRequest.DefaultRequestBuilder |
setAttribute(String name,
String value)
Sets an attribute on the request.
|
DefaultRequest.DefaultRequestBuilder |
setAttributes(Map<String,String> properties)
Sets attributes on the request.
|
DefaultRequest.DefaultRequestBuilder |
setCacheDisabled()
Bypasses the cache for this request
|
DefaultRequest.DefaultRequestBuilder |
setContentCharset(String contentCharset)
Sets the charset for this object's entity, if any.
|
DefaultRequest.DefaultRequestBuilder |
setContentLength(long contentLength)
Set the content length for the message.
|
DefaultRequest.DefaultRequestBuilder |
setContentType(String contentType)
Sets the IANA media type, for the current entity, if any.
|
DefaultRequest.DefaultRequestBuilder |
setEntity(EntityBuilder entityBuilder)
Sets the entity and any associated headers from an entity builder.
|
DefaultRequest.DefaultRequestBuilder |
setEntity(String entity)
Sets this object's entity stream from a string.
|
DefaultRequest.DefaultRequestBuilder |
setEntityStream(InputStream entityStream)
Sets this object's entity as an input stream.
|
DefaultRequest.DefaultRequestBuilder |
setEntityStream(InputStream entityStream,
String charset)
Sets this object's entity as an input stream, encoded with the specified charset.
|
DefaultRequest.DefaultRequestBuilder |
setHeader(String name,
String value)
Sets an HTTP header on this object.
|
DefaultRequest.DefaultRequestBuilder |
setHeaders(Map<String,String> headers)
Copies the specified map of HTTP headers into this object.
|
void |
setMethod(Request.Method method) |
DefaultRequest.DefaultRequestBuilder |
setUri(URI uri)
Sets this request's URI.
|
ResponsePromise |
trace()
Executes this request through the
HttpClient service as a TRACE operation. |
public DefaultRequestBuilder(HttpClient httpClient)
public DefaultRequest.DefaultRequestBuilder setUri(URI uri)
Request.BuildersetUri in interface Request.Builderuri - The URIpublic DefaultRequest.DefaultRequestBuilder setAccept(String accept)
Request.BuildersetAccept in interface Request.Builderaccept - An accept header expression containing media types, ranges, and/or quality factorspublic DefaultRequest.DefaultRequestBuilder setCacheDisabled()
Request.BuildersetCacheDisabled in interface Request.Builderpublic DefaultRequest.DefaultRequestBuilder setAttribute(String name, String value)
Request.BuildersetAttribute in interface Request.Buildername - The attribute namevalue - The attribute valuepublic DefaultRequest.DefaultRequestBuilder setAttributes(Map<String,String> properties)
Request.BuildersetAttributes in interface Request.Builderproperties - A map of attributespublic DefaultRequest.DefaultRequestBuilder setEntity(EntityBuilder entityBuilder)
Request.BuildersetEntity in interface Request.BuilderentityBuilder - An entity builderpublic DefaultRequest.DefaultRequestBuilder setHeader(String name, String value)
CommonsetHeader in interface Common<Request.Builder>setHeader in interface Request.Buildername - The name of the header to be setvalue - The value of the header to be setpublic DefaultRequest.DefaultRequestBuilder setHeaders(Map<String,String> headers)
CommonsetHeaders in interface Common<Request.Builder>headers - A map of HTTP headerspublic DefaultRequest.DefaultRequestBuilder setEntity(String entity)
CommonsetEntity in interface Common<Request.Builder>entity - An entity stringpublic DefaultRequest.DefaultRequestBuilder setEntityStream(InputStream entityStream)
CommonhasReadEntity() state to false. It is recommended to also set this
object's content charset property when setting an entity stream for a textual media type (or
using the overloaded form that takes both the entity stream and charset in the same call).
Clients of this object should assume the HTTP standard of ISO-8859-1 (latin-1)
for the content charset property if a textual media type is set but no explcit charset was
provided for this message. A charset should NOT be provided for entity streams targetting
binary media types.setEntityStream in interface Common<Request.Builder>entityStream - An entity input stream ready to be readpublic DefaultRequest.DefaultRequestBuilder setContentCharset(String contentCharset)
CommonsetContentCharset in interface Common<Request.Builder>contentCharset - The entity's charset value, or nullpublic DefaultRequest.DefaultRequestBuilder setContentType(String contentType)
CommoncontentType argument
also contains charset information, this method will have the side effect of parsing the charset
out and storing the component parts independently. The method getContentCharset() can
be used to retrieve extracted content charset, if present, and getHeader("Content-Type")
can be used to retrieve the entire Content-Type header, complete with charset information, if set.
The content type property is required when an entity is present.setContentType in interface Common<Request.Builder>contentType - An IANA media type with optional charset informationpublic DefaultRequest.DefaultRequestBuilder setEntityStream(InputStream entityStream, String charset)
CommonhasReadEntity() state to false. This
method should only be called for entity streams targetting textual media types -- that is, it's
nonsensical to set the charset of an entity stream for binary media types (e.g. image/*, etc).setEntityStream in interface Common<Request.Builder>entityStream - An entity input stream ready to be readcharset - The charset in which the entity stream is encodedpublic DefaultRequest.DefaultRequestBuilder setContentLength(long contentLength)
Request.BuildersetContentLength in interface Request.BuildercontentLength - The content length. This must be valid (greater than 0).public DefaultRequest build()
public ResponsePromise get()
Request.BuilderHttpClient service as a GET operation.
The request SHOULD NOT contain an entity for the GET operation.get in interface Request.Builderpublic ResponsePromise post()
Request.BuilderHttpClient service as a POST operation.
The request SHOULD contain an entity for the POST operation.post in interface Request.Builderpublic ResponsePromise put()
Request.BuilderHttpClient service as a PUT operation.
The request SHOULD contain an entity for the PUT operation.put in interface Request.Builderpublic ResponsePromise delete()
Request.BuilderHttpClient service as a DELETE operation.
The request SHOULD NOT contain an entity for the DELETE operation.delete in interface Request.Builderpublic ResponsePromise options()
Request.BuilderHttpClient service as a OPTIONS operation.
The request MAY contain an entity for the OPTIONS operation.options in interface Request.Builderpublic ResponsePromise head()
Request.BuilderHttpClient service as a HEAD operation.
The request SHOULD NOT contain an entity for the HEAD operation.head in interface Request.Builderpublic ResponsePromise trace()
Request.BuilderHttpClient service as a TRACE operation.
The request SHOULD contain an entity for the TRACE operation.trace in interface Request.Builderpublic ResponsePromise execute(Request.Method method)
Request.BuilderHttpClient service using the given HTTP method.execute in interface Request.Buildermethod - the HTTP method to use.public void setMethod(Request.Method method)
Copyright © 2012–2018 Atlassian. All rights reserved.