src/main/java/com/authlete/jaxrs/BaseTokenEndpoint.java
public Response handle(
            AuthleteApi api, TokenRequestHandlerSpi spi,
            MultivaluedMap<String, String> parameters, String authorization, String[] clientCertificatePath)
    {
        try
        {
            // Create a handler.
            TokenRequestHandler handler = new TokenRequestHandler(api, spi);

            // Delegate the task to the handler.
            return handler.handle(parameters, authorization, clientCertificatePath);
        }
        catch (WebApplicationException e)
        {
            // An error occurred in the handler.
            onError(e);

            // Convert the error to a Response.
            return e.getResponse();
        }
    }
public Response handle(
            AuthleteApi api, TokenRequestHandlerSpi spi,
            MultivaluedMap<String, String> parameters, String authorization, String[] clientCertificatePath)
    {
        try
        {
            // Create a handler.
            TokenRequestHandler handler = new TokenRequestHandler(api, spi);

            // Delegate the task to the handler.
            return handler.handle(parameters, authorization, clientCertificatePath);
        }
        catch (WebApplicationException e)
        {
            // An error occurred in the handler.
            onError(e);

            // Convert the error to a Response.
            return e.getResponse();
        }
    }
public Response handle ( AuthleteApi api , TokenRequestHandlerSpi spi , MultivaluedMap < String , String > parameters , String authorization , String [ ] clientCertificatePath ) { try { // Create a handler. TokenRequestHandler handler = new TokenRequestHandler ( api , spi ) ; // Delegate the task to the handler. return handler . handle ( parameters , authorization , clientCertificatePath ) ; } catch ( WebApplicationException e ) { // An error occurred in the handler. onError ( e ) ; // Convert the error to a Response. return e . getResponse ( ) ; } }
Handle a token request.

<p>
This method internally creates a {@link TokenRequestHandler} instance and
calls its {@link TokenRequestHandler#handle(MultivaluedMap, String)} method.
Then, this method uses the value returned from the {@code handle()} method
as a response from this method.
</p>

<p>
When {@code TokenRequestHandler.handle()} method raises a {@link
WebApplicationException}, this method calls {@link #onError(WebApplicationException)
onError()} method with the exception. The default implementation of {@code onError()}
does nothing. You can override the method as necessary. After calling
{@code onError()} method, this method calls {@code getResponse()} method of
the exception and uses the returned value as a response from this method.
</p>

@param api
An implementation of {@link AuthleteApi}.

@param spi
An implementation of {@link TokenRequestHandlerSpi}.

@param parameters
Request parameters of the token request.

@param authorization
The value of {@code Authorization} header of the token request.

@param clientCertificatePath
The certificate path used in mutual TLS authentication, in PEM format. The
client's own certificate is the first in this array. Can be {@code null}.

@return
A response that should be returned to the client application.

@since 2.8
Handle a token request .