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


Java HttpStatus.BAD_GATEWAY属性代码示例

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


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

示例1: handleServerErrors

private static void handleServerErrors(HttpStatus statusCode) throws IOException {
    if (statusCode == HttpStatus.INTERNAL_SERVER_ERROR) {
        throw new InternalServerErrorException(TWITTER,
            "Something is broken at Twitter. Please see http://dev.twitter.com/pages/support to report the issue.");
    } else if (statusCode == HttpStatus.BAD_GATEWAY) {
        throw new ServerDownException(TWITTER, "Twitter is down or is being upgraded.");
    } else if (statusCode == HttpStatus.SERVICE_UNAVAILABLE) {
        throw new ServerOverloadedException(TWITTER, "Twitter is overloaded with requests. Try again later.");
    }
}
 
开发者ID:xm-online,项目名称:xm-uaa,代码行数:10,代码来源:TwitterErrorHandler.java

示例2: Regist

@RequestMapping(value = "common",produces = "application/json;charset=UTF-8")
public ResponseEntity<HttpJson> Regist(@RequestBody String inObj){

    HttpJson re = new HttpJson(), input = new HttpJson(inObj);
    String thisFormType = input.getClassName();
    if (!thisFormType.equals("form:regist")){
        re.setStatusCode(250);
        re.setMessage("不匹配的请求");
        return new ResponseEntity<HttpJson>(re, HttpStatus.BAD_REQUEST);
    }
    String getRegistType = input.getPara("style");
    String getUserName = input.getPara("username");
    String getUserPwd = input.getPara("password");

    Login login = new Login();
    login.setUPwd(getUserPwd);
    login.setUAName(getUserName);

    String flag = "-2";
    try {
        flag = registService.registUserWithType(login,getRegistType);
    } catch (Exception e) {
        e.printStackTrace();
        re.setMessage("服务器出错");
        re.setStatusCode(202);
        re.constractJsonString();
        return new ResponseEntity<HttpJson>(re,HttpStatus.BAD_GATEWAY);
    }

    if (flag.equals("-1")){
        re.setMessage("用户已存在,请检查用户名");
        re.setStatusCode(201);
    }else if(flag.equals("-2")){
        re.setStatusCode(202);
        re.setMessage("服务器太忙,请稍后再试");
    }else{
        re.setMessage("UserUUid");
        re.setClassObject(String.class.toString());
        re.setClassObject(flag);
    }

    re.constractJsonString();

    return new ResponseEntity<HttpJson>(re,HttpStatus.ACCEPTED);
}
 
开发者ID:okingjerryo,项目名称:WeiMusicCommunity-server,代码行数:45,代码来源:RegistContoller.java

示例3: handleNotificationException

@ResponseStatus(value = HttpStatus.BAD_GATEWAY, reason = "Satellite Graphiums could not be notified")
@ExceptionHandler(NotificationException.class)
public void handleNotificationException(NotificationException ex) {
    log.error("Error occured during request",ex);
}
 
开发者ID:graphium-project,项目名称:graphium,代码行数:5,代码来源:GlobalExceptionController.java

示例4: defaultRestaurant

/**
 * Fallback method for getRestaurant()
 *
 * @param restaurantId
 * @return
 */
public ResponseEntity<Restaurant> defaultRestaurant(
        @PathVariable int restaurantId) {
    return new ResponseEntity<>(null, HttpStatus.BAD_GATEWAY);
}
 
开发者ID:PacktPublishing,项目名称:Mastering-Microservices-with-Java-9-Second-Edition,代码行数:10,代码来源:RestaurantServiceAPI.java


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