HTTP Built-ins - RequestConfig¶
The configure()
function returns a customizable RequestConfig
object. All RequestConfig.Builder
methods described in the Apache documentation may be chained to this function. HTTP Built-ins also provide functionality to create new HTTP hosts and Inet addresses, which may be required by some configuration methods (for example, setProxy()
, setLocalAddress()
).
Configure ¶
Creates the customizable RequestConfig
object.
Syntax
1 | <configurer RequestConfigBuilder> := Http.configure() |
Returns
The RequestConfig
object.
Example
1 2 3 | Http.get("http://some.redirection") .setConfig(Http.configure().setRedirectsEnabled(false).setConnectTimeout(100000).build()) .build() |
By default, HTTP Built-ins make automatic redirects. The example above switches off redirection.
New HTTP Host ¶
Creates a new HttpHost
instance.
Syntax
1 2 3 | <newHost HttpHost> := Http.newHttpHost(<hostname String>) <newHost HttpHost> := Http.newHttpHost(<hostname String>, <port Number>) <newHost HttpHost> := Http.newHttpHost(<hostname String>, <port Number>, <scheme String>) |
Returns
The new HttpHost
instance.
Parameters
-
hostname - The host's DNS or IP name
-
port - The host's port number
- If not specified, the default port
80
is used
- If not specified, the default port
-
scheme - The host's scheme name
- If not specified, the default scheme is used
Example
1 | newhost := Http.newHttpHost("newurl.com", 443, "https") |
New Inet Address ¶
Creates a new Inet Address.
Syntax
1 | <inetAddress InetAddress> := Http.newInetAddress(<host String>) |
Returns
A new Inet address.
Parameter
- host - The Inet address' HTTP host
Example
1 | testinetaddress := Http.newInetAddress("127.0.0.1") |
New Local Host Inet Address ¶
Creates an instance of the local machine's host name and IP address.
Syntax
1 | <localhostAddress InetAddress> := Http.newLocalHostInetAddress() |
Returns
The local host name and IP address instance.
Example
1 | httpNewInetAddress := := Http.newLocalHostInetAddress() |
New Loopback Inet Address ¶
Creates an instance of the local machine's loopback address.
Syntax
1 | <loopbackAddress InetAddress> := Http.newLoopbackInetAddress() |
Returns
The local machine's loopback address instance.
Example
1 | httpLoopbackAddress := Http.newLoopbackInetAddress() |