cn.jiguang.common.ClientConfig Java Examples
The following examples show how to use
cn.jiguang.common.ClientConfig.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source Project: anyline Author: anylineorg File: JPushUtil.java License: Apache License 2.0 | 6 votes |
public static JPushUtil getInstance(String key){ if(BasicUtil.isEmpty(key)){ key = "default"; } JPushUtil util = instances.get(key); if(null == util){ util = new JPushUtil(); JPushConfig config = JPushConfig.getInstance(key); util.config = config; ClientConfig clientConfig; clientConfig = ClientConfig.getInstance(); clientConfig.setApnsProduction(false); clientConfig.setTimeToLive(60 * 60 * 24); util.client = new JPushClient(config.MASTER_SECRET, config.APP_KEY, null, clientConfig); instances.put(key, util); } return util; }
Example #2
Source Project: jiguang-java-client-common Author: jpush File: NettyHttpClient.java License: MIT License | 6 votes |
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; _encryptType = config.getEncryptType(); 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(); } }
Example #3
Source Project: jiguang-java-client-common Author: jpush File: Http2Client.java License: MIT License | 6 votes |
public Http2Client(String authCode, HttpProxy proxy, ClientConfig config) { _maxRetryTimes = config.getMaxRetryTimes(); _connectionTimeout = config.getConnectionTimeout(); _readTimeout = config.getReadTimeout(); _sslVer = config.getSSLVersion(); _authCode = authCode; _proxy = proxy; _encryptType = config.getEncryptType(); 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())); } }
Example #4
Source Project: jiguang-java-client-common Author: jpush File: NativeHttpClient.java License: MIT License | 6 votes |
public NativeHttpClient(String authCode, HttpProxy proxy, ClientConfig config ) { _maxRetryTimes = config.getMaxRetryTimes(); _connectionTimeout = config.getConnectionTimeout(); _readTimeout = config.getReadTimeout(); _sslVer = config.getSSLVersion(); _encryptType = config.getEncryptType(); _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); }
Example #5
Source Project: api-boot Author: minbox-projects File: ApiBootMessagePushJiGuangServiceImpl.java License: Apache License 2.0 | 5 votes |
/** * execute push message * * @param messagePushBody request body * @throws ApiBootException ApiBoot Exception */ @Override public void executePush(MessagePushBody messagePushBody) throws ApiBootException { try { // push client config PushClientConfig pushClientConfig = getCurrentPushClient(); // jpush client JPushClient pushClient = new JPushClient(pushClientConfig.getMasterSecret(), pushClientConfig.getAppKey(), null, ClientConfig.getInstance()); PushPayload.Builder builder = PushPayload.newBuilder(); // setting platform addPlatformMeta(messagePushBody, builder); // setting tag addTagMeta(messagePushBody, builder); // setting alias // Priority is higher than tag addAliasMeta(messagePushBody.getAlias(), builder); // setting notification addNotificationMeta(builder, messagePushBody); // execute push message pushClient.sendPush(builder.build()); } catch (Exception e) { logger.error("Execute push message fail.", e); } }
Example #6
Source Project: jiguang-java-client-common Author: jpush File: ApacheHttpClient.java License: MIT License | 5 votes |
public ApacheHttpClient(String authCode, HttpProxy proxy, ClientConfig config) { _maxRetryTimes = config.getMaxRetryTimes(); _connectionTimeout = config.getConnectionTimeout(); _connectionRequestTimeout = config.getConnectionRequestTimeout(); _socketTimeout = config.getSocketTimeout(); _authCode = authCode; _encryptType = config.getEncryptType(); if (proxy != null) { _proxy = new HttpHost(proxy.getHost(), proxy.getPort()); } }
Example #7
Source Project: jsms-api-java-client Author: jpush File: JSMSConfig.java License: MIT License | 4 votes |
public ClientConfig getClientConfig() { return clientConfig; }
Example #8
Source Project: jmessage-api-java-client Author: jpush File: JMessageConfig.java License: MIT License | 4 votes |
public ClientConfig getClientConfig() { return clientConfig; }