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


Java Url.encode方法代码示例

本文整理汇总了Java中com.google.gerrit.extensions.restapi.Url.encode方法的典型用法代码示例。如果您正苦于以下问题:Java Url.encode方法的具体用法?Java Url.encode怎么用?Java Url.encode使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.google.gerrit.extensions.restapi.Url的用法示例。


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

示例1: fillCommentInfo

import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
protected void fillCommentInfo(Comment c, CommentInfo r, AccountLoader loader) {
  if (fillPatchSet) {
    r.patchSet = c.key.patchSetId;
  }
  r.id = Url.encode(c.key.uuid);
  r.path = c.key.filename;
  if (c.side <= 0) {
    r.side = Side.PARENT;
    if (c.side < 0) {
      r.parent = -c.side;
    }
  }
  if (c.lineNbr > 0) {
    r.line = c.lineNbr;
  }
  r.inReplyTo = Url.encode(c.parentUuid);
  r.message = Strings.emptyToNull(c.message);
  r.updated = c.writtenOn;
  r.range = toRange(c.range);
  r.tag = c.tag;
  r.unresolved = c.unresolved;
  if (loader != null) {
    r.author = loader.get(c.author.getId());
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:26,代码来源:CommentJson.java

示例2: toPluginInfo

import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
public static PluginInfo toPluginInfo(Plugin p) {
  String id;
  String version;
  String indexUrl;
  String filename;
  Boolean disabled;

  id = Url.encode(p.getName());
  version = p.getVersion();
  disabled = p.isDisabled() ? true : null;
  if (p.getSrcFile() != null) {
    indexUrl = String.format("plugins/%s/", p.getName());
    filename = p.getSrcFile().getFileName().toString();
  } else {
    indexUrl = null;
    filename = null;
  }

  return new PluginInfo(id, version, indexUrl, filename, disabled);
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:21,代码来源:ListPlugins.java

示例3: getLoginRedirectUrl

import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
private static String getLoginRedirectUrl(HttpServletRequest req) {
  String contextPath = req.getContextPath();
  String loginUrl = contextPath + "/login/";
  String token = req.getRequestURI();
  if (!contextPath.isEmpty()) {
    token = token.substring(contextPath.length());
  }

  String queryString = req.getQueryString();
  if (queryString != null && !queryString.isEmpty()) {
    token = token.concat("?" + queryString);
  }
  return (loginUrl + Url.encode(token));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:15,代码来源:GitwebServlet.java

示例4: format

import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
public ProjectInfo format(Project p) {
  ProjectInfo info = new ProjectInfo();
  info.name = p.getName();
  Project.NameKey parentName = p.getParent(allProjects);
  info.parent = parentName != null ? parentName.get() : null;
  info.description = Strings.emptyToNull(p.getDescription());
  info.state = p.getState();
  info.id = Url.encode(info.name);
  List<WebLinkInfo> links = webLinks.getProjectLinks(p.getName());
  info.webLinks = links.isEmpty() ? null : links;
  return info;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:13,代码来源:ProjectJson.java

示例5: parse

import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
private DashboardResource parse(ProjectState projectState, CurrentUser user, String id)
    throws ResourceNotFoundException, IOException, ConfigInvalidException,
        PermissionBackendException {
  List<String> p = Lists.newArrayList(Splitter.on(':').limit(2).split(id));
  String ref = Url.encode(p.get(0));
  String path = Url.encode(p.get(1));
  return dashboards.parse(
      new ProjectResource(projectState, user), IdString.fromUrl(ref + ':' + path));
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:10,代码来源:GetDashboard.java

示例6: suggestAccountGroups

import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
private List<SuggestedReviewerInfo> suggestAccountGroups(
    SuggestReviewers suggestReviewers,
    ProjectState projectState,
    VisibilityControl visibilityControl,
    int limit)
    throws OrmException, IOException {
  try (Timer0.Context ctx = metrics.queryGroupsLatency.start()) {
    List<SuggestedReviewerInfo> groups = new ArrayList<>();
    for (GroupReference g : suggestAccountGroups(suggestReviewers, projectState)) {
      GroupAsReviewer result =
          suggestGroupAsReviewer(
              suggestReviewers, projectState.getProject(), g, visibilityControl);
      if (result.allowed || result.allowedWithConfirmation) {
        GroupBaseInfo info = new GroupBaseInfo();
        info.id = Url.encode(g.getUUID().get());
        info.name = g.getName();
        SuggestedReviewerInfo suggestedReviewerInfo = new SuggestedReviewerInfo();
        suggestedReviewerInfo.group = info;
        suggestedReviewerInfo.count = result.size;
        if (result.allowedWithConfirmation) {
          suggestedReviewerInfo.confirm = true;
        }
        groups.add(suggestedReviewerInfo);
        if (groups.size() >= limit) {
          break;
        }
      }
    }
    return groups;
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:32,代码来源:ReviewersUtil.java

示例7: createBasicGroupInfo

import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
private static GroupInfo createBasicGroupInfo(GroupDescription.Basic group) {
  GroupInfo info = new GroupInfo();
  info.id = Url.encode(group.getGroupUUID().get());
  info.name = Strings.emptyToNull(group.getName());
  info.url = Strings.emptyToNull(group.getUrl());
  info.options = createOptions(group);
  return info;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:9,代码来源:GroupJson.java

示例8: addInternalDetails

import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
@SuppressWarnings("deprecation")
private void addInternalDetails(
    GroupInfo info,
    GroupDescription.Internal internalGroup,
    Supplier<GroupControl> groupControlSupplier)
    throws OrmException {
  info.description = Strings.emptyToNull(internalGroup.getDescription());
  info.groupId = internalGroup.getId().get();

  AccountGroup.UUID ownerGroupUUID = internalGroup.getOwnerGroupUUID();
  if (ownerGroupUUID != null) {
    info.ownerId = Url.encode(ownerGroupUUID.get());
    GroupDescription.Basic o = groupBackend.get(ownerGroupUUID);
    if (o != null) {
      info.owner = o.getName();
    }
  }

  info.createdOn = internalGroup.getCreatedOn();

  if (options.contains(MEMBERS)) {
    info.members = listMembers.get().getDirectMembers(internalGroup, groupControlSupplier.get());
  }

  if (options.contains(INCLUDES)) {
    info.includes =
        listSubgroups.get().getDirectSubgroups(internalGroup, groupControlSupplier.get());
  }
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:30,代码来源:GroupJson.java

示例9: create

import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
@Override
public GroupApi create(GroupInput input) throws RestApiException {
    String restPath = GroupApiRestClient.getBaseRequestPath() + "/" + Url.encode(input.name);
    String body = gerritRestClient.getGson().toJson(input);
    JsonElement result = gerritRestClient.putRequest(restPath, body);
    GroupInfo info = groupsParser.parseGroupInfo(result);
    return new GroupApiRestClient(gerritRestClient, groupsParser, info.id);
}
 
开发者ID:uwolfer,项目名称:gerrit-rest-java-client,代码行数:9,代码来源:GroupsRestClient.java

示例10: file

import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
@Override
public BinaryResult file(String path) throws RestApiException {
    String encodedPath = Url.encode(path);
    String request = branchUrl() + "/files/" + encodedPath + "/content";
    try {
        HttpResponse response = gerritRestClient.request(request, null, GerritRestClient.HttpVerb.GET);
        return BinaryResultUtils.createBinaryResult(response);
    } catch (IOException e) {
        throw new RestApiException("Failed to get file content.", e);
    }
}
 
开发者ID:uwolfer,项目名称:gerrit-rest-java-client,代码行数:12,代码来源:BranchApiRestClient.java

示例11: setReviewed

import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
@Override
public void setReviewed(String path, boolean reviewed) throws RestApiException {
    String encodedPath = Url.encode(path);
    String url = String.format("/changes/%s/revisions/%s/files/%s/reviewed", changeApiRestClient.id(), revision, encodedPath);
    if (reviewed) {
        gerritRestClient.putRequest(url);
    } else {
        gerritRestClient.deleteRequest(url);
    }
}
 
开发者ID:uwolfer,项目名称:gerrit-rest-java-client,代码行数:11,代码来源:RevisionApiRestClient.java

示例12: encode

import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
private String encode(String val) {
  if (type.getUrlEncode()) {
    return Url.encode(type.replacePathSeparator(val));
  }
  return val;
}
 
开发者ID:gerrit-review,项目名称:gerrit,代码行数:7,代码来源:GitwebConfig.java

示例13: getRequestPath

import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
public static String getRequestPath(String id) {
    return BASE_URL + "/" + Url.encode(id);
}
 
开发者ID:uwolfer,项目名称:gerrit-rest-java-client,代码行数:4,代码来源:GroupApiRestClient.java

示例14: getRequestPath

import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
private String getRequestPath() {
    return "/accounts/" + Url.encode(name);
}
 
开发者ID:uwolfer,项目名称:gerrit-rest-java-client,代码行数:4,代码来源:AccountApiRestClient.java

示例15: suggestAccounts

import com.google.gerrit.extensions.restapi.Url; //导入方法依赖的package包/类
private List<AccountInfo> suggestAccounts(SuggestAccountsRequest r) throws RestApiException {
    String encodedQuery = Url.encode(r.getQuery());
    return getSuggestAccounts(String.format("q=%s&n=%s", encodedQuery, r.getLimit()));
}
 
开发者ID:uwolfer,项目名称:gerrit-rest-java-client,代码行数:5,代码来源:AccountsRestClient.java


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