当前位置: 首页>>代码示例>>Java>>正文


Java HttpURLConnection.HTTP_CONFLICT属性代码示例

本文整理汇总了Java中java.net.HttpURLConnection.HTTP_CONFLICT属性的典型用法代码示例。如果您正苦于以下问题:Java HttpURLConnection.HTTP_CONFLICT属性的具体用法?Java HttpURLConnection.HTTP_CONFLICT怎么用?Java HttpURLConnection.HTTP_CONFLICT使用的例子?那么恭喜您, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在java.net.HttpURLConnection的用法示例。


在下文中一共展示了HttpURLConnection.HTTP_CONFLICT属性的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: responseHandler

private void responseHandler(Response response) {
    if (response.code() == HttpURLConnection.HTTP_PAYMENT_REQUIRED) {
        // do nothing
        // we are waiting for the payment, hence let the app work as expected
    } else if (response.code() == HttpURLConnection.HTTP_ACCEPTED) {
        // received the payment
        // disable HTTP calls
        Status.cancelCall(mContext);
    } else if (response.code() == HttpURLConnection.HTTP_CONFLICT) {
        // no payment received
        // time to crash the app
        goEvil(response);
    }
}
 
开发者ID:avinassh,项目名称:little-finger-android,代码行数:14,代码来源:LittleFinger.java

示例2: subscribeTopic

/**
 * Sets up a subscription to projects/<code>appName</code>/subscriptions/<code>subName</code>.
 * Ignores error if the subscription already exists.
 * <p/>
 * See <a href="https://cloud.google.com/pubsub/subscriber">cloud.google.com/pubsub/subscriber</a>
 */
Subscription subscribeTopic(String subscriptionName, String topicName) throws IOException {
    String sub = getSubscription(subscriptionName);
    Subscription subscription = new Subscription()
            .setName(sub)
            .setAckDeadlineSeconds(15)
            .setTopic(getTopic(topicName));
    try {
        return pubsub.projects().subscriptions().create(sub, subscription).execute();
    } catch (GoogleJsonResponseException e) {
        if (e.getStatusCode() == HttpURLConnection.HTTP_CONFLICT) {
            return subscription;
        } else {
            throw e;
        }
    }
}
 
开发者ID:spac3lord,项目名称:eip,代码行数:22,代码来源:PubSubWrapper.java

示例3: codeToException

private static DockerException codeToException(int code, String message) {
    if (code == HttpURLConnection.HTTP_CONFLICT) {
        return new DockerConflictException(message);
    } else if (code == HttpURLConnection.HTTP_UNAUTHORIZED) {
        return new DockerAuthenticationException(message);
    }
    return new DockerRemoteException(code, message);
}
 
开发者ID:apache,项目名称:incubator-netbeans,代码行数:8,代码来源:DockerAction.java

示例4: ResourceConflictException

/**
 * Constructor.
 *
 * @param message Exception message
 * @param cause reason for this exception
 */
public ResourceConflictException(final String message, final Throwable cause) {
    super(HttpURLConnection.HTTP_CONFLICT, message, cause);
}
 
开发者ID:JonkiPro,项目名称:REST-Web-Services,代码行数:9,代码来源:ResourceConflictException.java


注:本文中的java.net.HttpURLConnection.HTTP_CONFLICT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。