当前位置: 首页>>代码示例>>Java>>正文


Java NotAuthorizedException类代码示例

本文整理汇总了Java中com.taskadapter.redmineapi.NotAuthorizedException的典型用法代码示例。如果您正苦于以下问题:Java NotAuthorizedException类的具体用法?Java NotAuthorizedException怎么用?Java NotAuthorizedException使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


NotAuthorizedException类属于com.taskadapter.redmineapi包,在下文中一共展示了NotAuthorizedException类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: getMemberships

import com.taskadapter.redmineapi.NotAuthorizedException; //导入依赖的package包/类
public Observable<List<Membership>> getMemberships(final Project project) {
    return updateObservable(new Observable.OnSubscribe<List<Membership>>() {
        @Override
        public void call(Subscriber<? super List<Membership>> subscriber) {
            try {
                subscriber.onNext(redmineManager.getMemberships(project));
                subscriber.onCompleted();
            } catch (RedMineException e) {
                logger.trace(e.getMessage(), e);
                if (e instanceof NotAuthorizedException) {
                    // Because sometimes user does not has permissions to get memberships o0
                    subscriber.onNext(new ArrayList<Membership>());
                    subscriber.onCompleted();
                } else {
                    subscriber.onError(e);
                }
            }
        }
    });
}
 
开发者ID:noveogroup,项目名称:android-snitch,代码行数:21,代码来源:RedMineControllerWrapper.java

示例2: getStatuses

import com.taskadapter.redmineapi.NotAuthorizedException; //导入依赖的package包/类
public Observable<List<IssueStatus>> getStatuses() {
    return updateObservable(new Observable.OnSubscribe<List<IssueStatus>>() {
        @Override
        public void call(Subscriber<? super List<IssueStatus>> subscriber) {
            try {
                subscriber.onNext(redmineManager.getStatuses());
                subscriber.onCompleted();
            } catch (RedMineException e) {
                logger.trace(e.getMessage(), e);
                if (e instanceof NotAuthorizedException) {
                    // Because sometimes user does not has permissions to get statuses o0
                    subscriber.onNext(new ArrayList<IssueStatus>());
                    subscriber.onCompleted();
                } else {
                    subscriber.onError(e);
                }
            }
        }
    });
}
 
开发者ID:noveogroup,项目名称:android-snitch,代码行数:21,代码来源:RedMineControllerWrapper.java

示例3: processContent

import com.taskadapter.redmineapi.NotAuthorizedException; //导入依赖的package包/类
@Override
public BasicHttpResponse processContent(BasicHttpResponse httpResponse)
		throws RedmineException {
	final int responseCode = httpResponse.getResponseCode();
	if (responseCode == HttpStatus.SC_UNAUTHORIZED) {
		throw new RedmineAuthenticationException(
				"Authorization error. Please check if you provided a valid API access key or Login and Password and REST API service is enabled on the server.");
	}
	if (responseCode == HttpStatus.SC_FORBIDDEN) {
		throw new NotAuthorizedException(
				"Forbidden. Please check the user has proper permissions.");
	}
	if (responseCode == HttpStatus.SC_NOT_FOUND) {
		throw new NotFoundException(
				"Server returned '404 not found'. response body:"
						+ getContent(httpResponse));
	}

	if (responseCode == HttpStatus.SC_UNPROCESSABLE_ENTITY) {
		List<String> errors;
		try {
			errors = RedmineJSONParser.parseErrors(getContent(httpResponse));
			errors = remap(errors);
		} catch (JSONException e) {
			throw new RedmineFormatException("Bad redmine error response", e);
		}
		throw new RedmineProcessingException(errors);
	}
	return httpResponse;
}
 
开发者ID:andrea-rockt,项目名称:mylyn-redmine-connector,代码行数:31,代码来源:RedmineErrorHandler.java

示例4: processContent

import com.taskadapter.redmineapi.NotAuthorizedException; //导入依赖的package包/类
@Override
public BasicHttpResponse processContent(BasicHttpResponse httpResponse)
		throws RedMineException {
	final int responseCode = httpResponse.getResponseCode();
	if (responseCode == HttpStatus.SC_UNAUTHORIZED) {
		throw new RedMineAuthenticationException(
				"Authorization error. Please check if you provided a valid API access key or Login and Password and REST API service is enabled on the server.");
	}
	if (responseCode == HttpStatus.SC_FORBIDDEN) {
		throw new NotAuthorizedException(
				"Forbidden. Please check the user has proper permissions.");
	}
	if (responseCode == HttpStatus.SC_NOT_FOUND) {
		throw new NotFoundException(
				"Server returned '404 not found'. response body:"
						+ getContent(httpResponse));
	}

	if (responseCode == HttpStatus.SC_UNPROCESSABLE_ENTITY) {
		List<String> errors;
		try {
			errors = RedmineJSONParser.parseErrors(getContent(httpResponse));
			errors = remap(errors);
		} catch (JSONException e) {
			throw new RedMineFormatException("Bad redmine error response", e);
		}
		throw new RedMineProcessingException(errors);
	}
	return httpResponse;
}
 
开发者ID:noveogroup,项目名称:android-snitch,代码行数:31,代码来源:RedmineErrorHandler.java


注:本文中的com.taskadapter.redmineapi.NotAuthorizedException类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。