下面列出了javax.servlet.http.HttpServletResponse#SC_NOT_IMPLEMENTED 实例代码,或者点击链接到github查看源代码,也可以在右侧发表评论。
@Override
public List<org.apache.rave.model.Person> getPeople(Set<UserId> userIds, GroupId groupId,
CollectionOptions collectionOptions,
SecurityToken token) {
switch (groupId.getType()) {
case all:
return getUniqueListOfConnectedPeople(userIds, collectionOptions, token);
case friends:
return getUniqueListOfFriends(userIds, collectionOptions, token);
case objectId:
return getGroupMembersFromRepository(collectionOptions, groupId.getObjectId().toString(), token.getAppId());
case self:
UserId id = userIds.size() == 1 ? userIds.iterator().next() : new UserId(UserId.Type.me, null);
return Lists.newArrayList(getPersonForId(id, token));
case custom:
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Custom GroupIDs are not tracked by the container");
default:
throw new ProtocolException(HttpServletResponse.SC_BAD_REQUEST, "Invalid group id specified by request");
}
}
/**
* Handles a GET request. Note this method is meant to be overridden in descendant classes.
* @param request The GET request being handled.
* @param response The response associated with the request.
* @param path Path suffix required to handle the request.
* @return A {@link JazzJob} which returns the requested resource on completion.
*/
protected CFJob handleGet(T resource, final HttpServletRequest request, final HttpServletResponse response, final String path) {
return new CFJob(request, false) {
@Override
protected IStatus performJob() {
String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_IMPLEMENTED, msg, null);
}
};
}
/**
* Handles an idempotent PUT request. Note this method is meant to be overridden in descendant classes.
* @param request The PUT request being handled.
* @param response The response associated with the request.
* @param path Path suffix required to handle the request.
* @return A {@link JazzJob} which returns the PUT request result on completion.
*/
protected CFJob handlePut(T resource, final HttpServletRequest request, final HttpServletResponse response, final String path) {
return new CFJob(request, false) {
@Override
protected IStatus performJob() {
String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_IMPLEMENTED, msg, null);
}
};
}
/**
* Handles a POST request. Note this method is meant to be overridden in descendant classes.
* The POST request is not idempotent as PUT, although it may handle similar operations.
* @param request The POST request being handled.
* @param response The response associated with the request.
* @param path Path suffix required to handle the request.
* @return A {@link JazzJob} which returns the POST request result on completion.
*/
protected CFJob handlePost(final T resource, final HttpServletRequest request, final HttpServletResponse response, final String path) {
return new CFJob(request, false) {
@Override
protected IStatus performJob() {
String msg = NLS.bind("Failed to handle request for {0}", path); //$NON-NLS-1$
return new ServerStatus(IStatus.ERROR, HttpServletResponse.SC_NOT_IMPLEMENTED, msg, null);
}
};
}
@Override
public Future<Void> deleteMediaItem(UserId userId, String appId, String albumId, String mediaItemId, SecurityToken token) throws ProtocolException {
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Not Implemented");
}
private static RestException fromStatusRuntimeException(StatusRuntimeException e) {
int statusCode;
switch (e.getStatus().getCode()) {
case OK:
statusCode = HttpServletResponse.SC_OK;
break;
case INVALID_ARGUMENT:
statusCode = HttpServletResponse.SC_BAD_REQUEST;
break;
case DEADLINE_EXCEEDED:
statusCode = HttpServletResponse.SC_REQUEST_TIMEOUT;
break;
case NOT_FOUND:
statusCode = HttpServletResponse.SC_NOT_FOUND;
break;
case ALREADY_EXISTS:
statusCode = HttpServletResponse.SC_CONFLICT;
break;
case PERMISSION_DENIED:
statusCode = HttpServletResponse.SC_FORBIDDEN;
break;
case RESOURCE_EXHAUSTED:
statusCode = TOO_MANY_REQUESTS;
break;
case FAILED_PRECONDITION:
statusCode = HttpServletResponse.SC_CONFLICT;
break;
case UNIMPLEMENTED:
statusCode = HttpServletResponse.SC_NOT_IMPLEMENTED;
break;
case UNAVAILABLE:
statusCode = HttpServletResponse.SC_SERVICE_UNAVAILABLE;
break;
case UNAUTHENTICATED:
statusCode = HttpServletResponse.SC_UNAUTHORIZED;
break;
default:
statusCode = HttpServletResponse.SC_INTERNAL_SERVER_ERROR;
}
return RestException.newBuilder(statusCode, e.getMessage())
.withCause(e)
.build();
}
@Override
public Future<Void> createMediaItem(UserId userId, String appId, String albumId, MediaItem mediaItem, SecurityToken token) throws ProtocolException {
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Not Implemented");
}
@Override
public Future<RestfulCollection<Activity>> getActivities(Set<UserId> userIds, GroupId groupId, String appId, Set<String> fields, CollectionOptions options, SecurityToken token) throws ProtocolException {
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Not Implemented");
}
@Override
public Future<RestfulCollection<Activity>> getActivities(UserId userId, GroupId groupId, String appId, Set<String> fields, CollectionOptions options, Set<String> activityIds, SecurityToken token) throws ProtocolException {
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Not Implemented");
}
@Override
public Future<RestfulCollection<Group>> getGroups(UserId userId, CollectionOptions options, Set<String> fields, SecurityToken token) {
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Not Implemented");
}
@Override
public Future<Void> deleteActivities(UserId userId, GroupId groupId, String appId, Set<String> activityIds, SecurityToken token) throws ProtocolException {
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Not Implemented");
}
@Override
public Future<Void> createActivity(UserId userId, GroupId groupId, String appId, Set<String> fields, Activity activity, SecurityToken token) throws ProtocolException {
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Not Implemented");
}
@Override
public Future<Person> updatePerson(UserId id, Person person, SecurityToken token) throws ProtocolException {
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Not Implemented");
}
@Override
public OAuth2DataService getDataService() {
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Not Implemented");
}
@Override
public void authenticateClient(OAuth2NormalizedRequest req) throws OAuth2Exception {
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Not Implemented");
}
@Override
public Future<MediaItem> getMediaItem(UserId userId, String appId, String albumId, String mediaItemId, Set<String> fields, SecurityToken token) throws ProtocolException {
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Not Implemented");
}
@Override
public Future<RestfulCollection<MediaItem>> getMediaItems(Set<UserId> userIds, GroupId groupId, String appId, Set<String> fields, CollectionOptions options, SecurityToken token) throws ProtocolException {
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Not Implemented");
}
@Override
public void validateRequestForResource(OAuth2NormalizedRequest req, Object resourceRequest) throws OAuth2Exception {
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Not Implemented");
}
@Override
public Future<Void> updateMediaItem(UserId userId, String appId, String albumId, String mediaItemId, MediaItem mediaItem, SecurityToken token) throws ProtocolException {
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Not Implemented");
}
@Override
public OAuth2Code generateRefreshToken(OAuth2NormalizedRequest req) {
throw new ProtocolException(HttpServletResponse.SC_NOT_IMPLEMENTED, "Not Implemented");
}