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


Java HttpStatus.getReasonPhrase方法代码示例

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


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

示例1: handleMessageException

import org.springframework.http.HttpStatus; //导入方法依赖的package包/类
/**
 * Handles MessageException exception.
 *
 * @param exception the MessageException instance
 * @param request   the WebRequest caused exception
 * @return the ResponseEntity object instance
 */
@ExceptionHandler(MessageException.class)
protected ResponseEntity<Object> handleMessageException(MessageException exception, WebRequest request) {
    HttpStatus status;

    switch (exception.getErrorType()) {
        case NOT_FOUND:
            status = HttpStatus.NOT_FOUND;
            break;
        case DATA_INVALID:
        case PARAMETERS_INVALID:
            status = HttpStatus.BAD_REQUEST;
            break;
        case ALREADY_EXISTS:
            status = HttpStatus.CONFLICT;
            break;
        case AUTH_FAILED:
            status = HttpStatus.UNAUTHORIZED;
            break;
        case OPERATION_TIMED_OUT:
        case INTERNAL_ERROR:
        default:
            status = HttpStatus.INTERNAL_SERVER_ERROR;
            break;
    }

    MessageError error = new MessageError(request.getHeader(CORRELATION_ID), exception.getTimestamp(),
            status.value(), status.getReasonPhrase(),
            exception.getMessage(), exception.getClass().getSimpleName());
    return super.handleExceptionInternal(exception, error, new HttpHeaders(), status, request);
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:38,代码来源:TopologyExceptionHandler.java

示例2: handleExceptionInternal

import org.springframework.http.HttpStatus; //导入方法依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
protected ResponseEntity<Object> handleExceptionInternal(Exception exception, Object body, HttpHeaders headers,
                                                         HttpStatus status, WebRequest request) {
    MessageError error = new MessageError(request.getHeader(CORRELATION_ID), System.currentTimeMillis(),
            status.value(), status.getReasonPhrase(),
            exception.getMessage(), exception.getClass().getSimpleName());
    return super.handleExceptionInternal(exception, error, headers, status, request);
}
 
开发者ID:telstra,项目名称:open-kilda,代码行数:12,代码来源:TopologyExceptionHandler.java

示例3: CloudFoundryException

import org.springframework.http.HttpStatus; //导入方法依赖的package包/类
public CloudFoundryException(HttpStatus statusCode) {
    this(statusCode, statusCode.getReasonPhrase());
}
 
开发者ID:SAP,项目名称:cf-java-client-sap,代码行数:4,代码来源:CloudFoundryException.java

示例4: create

import org.springframework.http.HttpStatus; //导入方法依赖的package包/类
public static ResultMap create(String message, HttpStatus status) {
    return new ResultMap(status.value(), message, status.getReasonPhrase());
}
 
开发者ID:Zigin,项目名称:MonitorPlatform,代码行数:4,代码来源:ResultMap.java

示例5: handleGenericException

import org.springframework.http.HttpStatus; //导入方法依赖的package包/类
private ExceptionDTO handleGenericException(Throwable e, HttpStatus status) {
    return new ExceptionDTO(status.value(), status.getReasonPhrase(), e.getMessage());
}
 
开发者ID:farchanjo,项目名称:webcron,代码行数:4,代码来源:ExceptionResource.java

示例6: RestErrorResponse

import org.springframework.http.HttpStatus; //导入方法依赖的package包/类
protected RestErrorResponse(HttpStatus status, String detailMessage) {
  statusCode = status.value();
  reasonPhrase = status.getReasonPhrase();
  this.detailMessage = detailMessage;
}
 
开发者ID:springuni,项目名称:springuni-particles,代码行数:6,代码来源:RestErrorResponse.java

示例7: of

import org.springframework.http.HttpStatus; //导入方法依赖的package包/类
public static ErrorResponse of(HttpStatus httpStatus, String message) {
    return new ErrorResponse(httpStatus.getReasonPhrase(), message, httpStatus.value());
}
 
开发者ID:shout-star,项目名称:uroborosql-springboot-demo,代码行数:4,代码来源:ErrorResponse.java

示例8: ApiError

import org.springframework.http.HttpStatus; //导入方法依赖的package包/类
public ApiError(HttpStatus httpStatus, String message, String description) {
    statusCode = httpStatus.value();
    meaning = httpStatus.getReasonPhrase();
    this.message = message;
    this.description = description;
}
 
开发者ID:dhaval-mehta,项目名称:url-to-google-drive,代码行数:7,代码来源:ApiError.java

示例9: getDataFromHttpStatus

import org.springframework.http.HttpStatus; //导入方法依赖的package包/类
private void getDataFromHttpStatus(final HttpStatus status) {
    this.status = status.value();
    this.reason = status.getReasonPhrase();
}
 
开发者ID:Apereo-Learning-Analytics-Initiative,项目名称:OpenLRW,代码行数:5,代码来源:XAPIErrorInfo.java

示例10: getErrorDescription

import org.springframework.http.HttpStatus; //导入方法依赖的package包/类
protected String getErrorDescription(Throwable ex, HttpStatus responseHttpStatus) {
    return ex == null ? responseHttpStatus.getReasonPhrase() : ex.getMessage();
}
 
开发者ID:mkopylec,项目名称:errorest-spring-boot-starter,代码行数:4,代码来源:ThrowableErrorDataProvider.java


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