Class ExceptionHandler


  • public class ExceptionHandler
    extends Object
    Handles any exception that is thrown when processing a OAuth2 request, by converting to a OAuth2RestletException, if not already.
    Since:
    12.0.0
    • Constructor Detail

      • ExceptionHandler

        @Inject
        public ExceptionHandler​(OAuth2Representation representation,
                                BaseURLProviderFactory baseURLProviderFactory,
                                OAuth2RequestFactory requestFactory,
                                JacksonRepresentationFactory jacksonRepresentationFactory)
        Constructs a new ExceptionHandler.
        Parameters:
        representation - An instance of the OAuth2Representation.
        baseURLProviderFactory - The factory to create BaseURLProvider instances.
        jacksonRepresentationFactory - The factory to create JacksonRepresentation instances.
    • Method Detail

      • handle

        public void handle​(Throwable throwable,
                           org.restlet.Context context,
                           org.restlet.Request request,
                           org.restlet.Response response)
        Handles any exception that is thrown when processing a OAuth2 request.
        Parameters:
        throwable - The throwable.
        context - The Restlet context.
        request - The Restlet request.
        response - The Restlet response.
      • handle

        public void handle​(Throwable throwable,
                           org.restlet.Response response)
        Handles general OAuth2 exceptions from Restlet endpoints.
        If the throwable is not a OAuth2RestletException then it will be wrapped as a ServerException.
        If the throwable is a OAuth2RestletException then it will be set on the response as a Json representation.
        Parameters:
        throwable - The throwable.
        response - The Restlet response.