hudson.Util.encode()方法的使用及代码示例

x33g5p2x  于2022-01-31 转载在 其他  
字(5.6k)|赞(0)|评价(0)|浏览(242)

本文整理了Java中hudson.Util.encode()方法的一些代码示例,展示了Util.encode()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Util.encode()方法的具体详情如下:
包路径:hudson.Util
类名称:Util
方法名:encode

Util.encode介绍

[英]Escapes non-ASCII characters in URL.

Note that this methods only escapes non-ASCII but leaves other URL-unsafe characters, such as '#'. #rawEncode(String) should generally be used instead, though be careful to pass only a single path component to that method (it will encode /, but this method does not).
[中]

代码示例

代码示例来源:origin: jenkinsci/jenkins

public static String encode(String s) {
  return Util.encode(s);
}

代码示例来源:origin: jenkinsci/jenkins

/**
 * Returns the absolute URL of this item. This relies on the current
 * {@link StaplerRequest} to figure out what the host name is,
 * so can be used only during processing client requests.
 *
 * @return
 *      absolute URL.
 * @throws IllegalStateException
 *      if the method is invoked outside the HTTP request processing.
 *
 * @deprecated
 *      This method shall <b>NEVER</b> be used during HTML page rendering, as it won't work with
 *      network set up like Apache reverse proxy.
 *      This method is only intended for the remote API clients who cannot resolve relative references
 *      (even this won't work for the same reason, which should be fixed.)
 */
@Deprecated
default String getAbsoluteUrl() {
  String r = Jenkins.getInstance().getRootUrl();
  if(r==null)
    throw new IllegalStateException("Root URL isn't configured yet. Cannot compute absolute URL.");
  return Util.encode(r+getUrl());
}

代码示例来源:origin: jenkinsci/jenkins

URL jobURL = new URL(home + "job/" + Util.encode(projectName).replace("/", "/job/") + "/");

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

public static String encode(String s) {
  return Util.encode(s);
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

public static String encode(String s) {
  return Util.encode(s);
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

public static String encode(String s) {
  return Util.encode(s);
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

public static String encode(String s) {
  return Util.encode(s);
}

代码示例来源:origin: hudson/hudson-2.x

public static String encode(String s) {
  return Util.encode(s);
}

代码示例来源:origin: org.hudsonci.plugins/disk-usage

public static String getProjectUrl(Job project) {
  return Util.encode(project.getAbsoluteUrl());
}

代码示例来源:origin: org.jenkins-ci.plugins/disk-usage

public static String getProjectUrl(Job project) {
  return Util.encode(project.getAbsoluteUrl());
}

代码示例来源:origin: jenkinsci/instant-messaging-plugin

/**
 * Returns the full URL to the build details page for a given build.
 */
public static String getBuildURL(AbstractBuild<?, ?> build) {
  // The hudson's base url
  final StringBuilder builder;
  if (Hudson.getInstance() != null) {
    builder = new StringBuilder(
      String.valueOf(Hudson.getInstance().getRootUrl()));
  } else {
    builder = new StringBuilder("null");
  }
  // The build's url, escaped for project with space or other specials
  // characters
  builder.append(Util.encode(build.getUrl()));
  return builder.toString();
}

代码示例来源:origin: org.jenkins-ci.main/jenkins-core

@Exported(visibility=999,name="url")
public final String getAbsoluteUrl() {
  String r = Jenkins.getInstance().getRootUrl();
  if(r==null)
    throw new IllegalStateException("Root URL isn't configured yet. Cannot compute absolute URL.");
  return Util.encode(r+getUrl());
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

@Exported(visibility=999,name="url")
public final String getAbsoluteUrl() {
  StaplerRequest request = Stapler.getCurrentRequest();
  if(request==null)
    throw new IllegalStateException("Not processing a HTTP request");
  return Util.encode(Hudson.getInstance().getRootUrl()+getUrl());
}

代码示例来源:origin: hudson/hudson-2.x

@Exported(visibility=999,name="url")
public final String getAbsoluteUrl() {
  StaplerRequest request = Stapler.getCurrentRequest();
  if(request==null)
    throw new IllegalStateException("Not processing a HTTP request");
  return Util.encode(Hudson.getInstance().getRootUrl()+getUrl());
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

@Exported(visibility = 999, name = "url")
public final String getAbsoluteUrl() {
  StaplerRequest request = Stapler.getCurrentRequest();
  if (request == null) {
    throw new IllegalStateException("Not processing a HTTP request");
  }
  return Util.encode(Hudson.getInstance().getRootUrl() + getUrl());
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

@Exported(visibility=999,name="url")
public final String getAbsoluteUrl() {
  StaplerRequest request = Stapler.getCurrentRequest();
  if(request==null)
    throw new IllegalStateException("Not processing a HTTP request");
  return Util.encode(Hudson.getInstance().getRootUrl()+getUrl());
}

代码示例来源:origin: org.eclipse.hudson/hudson-core

/**
 * Appends build URL to the builder.
 *
 * @param build build.
 * @param buf {@link StringBuilder}.
 */
protected void appendBuildUrl(AbstractBuild<?, ?> build, StringBuilder buf) {
  appendUrl(Util.encode(build.getUrl())
      + (build.getChangeSet().isEmptySet() ? "" : "changes"), buf);
}

代码示例来源:origin: org.eclipse.hudson.main/hudson-core

/**
 * Appends build URL to the builder.
 *
 * @param build build.
 * @param buf {@link StringBuilder}.
 */
protected void appendBuildUrl(AbstractBuild<?, ?> build, StringBuilder buf) {
  appendUrl(Util.encode(build.getUrl())
       + (build.getChangeSet().isEmptySet() ? "" : "changes"), buf);
}

代码示例来源:origin: org.jvnet.hudson.main/hudson-core

/**
 * Appends build URL to the builder.
 *
 * @param build build.
 * @param buf {@link StringBuilder}.
 */
protected void appendBuildUrl(AbstractBuild<?, ?> build, StringBuilder buf) {
  appendUrl(Util.encode(build.getUrl())
       + (build.getChangeSet().isEmptySet() ? "" : "changes"), buf);
}

代码示例来源:origin: hudson/hudson-2.x

/**
 * Appends build URL to the builder.
 *
 * @param build build.
 * @param buf {@link StringBuilder}.
 */
protected void appendBuildUrl(AbstractBuild<?, ?> build, StringBuilder buf) {
  appendUrl(Util.encode(build.getUrl())
       + (build.getChangeSet().isEmptySet() ? "" : "changes"), buf);
}

相关文章