hudson.model.Hudson.getRootUrl()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(6.0k)|赞(0)|评价(0)|浏览(221)

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

Hudson.getRootUrl介绍

[英]Gets the absolute URL of Hudson, such as "http://localhost/hudson/".

This method first tries to use the manually configured value, then fall back to StaplerRequest#getRootPath(). It is done in this order so that it can work correctly even in the face of a reverse proxy.
[中]获取Hudson的绝对URL,例如“http://localhost/hudson/".
此方法首先尝试使用手动配置的值,然后返回到StaplerRequest#getRootPath()。它是按此顺序进行的,以便即使在面对反向代理时也能正常工作。

代码示例

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

public String getUrl()
{
  String url = getHudson().getRootUrl();
  if (url == null) {
    log.warn("Underlying Hudson root url is null; using DEFAULT_URL");
    url = DEFAULT_URL;
  }
  else if (url.endsWith("/")) {
    url = url.substring(0, url.length() - 1);
  }
  return url;
}

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

@Override
public ConsoleAnnotator annotate(Object context, MarkupText text, int charPos) {
  String url = this.url;
  if (url.startsWith("/"))
    url = Hudson.getInstance().getRootUrl()+url.substring(1);
  text.addHyperlink(charPos,charPos+length,url);
  return null;
}

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

@Override
public ConsoleAnnotator annotate(Object context, MarkupText text, int charPos) {
  String url = this.url;
  if (url.startsWith("/")) {
    url = Hudson.getInstance().getRootUrl() + url.substring(1);
  }
  text.addHyperlink(charPos, charPos + length, url);
  return null;
}

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

@Override
public ConsoleAnnotator annotate(Object context, MarkupText text, int charPos) {
  String url = this.url;
  if (url.startsWith("/"))
    url = Hudson.getInstance().getRootUrl()+url.substring(1);
  text.addHyperlink(charPos,charPos+length,url);
  return null;
}

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

@Override
public ConsoleAnnotator annotate(Object context, MarkupText text, int charPos) {
  String url = this.url;
  if (url.startsWith("/"))
    url = Hudson.getInstance().getRootUrl()+url.substring(1);
  text.addHyperlink(charPos,charPos+length,url);
  return null;
}

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

/**
 * The URL of the user page.
 */
@Exported(visibility=999)
public String getAbsoluteUrl() {
  return Hudson.getInstance().getRootUrl()+getUrl();
}

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

/**
 * Computes the key that identifies this Hudson among other Hudsons that the user has a credential for.
 */
private String getPropertyKey() {
  String url = Hudson.getInstance().getRootUrl();
  if (url!=null)  return url;
  return Secret.fromString("key").toString();
}

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

/**
 * Gets the absolute URL of this view.
 */
@Exported(visibility=2,name="url")
public String getAbsoluteUrl() {
  return Hudson.getInstance().getRootUrl()+getUrl();
}

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

/**
 * Gets the absolute URL of this view.
 */
@Exported(visibility = 2, name = "url")
public String getAbsoluteUrl() {
  return Hudson.getInstance().getRootUrl() + getUrl();
}

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

/**
 * Gets the absolute URL of this view.
 */
@Exported(visibility=2,name="url")
public String getAbsoluteUrl() {
  return Hudson.getInstance().getRootUrl()+getUrl();
}

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

/**
 * Computes the key that identifies this Hudson among other Hudsons that the user has a credential for.
 */
private String getPropertyKey() {
  String url = Hudson.getInstance().getRootUrl();
  if (url!=null)  return url;
  return Secret.fromString("key").toString();
}

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

/**
 * The URL of the user page.
 */
@Exported(visibility=999)
public String getAbsoluteUrl() {
  return Hudson.getInstance().getRootUrl()+getUrl();
}

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

/**
 * Computes the key that identifies this Hudson among other Hudsons that the user has a credential for.
 */
private String getPropertyKey() {
  String url = Hudson.getInstance().getRootUrl();
  if (url!=null)  return url;
  return Secret.fromString("key").toString();
}

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

/**
 * Exposes the name/value as an environment variable.
 */
@Override
public void buildEnvVars(AbstractBuild<?, ?> build, EnvVars env) {
  String value = Hudson.getInstance().getRootUrl() + getRun().getUrl();
  env.put(name, value);
  env.put(name.toUpperCase(Locale.ENGLISH), value); // backward compatibility pre 1.345
}

代码示例来源: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: org.eclipse.hudson.main/hudson-core

/**
 * Exposes the name/value as an environment variable.
 */
@Override
public void buildEnvVars(AbstractBuild<?,?> build, EnvVars env) {
  String value = Hudson.getInstance().getRootUrl() + getRun().getUrl();
  env.put(name, value);
  env.put(name.toUpperCase(Locale.ENGLISH),value); // backward compatibility pre 1.345
}

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

/**
 * Exposes the name/value as an environment variable.
 */
@Override
public void buildEnvVars(AbstractBuild<?,?> build, EnvVars env) {
  String value = Hudson.getInstance().getRootUrl() + getRun().getUrl();
  env.put(name, value);
  env.put(name.toUpperCase(Locale.ENGLISH),value); // backward compatibility pre 1.345
}

代码示例来源: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

private void generateUrl() {
  AbstractBuild<?, ?> build = o.getOwner();
  String buildLink = build.getUrl();
  String actionUrl = o.getTestResultAction().getUrlName();
  this.url = Hudson.getInstance().getRootUrl() + buildLink + actionUrl + o.getUrl();
}

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

private void generateUrl() {
  AbstractBuild<?,?> build = o.getOwner();
  String buildLink = build.getUrl();
  String actionUrl = o.getTestResultAction().getUrlName();
  this.url = Hudson.getInstance().getRootUrl() + buildLink + actionUrl + o.getUrl();             
}

相关文章

Hudson类方法