HttpFSExceptionProvider (Apache Hadoop HttpFS 3.5.0 API)
Description: declaration: package: org.apache.hadoop.fs.http.server, class: HttpFSExceptionProvider

Package 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 @Private public class HttpFSExceptionProvider extends ExceptionProvider
JAX-RS `ExceptionMapper` implementation that maps HttpFSServer's exceptions to HTTP status codes.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `HttpFSExceptionProvider()`

- ## Method Summary

  Modifier and Type
  Method
  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 Details

  - ### HttpFSExceptionProvider

    public HttpFSExceptionProvider()

- ## Method Details

  - ### 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.