Class ServiceExceptionMapper

java.lang.Object
com.atlassian.confluence.rest.v2.api.exception.ServiceExceptionMapper
All Implemented Interfaces:
jakarta.ws.rs.ext.ExceptionMapper<Exception>
Direct Known Subclasses:
RestExceptionMapper

public abstract class ServiceExceptionMapper extends Object implements jakarta.ws.rs.ext.ExceptionMapper<Exception>
Ensures ServiceExceptions thrown by REST resources are converted into appropriate RestErrors before returning the Response.

To use this in your plugin, you should implement this class in the same package as your REST resources and annotate it with Provider.

OSGi exported as public API to allow marketplace partners to leverage Atlassian-defined REST error handling.

Since:
9.0
  • Constructor Details

    • ServiceExceptionMapper

      public ServiceExceptionMapper()
  • Method Details

    • toResponse

      public final jakarta.ws.rs.core.Response toResponse(Exception exception)
      Specified by:
      toResponse in interface jakarta.ws.rs.ext.ExceptionMapper<Exception>
    • _annotateThisClassWithProvider

      protected abstract void _annotateThisClassWithProvider()
      This method exists to remind developers that they must annotate the implementing class with Provider. The implementing class must also be placed in a package scanned by Atlassian-REST for REST modules.