Initializer
Request(Uri uri, Method method = ..., ByteBuffer|String? data = null, String dataContentType = ..., Charset bodyCharset = ..., {Parameter*} initialParameters = ..., {Header*} initialHeaders = ...)
Parameters:
  • uri

    This request URI, must be absolute.

  • method = get

    The request method, such as GET, POST

  • data = null

    Data of type dataContentType to include in the request body. Usually this is null for idempotent methods (GET, HEAD, etc.), but it does not have to be.

    If parameters is not empty, and method is post, then the parameters will be used instead of this value. String values will be encoded with bodyCharset.

  • dataContentType = "application/octet-stream"

    Content-Type (MIME) value for data. As with data, if parameters is not empty, and method is post, then this will not be used (contentTypeFormUrlEncoded will be used instead).

  • bodyCharset = utf8

    Charset to use when encoding the the request body. This will not be used if data is selected as the body, and it is a ByteBuffer.

  • initialParameters = empty

    The initial values for parameters

  • initialHeaders = empty

    The initial values for headers

Attributes
bodyCharsetSource Codeshared Charset bodyCharset

Charset to use when encoding the the request body. This will not be used if data is selected as the body, and it is a ByteBuffer.

dataSource Codeshared ByteBuffer|String? data

Data of type dataContentType to include in the request body. Usually this is null for idempotent methods (GET, HEAD, etc.), but it does not have to be.

If parameters is not empty, and method is post, then the parameters will be used instead of this value. String values will be encoded with bodyCharset.

dataContentTypeSource Codeshared String dataContentType

Content-Type (MIME) value for data. As with data, if parameters is not empty, and method is post, then this will not be used (contentTypeFormUrlEncoded will be used instead).

headersSource Codeshared MutableList<Header> headers

The list of request headers. Initialised by initialHeaders.

hostSource Codeshared String host

The host to connect to. Extracted from the specified uri.

methodSource Codeshared Method method

The request method, such as GET, POST

parametersSource Codeshared MutableList<Parameter> parameters

The list of request parameters. Initialised by initialParameters.

portSource Codeshared variable Integer port

The port to connect to. Defaults to 80 for http Uris and to 443 for https uris, unless overridden in the uri.

sslSource Codeshared variable Boolean ssl

Set to true to use SSL. Defaults to true for port 443.

uriSource Codeshared Uri uri

This request URI, must be absolute.

Inherited Attributes
Attributes inherited from: Object
Methods
executeSource Codeshared Response execute()

Executes this request by connecting to the server and returns a Response.

getHeaderSource Codeshared Header? getHeader(String name)

Returns the first request header with name equal to name, if one exists. The comparison is case insensitive. Use getHeaders() to find multiple items with the same name.

getHeadersSource Codeshared Header[]? getHeaders(String name)

Returns a sequence of request headers with names equal to name. The comparison is case insensitive.

getParameterSource Codeshared Parameter? getParameter(String name)

Returns the first parameter with name equal to name, if one exists. Use getParameters() to find multiple items with the same name.

getParametersSource Codeshared Parameter[] getParameters(String name)

Returns a sequence of parameters with names equal to name.

setHeaderSource Codeshared void setHeader(String name, String[] values)

Adds all values to the first request header with name equal to name, creating the header if it does not exist.

setParameterSource Codeshared void setParameter(Parameter parameter)
Inherited Methods
Methods inherited from: Object