def http = HttpBuilder.configure {
cookieVersion = 1
}
public static interface HttpObjectConfig.Client
The Client
configuration interface allows configuration of client-centric properties. Currently, the only supported property is cookieVersion
which is the supported HTTP Cookie version used by the underlying clients. The HttpBuilder
implementations will support Cookies at
version 0
by default, which is what the Java Servlet API accepts by default. This can be modified, but care must be taken to ensure that your
server supports and accepts the configured Cookie version.
def http = HttpBuilder.configure {
cookieVersion = 1
}
Modifier and Type | Method and Description |
---|---|
void |
clientCustomizer(java.util.function.Consumer<java.lang.Object> customizer)
A
Consumer<Object> may be provided, which will have the internal client implementation reference passed into it to allow further
client configuration beyond what it supported directly by HttpBuilder-NG. |
java.util.function.Consumer<java.lang.Object> |
getClientCustomizer()
Used to retrieve the configured client implementation customizer
Consumer , if there is one. |
java.io.File |
getCookieFolder()
Retrieves the location for storing persistent cookies
|
boolean |
getCookiesEnabled()
Retrieves whether cookies are enabled or disabled
|
int |
getCookieVersion()
Retrieves the supported Cookie version.
|
void |
setCookieFolder(java.io.File folder)
Specifies the location for storing cookies that will persist after your application terminates.
|
void |
setCookiesEnabled(boolean val)
Used to enable or disable cookies.
|
void |
setCookieVersion(int version)
Used to specify the supported Cookie version.
|
void setCookieVersion(int version)
Used to specify the supported Cookie version. If not specified, a default of 0
is used to conform with the default used in the
Java Servlet Cookie API. Be aware that if you change the version here, you may need to modify the version expected by your server.
version
- the Cookie version to be used.int getCookieVersion()
Retrieves the supported Cookie version. A version of 0
will be returned, if not explicitly overridden.
void setCookieFolder(java.io.File folder)
Specifies the location for storing cookies that will persist after your application terminates. If no folder is specified an in memory cookie store and no cookies will be persisted after your application terminates. If cookies are found here then the cookies will be loaded prior to sending any requests to remote servers.
folder
- the folder used to store the cookies.java.io.File getCookieFolder()
Retrieves the location for storing persistent cookies
void setCookiesEnabled(boolean val)
Used to enable or disable cookies.
val
- true if cookies are enabled, false if not enabled.boolean getCookiesEnabled()
Retrieves whether cookies are enabled or disabled
void clientCustomizer(java.util.function.Consumer<java.lang.Object> customizer)
A Consumer<Object>
may be provided, which will have the internal client implementation reference passed into it to allow further
client configuration beyond what it supported directly by HttpBuilder-NG. The Object
passed in will be an instance of the internal client
builder type, not necessarily the client itself.
This configuration method should only be used when the desire configuration is not available directly through the HttpBuilder
configuration interfaces. Configuring in this manner may override helpful configuration already applied by the library.
Note that a Groovy closure may be used to replace the Consumer
with no modification of functionality.
This operation is optional. If a client-implementation does not support it, an UnsupportedOperationException
will be thrown.
java.util.function.Consumer<java.lang.Object> getClientCustomizer()
Used to retrieve the configured client implementation customizer Consumer
, if there is one.