Package org.forgerock.oauth2.restlet
Class ExceptionHandler
- java.lang.Object
-
- org.forgerock.oauth2.restlet.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 Summary
Constructors Constructor Description ExceptionHandler(OAuth2Representation representation, BaseURLProviderFactory baseURLProviderFactory, OAuth2RequestFactory requestFactory, JacksonRepresentationFactory jacksonRepresentationFactory)Constructs a new ExceptionHandler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidhandle(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.voidhandle(Throwable throwable, org.restlet.Response response)Handles general OAuth2 exceptions from Restlet endpoints.
-
-
-
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 createBaseURLProviderinstances.jacksonRepresentationFactory- The factory to createJacksonRepresentationinstances.
-
-
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.
-
-