本文整理汇总了Java中cn.jiguang.common.ClientConfig类的典型用法代码示例。如果您正苦于以下问题:Java ClientConfig类的具体用法?Java ClientConfig怎么用?Java ClientConfig使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ClientConfig类属于cn.jiguang.common包,在下文中一共展示了ClientConfig类的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: NettyHttpClient
import cn.jiguang.common.ClientConfig; //导入依赖的package包/类
public NettyHttpClient(String authCode, HttpProxy proxy, ClientConfig config) {
_maxRetryTimes = config.getMaxRetryTimes();
_readTimeout = config.getReadTimeout();
String message = MessageFormat.format("Created instance with "
+ "connectionTimeout {0}, readTimeout {1}, maxRetryTimes {2}, SSL Version {3}",
config.getConnectionTimeout(), _readTimeout, _maxRetryTimes, config.getSSLVersion());
LOG.debug(message);
_authCode = authCode;
try {
_sslCtx = SslContextBuilder.forClient().trustManager(InsecureTrustManagerFactory.INSTANCE).build();
_workerGroup = new NioEventLoopGroup();
b = new Bootstrap(); // (1)
b.group(_workerGroup); // (2)
b.channel(NioSocketChannel.class); // (3)
b.option(ChannelOption.SO_KEEPALIVE, true); // (4)
} catch (SSLException e) {
e.printStackTrace();
}
}
示例2: PushClient
import cn.jiguang.common.ClientConfig; //导入依赖的package包/类
/**
* Create a Push Client with max retry times.
* This will be removed in the future. Please use ClientConfig{jiguang-common cn.jiguang.common.ClientConfig} instead of this constructor.
*
* @param masterSecret API access secret of the appKey.
* @param appKey The KEY of one application on JPush.
* @param maxRetryTimes max retry times
* @param proxy The max retry times.
*/
@Deprecated
public PushClient(String masterSecret, String appKey, int maxRetryTimes, HttpProxy proxy) {
ServiceHelper.checkBasic(appKey, masterSecret);
ClientConfig conf = ClientConfig.getInstance();
conf.setMaxRetryTimes(maxRetryTimes);
this._baseUrl = (String) conf.get(ClientConfig.PUSH_HOST_NAME);
this._pushPath = (String) conf.get(ClientConfig.PUSH_PATH);
this._pushValidatePath = (String) conf.get(ClientConfig.PUSH_VALIDATE_PATH);
this._apnsProduction = (Integer) conf.get(ClientConfig.APNS_PRODUCTION);
this._timeToLive = (Long) conf.get(ClientConfig.TIME_TO_LIVE);
String authCode = ServiceHelper.getBasicAuthorization(appKey, masterSecret);
this._httpClient = new NativeHttpClient(authCode, proxy, conf);
}
示例3: DeviceClient
import cn.jiguang.common.ClientConfig; //导入依赖的package包/类
/**
* This will be removed in the future. Please use ClientConfig{jiguang-common cn.jiguang.common.ClientConfig#setMaxRetryTimes} instead of this constructor.
* @param masterSecret API access secret of the appKey.
* @param appKey The KEY of one application on JPush.
* @param maxRetryTimes The max retry times.
* @param proxy The HTTP proxy.
*
*/
@Deprecated
public DeviceClient(String masterSecret, String appKey, int maxRetryTimes, HttpProxy proxy) {
ClientConfig conf = ClientConfig.getInstance();
conf.setMaxRetryTimes(maxRetryTimes);
ServiceHelper.checkBasic(appKey, masterSecret);
hostName = (String) conf.get(ClientConfig.DEVICE_HOST_NAME);
devicesPath = (String) conf.get(ClientConfig.DEVICES_PATH);
tagsPath = (String) conf.get(ClientConfig.TAGS_PATH);
aliasesPath = (String) conf.get(ClientConfig.ALIASES_PATH);
String authCode = ServiceHelper.getBasicAuthorization(appKey, masterSecret);
_httpClient = new NativeHttpClient(authCode, proxy, conf);
}
示例4: ScheduleClient
import cn.jiguang.common.ClientConfig; //导入依赖的package包/类
/**
* This will be removed in the future. Please use ClientConfig{jiguang-common cn.jiguang.common.ClientConfig#setMaxRetryTimes} instead of this constructor.
* @param masterSecret API access secret of the appKey.
* @param appKey The KEY of one application on JPush.
* @param maxRetryTimes The mas retry times.
* @param proxy The proxy, if there is no proxy, should be null.
*/
@Deprecated
public ScheduleClient(String masterSecret, String appKey, int maxRetryTimes, HttpProxy proxy) {
ServiceHelper.checkBasic(appKey, masterSecret);
ClientConfig conf = ClientConfig.getInstance();
conf.setMaxRetryTimes(maxRetryTimes);
hostName = (String) conf.get(ClientConfig.SCHEDULE_HOST_NAME);
schedulePath = (String) conf.get(ClientConfig.SCHEDULE_PATH);
apnsProduction = (Integer) conf.get(ClientConfig.APNS_PRODUCTION);
timeToLive = (Long) conf.get(ClientConfig.TIME_TO_LIVE);
String authCode = ServiceHelper.getBasicAuthorization(appKey, masterSecret);
this._httpClient = new NativeHttpClient(authCode, proxy, conf);
}
示例5: ReportClient
import cn.jiguang.common.ClientConfig; //导入依赖的package包/类
/**
* This will be removed in the future. Please use ClientConfig{jiguang-common cn.jiguang.common.ClientConfig#setMaxRetryTimes} instead of this constructor.
* @param masterSecret API access secret of the appKey.
* @param appKey The KEY of one application on JPush.
* @param maxRetryTimes max retry times
* @param proxy The max retry times.
*
*/
@Deprecated
public ReportClient(String masterSecret, String appKey, int maxRetryTimes, HttpProxy proxy) {
ServiceHelper.checkBasic(appKey, masterSecret);
ClientConfig conf = ClientConfig.getInstance();
conf.setMaxRetryTimes(maxRetryTimes);
_hostName = (String) conf.get(ClientConfig.REPORT_HOST_NAME);
_receivePath = (String) conf.get(ClientConfig.REPORT_RECEIVE_PATH);
_userPath = (String) conf.get(ClientConfig.REPORT_USER_PATH);
_messagePath = (String) conf.get(ClientConfig.REPORT_MESSAGE_PATH);
String authCode = ServiceHelper.getBasicAuthorization(appKey, masterSecret);
_httpClient = new NativeHttpClient(authCode, proxy, conf);
}
示例6: Http2Client
import cn.jiguang.common.ClientConfig; //导入依赖的package包/类
public Http2Client(String authCode, HttpProxy proxy, ClientConfig config) {
_maxRetryTimes = config.getMaxRetryTimes();
_connectionTimeout = config.getConnectionTimeout();
_readTimeout = config.getReadTimeout();
_sslVer = config.getSSLVersion();
_authCode = authCode;
_proxy = proxy;
String message = MessageFormat.format("Created instance with "
+ "connectionTimeout {0}, readTimeout {1}, maxRetryTimes {2}, SSL Version {3}",
_connectionTimeout, _readTimeout, _maxRetryTimes, _sslVer);
LOG.info(message);
if (null != _proxy && _proxy.isAuthenticationNeeded()) {
Authenticator.setDefault(new NativeHttpClient.SimpleProxyAuthenticator(
_proxy.getUsername(), _proxy.getPassword()));
}
}
示例7: NativeHttpClient
import cn.jiguang.common.ClientConfig; //导入依赖的package包/类
public NativeHttpClient(String authCode, HttpProxy proxy, ClientConfig config ) {
_maxRetryTimes = config.getMaxRetryTimes();
_connectionTimeout = config.getConnectionTimeout();
_readTimeout = config.getReadTimeout();
_sslVer = config.getSSLVersion();
_authCode = authCode;
_proxy = proxy;
String message = MessageFormat.format("Created instance with "
+ "connectionTimeout {0}, readTimeout {1}, maxRetryTimes {2}, SSL Version {3}",
_connectionTimeout, _readTimeout, _maxRetryTimes, _sslVer);
LOG.debug(message);
if ( null != _proxy && _proxy.isAuthenticationNeeded()) {
Authenticator.setDefault(new SimpleProxyAuthenticator(
_proxy.getUsername(), _proxy.getPassword()));
}
initSSL(_sslVer);
}
示例8: testCustomClient
import cn.jiguang.common.ClientConfig; //导入依赖的package包/类
public static void testCustomClient() {
ClientConfig config = ClientConfig.getInstance();
config.setMaxRetryTimes(5);
config.setConnectionTimeout(10 * 1000); // 10 seconds
config.setSSLVersion("TLSv1.1"); // JPush server supports SSLv3, TLSv1, TLSv1.1, TLSv1.2
JPushClient jPushClient = new JPushClient(PushConfig.masterSecret, PushConfig.appKey, null, config);
}
示例9: ApacheHttpClient
import cn.jiguang.common.ClientConfig; //导入依赖的package包/类
public ApacheHttpClient(String authCode, HttpProxy proxy, ClientConfig config) {
_maxRetryTimes = config.getMaxRetryTimes();
_connectionTimeout = config.getConnectionTimeout();
_connectionRequestTimeout = config.getConnectionRequestTimeout();
_socketTimeout = config.getSocketTimeout();
_authCode = authCode;
if (proxy != null) {
_proxy = new HttpHost(proxy.getHost(), proxy.getPort());
}
}
示例10: jPushClient
import cn.jiguang.common.ClientConfig; //导入依赖的package包/类
/**
* 创建JpushClient
*
* @return
*/
private JPushClient jPushClient() {
ClientConfig clientConfig = ClientConfig.getInstance();
JPushClient jpushClient = new JPushClient(this.MASTER_SECRET, this.APPKEY, null, clientConfig);
return jpushClient;
}
示例11: getClientConfig
import cn.jiguang.common.ClientConfig; //导入依赖的package包/类
public ClientConfig getClientConfig() {
return clientConfig;
}
示例12: getClientConfig
import cn.jiguang.common.ClientConfig; //导入依赖的package包/类
public ClientConfig getClientConfig() {
return clientConfig;
}
示例13: testCustomPushClient
import cn.jiguang.common.ClientConfig; //导入依赖的package包/类
public static void testCustomPushClient() {
ClientConfig config = ClientConfig.getInstance();
config.setApnsProduction(false); // development env
config.setTimeToLive(60 * 60 * 24); // one day
// config.setGlobalPushSetting(false, 60 * 60 * 24); // development env, one day
JPushClient jPushClient = new JPushClient(PushConfig.masterSecret, PushConfig.appKey, null, config); // JPush client
// PushClient pushClient = new PushClient(masterSecret, appKey, null, config); // push client only
}
示例14: JPushClient
import cn.jiguang.common.ClientConfig; //导入依赖的package包/类
/**
* Create a JPush Client by custom Client configuration.
*
* @param masterSecret API access secret of the appKey.
* @param appKey The KEY of one application on JPush.
* @param proxy The proxy, if there is no proxy, should be null.
* @param conf The client configuration. Can use ClientConfig.getInstance() as default.
*/
public JPushClient(String masterSecret, String appKey, HttpProxy proxy, ClientConfig conf) {
_pushClient = new PushClient(masterSecret, appKey, proxy, conf);
_reportClient = new ReportClient(masterSecret, appKey, proxy, conf);
_deviceClient = new DeviceClient(masterSecret, appKey, proxy, conf);
_scheduleClient = new ScheduleClient(masterSecret, appKey, proxy, conf);
}