private void handleServerErrors(HttpStatus statusCode) throws IOException { if (statusCode == HttpStatus.INTERNAL_SERVER_ERROR) { throw new InternalServerErrorException("twitter", "Something is broken at Twitter. Please see http://dev.twitter.com/pages/support to report the issue."); } else if (statusCode == HttpStatus.BAD_GATEWAY) { throw new ServerDownException("twitter", "Twitter is down or is being upgraded."); } else if (statusCode == HttpStatus.SERVICE_UNAVAILABLE) { throw new ServerOverloadedException("twitter", "Twitter is overloaded with requests. Try again later."); } }
protected void requireAuthorization() { if (!api.isAuthorized()) { throw new MissingAuthorizationException(SalesforceServiceProvider.ID); } }
protected void requireAppAuthorization() { if (!isAppAuthorized) { throw new MissingAuthorizationException("twitter"); } }
protected void requiresAuthorization() { if (!isAuthorized) { throw new NotAuthorizedException("yahoo", "app has not been authorized"); } }
public void updateStatus(Alfresco alfresco, String status) { throw new OperationNotPermittedException("updateStatus not implemented."); }
final class ApiThrowables { static final int BAD_REQUEST = 400; static final int NOT_FOUND = 404; public static ApiException newCourseIdNotFound(String courseId) { return new ApiException(2, NOT_FOUND,"Course with ID [" + courseId + "] does not exist."); } public static ApiException newBadCourseId(String courseId) { return new ApiException(2, BAD_REQUEST,"Course ID [" + courseId + "] is not valid."); } }
private String getRequiredScope(ApiException apiException) { return apiException instanceof InsufficientPermissionException ? ((InsufficientPermissionException) apiException).getRequiredPermission() : null; }
protected void requireEitherUserOrAppAuthorization() { if (!isUserAuthorized && !isAppAuthorized) { throw new MissingAuthorizationException("twitter"); } }
private void handleServerErrors(HttpStatus statusCode) throws IOException { if (statusCode == HttpStatus.INTERNAL_SERVER_ERROR) { throw new InternalServerErrorException("twitter", "Something is broken at Twitter. Please see http://dev.twitter.com/pages/support to report the issue."); } else if (statusCode == HttpStatus.BAD_GATEWAY) { throw new ServerDownException("twitter", "Twitter is down or is being upgraded."); } else if (statusCode == HttpStatus.SERVICE_UNAVAILABLE) { throw new ServerOverloadedException("twitter", "Twitter is overloaded with requests. Try again later."); } }
protected void requireAuthorization() { if (!isAuthorized) { throw new MissingAuthorizationException("google"); } }
private void handleServerErrors(HttpStatus statusCode) throws IOException { if (statusCode == HttpStatus.INTERNAL_SERVER_ERROR) { throw new InternalServerErrorException( "Something is broken at Weibo."); } else if (statusCode == HttpStatus.BAD_GATEWAY) { throw new ServerDownException("Weibo is down or is being upgraded."); } else if (statusCode == HttpStatus.SERVICE_UNAVAILABLE) { throw new ServerOverloadedException( "Weibo is overloaded with requests. Try again later."); } }
protected void requireAuthorization() { if (!isAuthorized) { throw new MissingAuthorizationException("microsoft"); } } }
protected void requireAuthorized() { if (!authorized) { throw new MissingAuthorizationException("iam"); } }
protected void requireUserAuthorization() { if (!isUserAuthorized) { throw new MissingAuthorizationException("twitter"); } }
protected void requireAppAuthorization() { if (!isAppAuthorized) { throw new MissingAuthorizationException("twitter"); } }
protected void requireEitherUserOrAppAuthorization() { if (!isUserAuthorized && !isAppAuthorized) { throw new MissingAuthorizationException("twitter"); } }
protected void requireAuthorization() { if (!isAuthorized) { throw new MissingAuthorizationException("facebook"); } }
protected void requireAuthorization() { if (!isAuthorized) { throw new MissingAuthorizationException("facebook"); } }
protected void requireAuthorization() { if (!isAuthorized) { throw new MissingAuthorizationException(); } }
protected void requireUserAuthorization() { if (!isUserAuthorized) { throw new MissingAuthorizationException("twitter"); } }