本文整理汇总了Java中com.google.gerrit.extensions.restapi.Url.decode方法的典型用法代码示例。如果您正苦于以下问题:Java Url.decode方法的具体用法?Java Url.decode怎么用?Java Url.decode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.google.gerrit.extensions.restapi.Url
的用法示例。
在下文中一共展示了Url.decode方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: update
import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
private static Comment update(Comment e, DraftInput in, Timestamp when) {
if (in.side != null) {
e.side = in.side();
}
if (in.inReplyTo != null) {
e.parentUuid = Url.decode(in.inReplyTo);
}
e.setLineNbrAndRange(in.line, in.range);
e.message = in.message.trim();
e.writtenOn = when;
if (in.tag != null) {
// TODO(dborowitz): Can we support changing tags via PUT?
e.tag = in.tag;
}
if (in.unresolved != null) {
e.unresolved = in.unresolved;
}
return e;
}
示例2: updateChange
import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
@Override
public boolean updateChange(ChangeContext ctx)
throws ResourceNotFoundException, OrmException, UnprocessableEntityException {
PatchSet ps = psUtil.get(ctx.getDb(), ctx.getNotes(), psId);
if (ps == null) {
throw new ResourceNotFoundException("patch set not found: " + psId);
}
String parentUuid = Url.decode(in.inReplyTo);
comment =
commentsUtil.newComment(
ctx, in.path, ps.getId(), in.side(), in.message.trim(), in.unresolved, parentUuid);
comment.setLineNbrAndRange(in.line, in.range);
comment.tag = in.tag;
setCommentRevId(comment, patchListCache, ctx.getChange(), ps);
commentsUtil.putComments(
ctx.getDb(), ctx.getUpdate(psId), Status.DRAFT, Collections.singleton(comment));
ctx.dontBumpLastUpdatedOn();
return true;
}
示例3: createRobotCommentFromInput
import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
private RobotComment createRobotCommentFromInput(
ChangeContext ctx, String path, RobotCommentInput robotCommentInput) throws OrmException {
RobotComment robotComment =
commentsUtil.newRobotComment(
ctx,
path,
psId,
robotCommentInput.side(),
robotCommentInput.message,
robotCommentInput.robotId,
robotCommentInput.robotRunId);
robotComment.parentUuid = Url.decode(robotCommentInput.inReplyTo);
robotComment.url = robotCommentInput.url;
robotComment.properties = robotCommentInput.properties;
robotComment.setLineNbrAndRange(robotCommentInput.line, robotCommentInput.range);
robotComment.tag = in.tag;
setCommentRevId(robotComment, patchListCache, ctx.getChange(), ps);
robotComment.fixSuggestions = createFixSuggestionsFromInput(robotCommentInput.fixSuggestions);
return robotComment;
}
示例4: getParameters
import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
private static Map<String, String> getParameters(HttpServletRequest req) {
final Map<String, String> params = new HashMap<>();
for (String pair : req.getQueryString().split("[&;]")) {
final int eq = pair.indexOf('=');
if (0 < eq) {
String name = pair.substring(0, eq);
String value = pair.substring(eq + 1);
name = Url.decode(name);
value = Url.decode(value);
params.put(name, value);
}
}
return params;
}
示例5: parse
import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
public static Optional<ChangeTriplet> parse(String triplet, int y, int z) {
if (y < 0 || z < 0) {
return Optional.empty();
}
String project = Url.decode(triplet.substring(0, y));
String branch = Url.decode(triplet.substring(y + 1, z));
String changeId = Url.decode(triplet.substring(z + 1));
return Optional.of(
new AutoValue_ChangeTriplet(
new Branch.NameKey(new Project.NameKey(project), branch), new Change.Key(changeId)));
}
示例6: getQueryParams
import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
public static QueryParams getQueryParams(HttpServletRequest req) throws BadRequestException {
QueryParams qp = (QueryParams) req.getAttribute(QueryParams.I);
if (qp != null) {
return qp;
}
String accessToken = null;
String xdMethod = null;
String xdContentType = null;
ListMultimap<String, String> config = MultimapBuilder.hashKeys(4).arrayListValues().build();
ListMultimap<String, String> params = MultimapBuilder.hashKeys().arrayListValues().build();
String queryString = req.getQueryString();
if (!Strings.isNullOrEmpty(queryString)) {
for (String kvPair : Splitter.on('&').split(queryString)) {
Iterator<String> i = Splitter.on('=').limit(2).split(kvPair).iterator();
String key = Url.decode(i.next());
String val = i.hasNext() ? Url.decode(i.next()) : "";
if (XD_AUTHORIZATION.equals(key)) {
if (accessToken != null) {
throw new BadRequestException("duplicate " + XD_AUTHORIZATION);
}
accessToken = val;
} else if (XD_METHOD.equals(key)) {
if (xdMethod != null) {
throw new BadRequestException("duplicate " + XD_METHOD);
} else if (!ALLOWED_CORS_METHODS.contains(val)) {
throw new BadRequestException("invalid " + XD_METHOD);
}
xdMethod = val;
} else if (XD_CONTENT_TYPE.equals(key)) {
if (xdContentType != null) {
throw new BadRequestException("duplicate " + XD_CONTENT_TYPE);
}
xdContentType = val;
} else if (RESERVED_KEYS.contains(key)) {
config.put(key, val);
} else {
params.put(key, val);
}
}
}
qp =
QueryParams.create(
accessToken,
xdMethod,
xdContentType,
ImmutableListMultimap.copyOf(config),
ImmutableListMultimap.copyOf(params));
req.setAttribute(QueryParams.I, qp);
return qp;
}
示例7: insertComments
import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
private boolean insertComments(ChangeContext ctx)
throws OrmException, UnprocessableEntityException {
Map<String, List<CommentInput>> map = in.comments;
if (map == null) {
map = Collections.emptyMap();
}
Map<String, Comment> drafts = Collections.emptyMap();
if (!map.isEmpty() || in.drafts != DraftHandling.KEEP) {
if (in.drafts == DraftHandling.PUBLISH_ALL_REVISIONS) {
drafts = changeDrafts(ctx);
} else {
drafts = patchSetDrafts(ctx);
}
}
List<Comment> toDel = new ArrayList<>();
List<Comment> toPublish = new ArrayList<>();
Set<CommentSetEntry> existingIds =
in.omitDuplicateComments ? readExistingComments(ctx) : Collections.emptySet();
for (Map.Entry<String, List<CommentInput>> ent : map.entrySet()) {
String path = ent.getKey();
for (CommentInput c : ent.getValue()) {
String parent = Url.decode(c.inReplyTo);
Comment e = drafts.remove(Url.decode(c.id));
if (e == null) {
e = commentsUtil.newComment(ctx, path, psId, c.side(), c.message, c.unresolved, parent);
} else {
e.writtenOn = ctx.getWhen();
e.side = c.side();
e.message = c.message;
}
setCommentRevId(e, patchListCache, ctx.getChange(), ps);
e.setLineNbrAndRange(c.line, c.range);
e.tag = in.tag;
if (existingIds.contains(CommentSetEntry.create(e))) {
continue;
}
toPublish.add(e);
}
}
switch (in.drafts) {
case KEEP:
default:
break;
case DELETE:
toDel.addAll(drafts.values());
break;
case PUBLISH:
case PUBLISH_ALL_REVISIONS:
commentsUtil.publish(ctx, psId, drafts.values(), in.tag);
comments.addAll(drafts.values());
break;
}
ChangeUpdate u = ctx.getUpdate(psId);
commentsUtil.deleteComments(ctx.getDb(), u, toDel);
commentsUtil.putComments(ctx.getDb(), u, Status.PUBLISHED, toPublish);
comments.addAll(toPublish);
return !toDel.isEmpty() || !toPublish.isEmpty();
}