美文网首页Jakarta RESTful Web Services
Jakarta RS-API 2.x (jax-rs 2.0、j

Jakarta RS-API 2.x (jax-rs 2.0、j

作者: 交藤 | 来源:发表于2020-06-27 09:10 被阅读0次

    异常

    http status-code 建议参考:https://www.w3.org/Protocols/rfc2616/rfc2616-sec10.html#sec10.5.4

    WEB 应用异常

    • WebApplicationException WEB 应用异常 基类
      • ServerErrorException 5XX
        • InternalServerErrorException 500
        • ServiceUnavailableException 503
      • ClientErrorException 4XX
        • BadRequestException 400
        • NotAuthorizedException 401
        • ForbiddenException 403
        • NotFoundException 404
        • NotAllowedException 405
        • NotAcceptableException 406
        • NotSupportedException 415

    运行时处理异常

    • ProcessingException 运行时处理异常 基类
      • ResponseProcessingException 响应处理异常

    其他异常

    • NoContentException 读取请求的内容时为空
    • UriBuilderException 构造 java.net.URI 时出现异常

    Web 应用异常

    WebApplicationException 异常基类 web 应用异常基类

    public class WebApplicationException extends RuntimeException{}
    

    ServerErrorException 服务器异常基类 5XX

    public class ServerErrorException extends WebApplicationException{}
    

    InternalServerErrorException 服务器内部异常 500

    public class InternalServerErrorException extends ServerErrorException{}
    

    ServiceUnavailableException 服务器暂时不可用 503

    public class ServiceUnavailableException extends ServerErrorException{}
    

    ClientErrorException 请求异常基类 4XX

    public class ClientErrorException extends WebApplicationException{}
    

    BadRequestException 请求处理失败 400

    public class BadRequestException extends ClientErrorException{}
    

    ForbiddenException 请求的资源操作被拒绝(无权限) 403

    public class ForbiddenException extends ClientErrorException{}
    

    NotAcceptableException 请求无法解析 406

    public class NotAcceptableException extends ClientErrorException{}
    

    NotAllowedException 请求不允许(request allow) 405

    public class NotAllowedException extends ClientErrorException{}
    

    NotAuthorizedException 鉴权未通过 401

    public class NotAuthorizedException extends ClientErrorException {}
    

    NotFoundException 资源未查询到 404

    public class NotFoundException extends ClientErrorException {}
    

    NotSupportedException 请求的格式不支持 415

    public class NotSupportedException extends ClientErrorException {}
    

    运行时处理异常

    ProcessingException 处理异常基类

    public class ProcessingException extends RuntimeException {}
    

    ResponseProcessingException 响应处理异常(如反序列化、过滤器等出现异常)

    public class ResponseProcessingException extends ProcessingException {}
    

    其他异常

    NoContentException 读取请求的内容时为空,抛出

    public class NoContentException extends IOException{}
    

    UriBuilderException 构造 java.net.URI 时出现异常

    public class UriBuilderException extends RuntimeException{}
    

    相关文章

      网友评论

        本文标题:Jakarta RS-API 2.x (jax-rs 2.0、j

        本文链接:https://www.haomeiwen.com/subject/igkmfktx.html