Package com.contentstack.sdk
Class Config
- java.lang.Object
-
- com.contentstack.sdk.Config
-
public class Config extends Object
The Config enables optional parameters while passing from stack. You can set different configs params to the stack like host, version, livePreview, endpoint, region, branch etc
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
Config.ContentstackRegion
The enum Contentstack region.
-
Constructor Summary
Constructors Constructor Description Config()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description okhttp3.ConnectionPool
connectionPool(int maxIdleConnections, long keepAliveDuration, TimeUnit timeUnit)
Manages reuse of HTTP and HTTP/2 connections for reduced network latency.Config
enableLivePreview(boolean enableLivePreview)
Enable live preview config.String
getBranch()
String[]
getEarlyAccess()
String
getHost()
Gets host.Proxy
getProxy()
Returns the Proxy instanceConfig.ContentstackRegion
getRegion()
Gets region.String
getVersion()
Gets version.void
setBranch(String branch)
Config
setEarlyAccess(String[] earlyAccess)
void
setHost(String hostName)
Sets host.Config
setLivePreviewHost(String livePreviewHost)
Sets live preview host.Config
setManagementToken(String managementToken)
Sets management token.void
setPlugins(List<ContentstackPlugin> plugins)
Config
setPreviewToken(String previewToken)
Sets preview token.void
setProxy(Proxy proxy)
Proxy can be set like below.Config.ContentstackRegion
setRegion(Config.ContentstackRegion region)
Sets region.
-
-
-
Method Detail
-
getEarlyAccess
public String[] getEarlyAccess()
-
getBranch
public String getBranch()
-
setBranch
public void setBranch(String branch)
-
setProxy
public void setProxy(Proxy proxy)
Proxy can be set like below.- Parameters:
proxy
- Proxy setting, typically a type (http, socks) and a socket address. A Proxy is an immutable object
Example:
java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("proxyHost", "proxyPort")); java.net.Proxy proxy = new Proxy(Proxy.Type.HTTP, new InetSocketAddress("sl.theproxyvpn.io", 80)); Config config = new Config(); config.setProxy(proxy);
-
getProxy
public Proxy getProxy()
Returns the Proxy instance- Returns:
- Proxy
-
connectionPool
public okhttp3.ConnectionPool connectionPool(int maxIdleConnections, long keepAliveDuration, TimeUnit timeUnit)
Manages reuse of HTTP and HTTP/2 connections for reduced network latency. HTTP requests that * share the sameAddress
may share aConnection
. This class implements the policy * of which connections to keep open for future use.- Parameters:
maxIdleConnections
- the maxIdleConnections default value is 5keepAliveDuration
- the keepAliveDuration default value is 5timeUnit
- the timeUnit default value is TimeUnit. MINUTES- Returns:
- ConnectionPool
-
getRegion
public Config.ContentstackRegion getRegion()
Gets region.- Returns:
- the region
-
setRegion
public Config.ContentstackRegion setRegion(Config.ContentstackRegion region)
Sets region.- Parameters:
region
- the region- Returns:
- the region
-
setPlugins
public void setPlugins(List<ContentstackPlugin> plugins)
-
getHost
public String getHost()
Gets host.- Returns:
- the host
-
setHost
public void setHost(String hostName)
Sets host.- Parameters:
hostName
- the host name
-
getVersion
public String getVersion()
Gets version.- Returns:
- the version
-
enableLivePreview
public Config enableLivePreview(boolean enableLivePreview)
Enable live preview config.- Parameters:
enableLivePreview
- to enable live preview- Returns:
- the config
-
setLivePreviewHost
public Config setLivePreviewHost(@NotNull String livePreviewHost)
Sets live preview host.- Parameters:
livePreviewHost
- the live preview host- Returns:
- the live preview host
-
setPreviewToken
public Config setPreviewToken(@NotNull String previewToken)
Sets preview token.- Parameters:
previewToken
- the preview token- Returns:
- the preview token
-
-