當前位置: 首頁>>代碼示例>>Java>>正文


Java APIRequestException類代碼示例

本文整理匯總了Java中cn.jpush.api.common.resp.APIRequestException的典型用法代碼示例。如果您正苦於以下問題:Java APIRequestException類的具體用法?Java APIRequestException怎麽用?Java APIRequestException使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


APIRequestException類屬於cn.jpush.api.common.resp包,在下文中一共展示了APIRequestException類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: createPeriodicalSchedule

import cn.jpush.api.common.resp.APIRequestException; //導入依賴的package包/類
private ScheduleResult createPeriodicalSchedule(String name, String start, String end, String time,
                                                TimeUnit timeUnit, int frequency, String[] point, PushPayload push)
        throws APIConnectionException, APIRequestException {
    TriggerPayload trigger = TriggerPayload.newBuilder()
            .setPeriodTime(start, end, time)
            .setTimeFrequency(timeUnit, frequency, point )
            .buildPeriodical();
    SchedulePayload payload = SchedulePayload.newBuilder()
            .setName(name)
            .setEnabled(true)
            .setTrigger(trigger)
            .setPush(push)
            .build();

    return _scheduleClient.createSchedule(payload);
}
 
開發者ID:noear,項目名稱:Snacks,代碼行數:17,代碼來源:JPushClient.java

示例2: updateDeviceTagAlias

import cn.jpush.api.common.resp.APIRequestException; //導入依賴的package包/類
public DefaultResult updateDeviceTagAlias(String registrationId, boolean clearAlias, boolean clearTag) throws APIConnectionException, APIRequestException {
	Preconditions.checkArgument(clearAlias || clearTag, "It is not meaningful to do nothing.");
	
    String url = hostName + devicesPath + "/" + registrationId;
    
    JsonObject top = new JsonObject();
    if (clearAlias) {
        top.addProperty("alias", "");
    }
    if (clearTag) {
        top.addProperty("tags", "");
    }
    
    ResponseWrapper response = _httpClient.sendPost(url, top.toString());
    
    return DefaultResult.fromResponse(response);
}
 
開發者ID:noear,項目名稱:Snacks,代碼行數:18,代碼來源:DeviceClient.java

示例3: doRequest

import cn.jpush.api.common.resp.APIRequestException; //導入依賴的package包/類
public ResponseWrapper doRequest(String url, String content, 
        RequestMethod method) throws APIConnectionException, APIRequestException {
    ResponseWrapper response = null;
    for (int retryTimes = 0; ; retryTimes++) {
        try {
            response = _doRequest(url, content, method);
            break;
        } catch (SocketTimeoutException e) {
            if (KEYWORDS_READ_TIMED_OUT.equals(e.getMessage())) {
                // Read timed out.  For push, maybe should not re-send.
                throw new APIConnectionException(READ_TIMED_OUT_MESSAGE, e, true);
            } else {    // connect timed out
                if (retryTimes >= _maxRetryTimes) {
                    throw new APIConnectionException(CONNECT_TIMED_OUT_MESSAGE, e, retryTimes);
                } else {
                    LOG.debug("connect timed out - retry again - " + (retryTimes + 1));
                }
            }
        }
    }
    return response;
}
 
開發者ID:noear,項目名稱:Snacks,代碼行數:23,代碼來源:NativeHttpClient.java

示例4: sendAndroidNotificationWithAlias

import cn.jpush.api.common.resp.APIRequestException; //導入依賴的package包/類
/**
 * Shortcut
 */
public PushResult sendAndroidNotificationWithAlias(String title, String alert, 
        Map<String, String> extras, String... alias) 
        throws APIConnectionException, APIRequestException {
    PushPayload payload = PushPayload.newBuilder()
            .setPlatform(Platform.android())
            .setAudience(Audience.alias(alias))
            .setNotification(Notification.android(alert, title, extras))
            .build();
    return _pushClient.sendPush(payload);
}
 
開發者ID:noear,項目名稱:Snacks,代碼行數:14,代碼來源:JPushClient.java

示例5: sendAndroidNotificationWithRegistrationID

import cn.jpush.api.common.resp.APIRequestException; //導入依賴的package包/類
/**
 * Shortcut
 */
public PushResult sendAndroidNotificationWithRegistrationID(String title, String alert, 
        Map<String, String> extras, String... registrationID) 
        throws APIConnectionException, APIRequestException {
    PushPayload payload = PushPayload.newBuilder()
            .setPlatform(Platform.android())
            .setAudience(Audience.registrationId(registrationID))
            .setNotification(Notification.android(alert, title, extras))
            .build();
    return _pushClient.sendPush(payload);
}
 
開發者ID:noear,項目名稱:Snacks,代碼行數:14,代碼來源:JPushClient.java

示例6: sendIosNotificationWithAlias

import cn.jpush.api.common.resp.APIRequestException; //導入依賴的package包/類
/**
 * Shortcut
 */
public PushResult sendIosNotificationWithAlias(String alert, 
        Map<String, String> extras, String... alias) 
        throws APIConnectionException, APIRequestException {
    PushPayload payload = PushPayload.newBuilder()
            .setPlatform(Platform.ios())
            .setAudience(Audience.alias(alias))
            .setNotification(Notification.ios(alert, extras))
            .build();
    return _pushClient.sendPush(payload);
}
 
開發者ID:noear,項目名稱:Snacks,代碼行數:14,代碼來源:JPushClient.java

示例7: sendIosNotificationWithRegistrationID

import cn.jpush.api.common.resp.APIRequestException; //導入依賴的package包/類
/**
 * Shortcut
 */
public PushResult sendIosNotificationWithRegistrationID(String alert, 
        Map<String, String> extras, String... registrationID) 
        throws APIConnectionException, APIRequestException {
    PushPayload payload = PushPayload.newBuilder()
            .setPlatform(Platform.ios())
            .setAudience(Audience.registrationId(registrationID))
            .setNotification(Notification.ios(alert, extras))
            .build();
    return _pushClient.sendPush(payload);
}
 
開發者ID:noear,項目名稱:Snacks,代碼行數:14,代碼來源:JPushClient.java

示例8: sendAndroidMessageWithAlias

import cn.jpush.api.common.resp.APIRequestException; //導入依賴的package包/類
/**
 * Shortcut
 */
public PushResult sendAndroidMessageWithAlias(String title, String msgContent, String... alias) 
        throws APIConnectionException, APIRequestException {
    PushPayload payload = PushPayload.newBuilder()
            .setPlatform(Platform.android())
            .setAudience(Audience.alias(alias))
            .setMessage(Message.newBuilder()
                    .setTitle(title)
                    .setMsgContent(msgContent)
                    .build())
            .build();
    return _pushClient.sendPush(payload);
}
 
開發者ID:noear,項目名稱:Snacks,代碼行數:16,代碼來源:JPushClient.java

示例9: sendAndroidMessageWithRegistrationID

import cn.jpush.api.common.resp.APIRequestException; //導入依賴的package包/類
/**
 * Shortcut
 */
public PushResult sendAndroidMessageWithRegistrationID(String title, String msgContent, String... registrationID) 
        throws APIConnectionException, APIRequestException {
    PushPayload payload = PushPayload.newBuilder()
            .setPlatform(Platform.android())
            .setAudience(Audience.registrationId(registrationID))
            .setMessage(Message.newBuilder()
                    .setTitle(title)
                    .setMsgContent(msgContent)
                    .build())
            .build();
    return _pushClient.sendPush(payload);
}
 
開發者ID:noear,項目名稱:Snacks,代碼行數:16,代碼來源:JPushClient.java

示例10: sendIosMessageWithAlias

import cn.jpush.api.common.resp.APIRequestException; //導入依賴的package包/類
/**
 * Shortcut
 */
public PushResult sendIosMessageWithAlias(String title, String msgContent, String... alias) 
        throws APIConnectionException, APIRequestException {
    PushPayload payload = PushPayload.newBuilder()
            .setPlatform(Platform.ios())
            .setAudience(Audience.alias(alias))
            .setMessage(Message.newBuilder()
                    .setTitle(title)
                    .setMsgContent(msgContent)
                    .build())
            .build();
    return _pushClient.sendPush(payload);
}
 
開發者ID:noear,項目名稱:Snacks,代碼行數:16,代碼來源:JPushClient.java

示例11: sendIosMessageWithRegistrationID

import cn.jpush.api.common.resp.APIRequestException; //導入依賴的package包/類
/**
 * Shortcut
 */
public PushResult sendIosMessageWithRegistrationID(String title, String msgContent, String... registrationID) 
        throws APIConnectionException, APIRequestException {
    PushPayload payload = PushPayload.newBuilder()
            .setPlatform(Platform.ios())
            .setAudience(Audience.registrationId(registrationID))
            .setMessage(Message.newBuilder()
                    .setTitle(title)
                    .setMsgContent(msgContent)
                    .build())
            .build();
    return _pushClient.sendPush(payload);
}
 
開發者ID:noear,項目名稱:Snacks,代碼行數:16,代碼來源:JPushClient.java

示例12: sendMessageWithRegistrationID

import cn.jpush.api.common.resp.APIRequestException; //導入依賴的package包/類
/**
 * Shortcut
 */
public PushResult sendMessageWithRegistrationID(String title, String msgContent, String... registrationID) 
        throws APIConnectionException, APIRequestException {
    PushPayload payload = PushPayload.newBuilder()
            .setPlatform(Platform.all())
            .setAudience(Audience.registrationId(registrationID))
            .setMessage(Message.newBuilder()
                    .setTitle(title)
                    .setMsgContent(msgContent)
                    .build())
            .build();
    return _pushClient.sendPush(payload);
}
 
開發者ID:noear,項目名稱:Snacks,代碼行數:16,代碼來源:JPushClient.java

示例13: createSingleSchedule

import cn.jpush.api.common.resp.APIRequestException; //導入依賴的package包/類
/**
 * Create a single schedule.
 * @param name The schedule name.
 * @param time The push time, format is 'yyyy-MM-dd HH:mm:ss'
 * @param push The push payload.
 * @return The created scheduleResult instance.
 * @throws cn.jpush.api.common.resp.APIConnectionException
 * @throws cn.jpush.api.common.resp.APIRequestException
 */
public ScheduleResult createSingleSchedule(String name, String time, PushPayload push)
        throws APIConnectionException, APIRequestException {
    TriggerPayload trigger = TriggerPayload.newBuilder()
            .setSingleTime(time)
            .buildSingle();
    SchedulePayload payload = SchedulePayload.newBuilder()
            .setName(name)
            .setEnabled(true)
            .setTrigger(trigger)
            .setPush(push)
            .build();

    return _scheduleClient.createSchedule(payload);
}
 
開發者ID:noear,項目名稱:Snacks,代碼行數:24,代碼來源:JPushClient.java

示例14: updateScheduleName

import cn.jpush.api.common.resp.APIRequestException; //導入依賴的package包/類
/**
 * Update the schedule name
 * @param scheduleId The schedule id.
 * @param name The new name.
 * @return The schedule information after updated.
 * @throws cn.jpush.api.common.resp.APIConnectionException
 * @throws cn.jpush.api.common.resp.APIRequestException
 */
public ScheduleResult updateScheduleName(String scheduleId, String name)
        throws APIConnectionException, APIRequestException {
    SchedulePayload payload = SchedulePayload.newBuilder()
            .setName(name)
            .build();

    return updateSchedule(scheduleId, payload);
}
 
開發者ID:noear,項目名稱:Snacks,代碼行數:17,代碼來源:JPushClient.java

示例15: enableSchedule

import cn.jpush.api.common.resp.APIRequestException; //導入依賴的package包/類
/**
 * Enable the schedule.
 * @param scheduleId The schedule id.
 * @return The schedule information after updated.
 * @throws cn.jpush.api.common.resp.APIConnectionException
 * @throws cn.jpush.api.common.resp.APIRequestException
 */
public ScheduleResult enableSchedule(String scheduleId)
        throws APIConnectionException, APIRequestException {
    SchedulePayload payload = SchedulePayload.newBuilder()
            .setEnabled(true)
            .build();

    return updateSchedule(scheduleId, payload);
}
 
開發者ID:noear,項目名稱:Snacks,代碼行數:16,代碼來源:JPushClient.java


注:本文中的cn.jpush.api.common.resp.APIRequestException類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。