Config
Config
Config class that exposes config instance, Where the user can provide other configurations on the stack
earlyAccess
With the earlyAccess header support, you can access features that are part of the early access program.
Config config = new Config();
String[] earlyAccess = {"Taxonomy", "Teams", "Terms", "LivePreview"};
config.setEarlyAccess(earlyAccess);
Stack stack = Contentstack.stack(API_KEY, DELIVERY_TOKEN, ENV, config);getBranch
Get branch of the stack
import com.contentstack.sdk.*; Config config = new Config(); config.getBranch(); Stack stack = Contentstack.stack(apiKey, deliveryToken, environment, config);
setBranch
Set branch for on the stack
| Name | Type | Description |
|---|---|---|
| branch (required) | String | branch you want to set |
import com.contentstack.sdk.*;
Config config = new Config();
config.setBranch("branchName");
Stack stack = Contentstack.stack(apiKey, deliveryToken, environment, config);setProxy
Sets custom proxy
| Name | Type | Description |
|---|---|---|
| proxy (required) | Proxy | Proxy setting, typically a type (http, socks) and a socket address. A Proxy is an immutable object |
import com.contentstack.sdk.*;
import java.net.*;
java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", "proxyPort"));
Config config = new Config();
config.setProxy(proxy);getProxy
Returns the Proxy instance
import com.contentstack.sdk.*;
Config config = new Config();
config.getProxy();
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);connectionPool
Manages reuse of HTTP and HTTP/2 connections for reduced network latency. HTTP requests that * share the same {@link okhttp3.Address} may share a {@link okhttp3.Connection}. This class implements the policy of which connections to keep open for future use.
| Name | Type | Description |
|---|---|---|
| maxIdleConnections (required) | Int | the maxIdleConnections default value is 5 |
| keepAliveDuration (required) | long | the keepAliveDuration default value is 5 |
| timeUnit (required) | TimeUnit | the timeUnit default value is TimeUnit.MINUTES |
import com.contentstack.sdk.*;
Config config = new Config();
config.connectionPool(maxIdleConnections, keepAliveDuration, timeUnit);
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);getRegion
Get Region of the request url
import com.contentstack.sdk.*;
Config config = new Config();
config.getRegion();
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);setRegion()
Sets Region of the database
| Name | Type | Description |
|---|---|---|
| region (required) | ContentstackRegion | DB region for your stack. You can choose from six regions namely, NA, EU, Azure NA, Azure EU, GCP NA, and GCP EU. |
import com.contentstack.sdk.*;
Config config = new Config();
config.setRegion(ContentstackRegion.EU);
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);getHost()
Gets host of the request
import com.contentstack.sdk.*;
Config config = new Config();
config.getHost();
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);setHost()
Set custom host of the request url
| Name | Type | Description |
|---|---|---|
| hostname (required) | String | The host |
import com.contentstack.sdk.*;
Config config = new Config();
config.sethost(hostname);
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);getVersion()
Gets version of the request path
import com.contentstack.sdk.*;
Config config = new Config();
config.getVersion();
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);enableLivePreview()
Enables Live Preview
| Name | Type | Description |
|---|---|---|
| enable (required) | Boolean | Provide true to enable the Live Preview |
import com.contentstack.sdk.*;
Config config = new Config();
config.enableLivePreview(true);
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);setLivePreviewHost()
Sets Host to the Live Preview request url
| Name | Type | Description |
|---|---|---|
| livePreviewHost (required) | String | Host for Live Preview |
import com.contentstack.sdk.*;
Config config = new Config();
config.setLivePreviewHost(host);
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);setManagementToken()
Adds Management Token to the stack header
| Name | Type | Description |
|---|---|---|
| managementToken (required) | String | The Management Token |
import com.contentstack.sdk.*;
Config config = new Config();
config.setManagementToken(managementToken);
Stack stack = Contentstack.stack("apiKey", "deliveryToken", "environment", config);