if (res.cause() instanceof HttpStatusException) { final HttpStatusException exception = (HttpStatusException) res.cause(); switch (exception.getStatusCode()) { case 302: case 400:
final int statusCode = ((HttpStatusException) exception).getStatusCode(); final String payload = ((HttpStatusException) exception).getPayload();
if (res.cause() instanceof HttpStatusException) { final HttpStatusException exception = (HttpStatusException) res.cause(); switch (exception.getStatusCode()) { case 302: case 400:
if (res.cause() instanceof HttpStatusException) { final HttpStatusException exception = (HttpStatusException) res.cause(); switch (exception.getStatusCode()) { case 302: case 400:
/** * Override process exception to handle custom OAuth 2.0 invalid client exception * @param ctx routing context * @param exception exception thrown */ @Override protected void processException(RoutingContext ctx, Throwable exception) { if (exception != null) { if (exception instanceof HttpStatusException) { final int statusCode = ((HttpStatusException) exception).getStatusCode(); if (statusCode == 401) { // client authentication has failed return invalid client exception ctx.fail(new InvalidClientException("Client authentication failed due to unknown or invalid client")); return; } } } super.processException(ctx, exception); }
/** * Override process exception to handle custom OAuth 2.0 invalid client exception * @param ctx routing context * @param exception exception thrown */ @Override protected void processException(RoutingContext ctx, Throwable exception) { if (exception != null) { if (exception instanceof HttpStatusException) { final int statusCode = ((HttpStatusException) exception).getStatusCode(); if (statusCode == 401) { // client authentication has failed return invalid client exception ctx.fail(new InvalidClientException("Client authentication failed due to unknown or invalid client")); return; } } } super.processException(ctx, exception); }
payload = null; } else { statusCode = ((HttpStatusException) exception).getStatusCode(); payload = ((HttpStatusException) exception).getPayload();
final int statusCode = ((HttpStatusException) exception).getStatusCode(); final String payload = ((HttpStatusException) exception).getPayload();
final String payload; if (exception instanceof HttpStatusException) { statusCode = ((HttpStatusException) exception).getStatusCode(); payload = ((HttpStatusException) exception).getPayload(); } else {
} else if (ctx.failure() instanceof HttpStatusException) { final HttpStatusException e = (HttpStatusException) ctx.failure(); sendError(ctx.response(), e.getStatusCode(), e.getMessage()); } else { sendError(ctx.response(), HttpURLConnection.HTTP_INTERNAL_ERROR, ctx.failure().getMessage());
} else if (ctx.failure() instanceof HttpStatusException) { final HttpStatusException e = (HttpStatusException) ctx.failure(); sendError(ctx.response(), e.getStatusCode(), e.getMessage()); } else { sendError(ctx.response(), HttpURLConnection.HTTP_INTERNAL_ERROR, ctx.failure().getMessage());