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

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

本文整理了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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Returns the full URL to the build details page for a given build.
  3. */
  4. public static String getBuildURL(AbstractBuild<?, ?> build) {
  5. // The hudson's base url
  6. final StringBuilder builder;
  7. if (Hudson.getInstance() != null) {
  8. builder = new StringBuilder(
  9. String.valueOf(Hudson.getInstance().getRootUrl()));
  10. } else {
  11. builder = new StringBuilder("null");
  12. }
  13. // The build's url, escaped for project with space or other specials
  14. // characters
  15. builder.append(Util.encode(build.getUrl()));
  16. return builder.toString();
  17. }

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

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

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

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

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

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

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

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

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

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

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

  1. /**
  2. * Appends build URL to the builder.
  3. *
  4. * @param build build.
  5. * @param buf {@link StringBuilder}.
  6. */
  7. protected void appendBuildUrl(AbstractBuild<?, ?> build, StringBuilder buf) {
  8. appendUrl(Util.encode(build.getUrl())
  9. + (build.getChangeSet().isEmptySet() ? "" : "changes"), buf);
  10. }

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

  1. /**
  2. * Appends build URL to the builder.
  3. *
  4. * @param build build.
  5. * @param buf {@link StringBuilder}.
  6. */
  7. protected void appendBuildUrl(AbstractBuild<?, ?> build, StringBuilder buf) {
  8. appendUrl(Util.encode(build.getUrl())
  9. + (build.getChangeSet().isEmptySet() ? "" : "changes"), buf);
  10. }

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

  1. /**
  2. * Appends build URL to the builder.
  3. *
  4. * @param build build.
  5. * @param buf {@link StringBuilder}.
  6. */
  7. protected void appendBuildUrl(AbstractBuild<?, ?> build, StringBuilder buf) {
  8. appendUrl(Util.encode(build.getUrl())
  9. + (build.getChangeSet().isEmptySet() ? "" : "changes"), buf);
  10. }

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

  1. /**
  2. * Appends build URL to the builder.
  3. *
  4. * @param build build.
  5. * @param buf {@link StringBuilder}.
  6. */
  7. protected void appendBuildUrl(AbstractBuild<?, ?> build, StringBuilder buf) {
  8. appendUrl(Util.encode(build.getUrl())
  9. + (build.getChangeSet().isEmptySet() ? "" : "changes"), buf);
  10. }

相关文章