org.apache.hadoop.fs.http.server

## Class HttpFSExceptionProvider

- java.lang.Object
- - org.apache.hadoop.lib.wsrs.ExceptionProvider
  - - org.apache.hadoop.fs.http.server.HttpFSExceptionProvider

- All Implemented Interfaces:
    javax.ws.rs.ext.ExceptionMapper<Throwable>

      @Provider
       @InterfaceAudience.Private
      public class HttpFSExceptionProvider
      extends ExceptionProvider

  JAX-RS `ExceptionMapper` implementation that maps HttpFSServer's exceptions to HTTP status codes.

- - ### Constructor Summary

    Constructors
    Constructor and Description
    `HttpFSExceptionProvider()`

  - ### Method Summary

    All Methods Instance Methods Concrete Methods
    Modifier and Type | Method and Description
    --- | ---
    `protected void` | `log(javax.ws.rs.core.Response.Status status, Throwable throwable)` Logs the HTTP status code and exception in HttpFSServer's log.
    `javax.ws.rs.core.Response` | `toResponse(Throwable throwable)` Maps different exceptions thrown by HttpFSServer to HTTP status codes.

    - ### Methods inherited from class org.apache.hadoop.lib.wsrs.ExceptionProvider

      `createResponse, getOneLineMessage`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### HttpFSExceptionProvider

          public HttpFSExceptionProvider()

  - ### Method Detail

    - #### toResponse

          public javax.ws.rs.core.Response toResponse(Throwable throwable)

      Maps different exceptions thrown by HttpFSServer to HTTP status codes.
      - SecurityException : HTTP UNAUTHORIZED
      - FileNotFoundException : HTTP NOT_FOUND
      - IOException : INTERNAL_HTTP SERVER_ERROR
      - UnsupporteOperationException : HTTP BAD_REQUEST
      - all other exceptions : HTTP INTERNAL_SERVER_ERROR
      Specified by:
        `toResponse` in interface `javax.ws.rs.ext.ExceptionMapper<Throwable>`
      Overrides:
        `toResponse` in class `ExceptionProvider`
      Parameters:
        `throwable` - exception thrown.
      Returns:
        mapped HTTP status code

    - #### log

          protected void log(javax.ws.rs.core.Response.Status status,
                             Throwable throwable)

      Logs the HTTP status code and exception in HttpFSServer's log.
      Overrides:
        `log` in class `ExceptionProvider`
      Parameters:
        `status` - HTTP status code.
        `throwable` - exception thrown.

Copyright © 2008–2022 Apache Software Foundation. All rights reserved.