當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。