hudson.model.AbstractProject.getAbsoluteUrl()方法的使用及代码示例

x33g5p2x  于2022-01-15 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(94)

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

AbstractProject.getAbsoluteUrl介绍

暂无

代码示例

代码示例来源:origin: org.hudsonci.plugins/analysis-core

/**
 * Creates a new instance of {@link DefaultGraphConfigurationView}.
 *
 * @param configuration
 *            the graph configuration
 * @param project
 *            the owning project to configure the graphs for
 * @param pluginName
 *            The name of the plug-in.
 * @param buildHistory
 *            the build history for this project
 */
public DefaultGraphConfigurationView(final GraphConfiguration configuration, final AbstractProject<?, ?> project,
    final String pluginName, final BuildHistory buildHistory) {
  this(configuration, project, pluginName, buildHistory,
      project.getAbsoluteUrl() + pluginName + "/configureDefaults");
}

代码示例来源:origin: jenkinsci/analysis-core-plugin

/**
 * Creates a new instance of {@link DefaultGraphConfigurationView}.
 *
 * @param configuration
 *            the graph configuration
 * @param project
 *            the owning project to configure the graphs for
 * @param pluginName
 *            The name of the plug-in.
 * @param buildHistory
 *            the build history for this project
 * @deprecated use
 *             {@link #AbstractProjectAction(GraphConfiguration, Job, String, BuildHistory)}
 */
@Deprecated
public DefaultGraphConfigurationView(final GraphConfiguration configuration, final AbstractProject<?, ?> project,
    final String pluginName, final BuildHistory buildHistory) {
  this(configuration, (Job<?, ?>) project, pluginName, buildHistory,
      project.getAbsoluteUrl() + pluginName + "/configureDefaults");
}

代码示例来源:origin: org.hudsonci.plugins/git

/**
 * {@inheritDoc}
 */
@Override
public void addHeaders(StaplerRequest req, StaplerResponse rsp) {
  rsp.addHeader("Triggered", project.getAbsoluteUrl());
}

代码示例来源:origin: org.hudsonci.plugins/analysis-core

/**
 * Returns the URL of this object.
 *
 * @return the URL of this object
 */
public String getUrl() {
  return getOwner().getAbsoluteUrl() + "/" + getKey() + "/configure";
}

代码示例来源:origin: org.hudsonci.plugins/analysis-core

/**
 * Returns the type of the graph.
 *
 * @return the type
 */
public BuildResultGraph getGraphType() {
  BuildResultGraph graphType = configuration.getGraphType();
  graphType.setRootUrl(getOwner().getAbsoluteUrl());
  return graphType;
}

代码示例来源:origin: org.hudsonci.plugins/mercurial

public void generateResponse(StaplerRequest req, StaplerResponse rsp, Object node) throws IOException, ServletException {
    rsp.setStatus(SC_OK);
    rsp.setContentType("text/plain");
    for (AbstractProject<?, ?> p : projects) {
      rsp.addHeader("Triggered", p.getAbsoluteUrl());
    }
    PrintWriter w = rsp.getWriter();
    for (AbstractProject<?, ?> p : projects) {
      w.println("Scheduled polling of "+p.getFullDisplayName());
    }
    if (msg!=null)
      w.println(msg);
  }
};

代码示例来源:origin: org.hudsonci.plugins/analysis-core

/**
 * Saves the configured values. Subclasses need to implement the actual persistence.
 *
 * @param request
 *            Stapler request
 * @param response
 *            Stapler response
 */
public void doSave(final StaplerRequest request, final StaplerResponse response) {
  try {
    JSONObject formData = request.getSubmittedForm();
    if (configuration.initializeFrom(formData)) {
      persistValue(configuration.serializeToString(), key, request, response);
    }
  }
  catch (IOException exception) {
    LOGGER.log(Level.SEVERE, "Can't save the form data: " + request, exception);
  }
  catch (ServletException exception) {
    LOGGER.log(Level.SEVERE, "Can't process the form data: " + request, exception);
  }
  finally {
    try {
      response.sendRedirect(project.getAbsoluteUrl());
    }
    catch (IOException exception) {
      LOGGER.log(Level.SEVERE, "Can't redirect", exception);
    }
  }
}

代码示例来源:origin: jenkinsci/email-ext-plugin

public void doStopWatching(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
  User user = User.current();
  if(user != null) {
    stopWatching();
    for(hudson.model.UserProperty property : user.getAllProperties()) {
      if(property instanceof EmailExtWatchAction.UserProperty) {
        ((EmailExtWatchAction.UserProperty)property).clearTriggers();
        break;
      }
    }            
  }    
  rsp.sendRedirect(project.getAbsoluteUrl());
}

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

/**
 * Form submission is calling this method
 */
@SuppressWarnings({"UnusedDeclaration"})
public void doSubmit(StaplerRequest req, StaplerResponse resp) throws IOException, ServletException {
  // Enforce release permissions
  project.checkPermission(ArtifactoryPlugin.RELEASE);
  readRequestParams(req, false);
  // Schedule release build
  if (project.scheduleBuild(0, new Cause.UserIdCause(), this)) {
    // Redirect to the project page
    resp.sendRedirect(project.getAbsoluteUrl());
  }
}

代码示例来源:origin: jenkinsci/email-ext-plugin

@RequirePOST
public void doConfigSubmit(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException, FormException {
  User user = User.current();
  if(user != null) {
    Object json = req.getSubmittedForm().get("triggers");
    List<EmailTrigger> triggers = req.bindJSONToList(EmailTrigger.class, json);
    List<EmailTrigger> unwatchable = new ArrayList<>();
    for(EmailTrigger trigger : triggers) {
      if(!trigger.getDescriptor().isWatchable()) {
        unwatchable.add(trigger);
      }
    }
    triggers.removeAll(unwatchable);
    Mailer.UserProperty mailerProperty = getMailerProperty();
    
    if(mailerProperty != null) {
      // override so that the emails only get sent to them.
      for(EmailTrigger trigger : triggers) {
        trigger.getEmail().setRecipientList(mailerProperty.getAddress());
        trigger.getEmail().getRecipientProviders().clear();
      }
      startWatching();
      user.addProperty(new UserProperty(triggers));
    }
  }
  rsp.sendRedirect(project.getAbsoluteUrl());
}

代码示例来源:origin: org.hudsonci.plugins/warnings

/**
 * Returns the graph configuration screen.
 *
 * @param link
 *            the link to check
 * @param request
 *            stapler request
 * @param response
 *            stapler response
 * @return the graph configuration or <code>null</code>
 */
public Object getDynamic(final String link, final StaplerRequest request, final StaplerResponse response) {
  if ("configureDefaults".equals(link)) {
    Ancestor ancestor = request.findAncestor(AbstractProject.class);
    if (ancestor.getObject() instanceof AbstractProject) {
      AbstractProject<?, ?> project = (AbstractProject<?, ?>)ancestor.getObject();
      return new DefaultGraphConfigurationView(
          new GraphConfiguration(WarningsProjectAction.getAllGraphs()), project, "warnings",
          new NullBuildHistory(),
          project.getAbsoluteUrl() + "/descriptorByName/WarningsPublisher/configureDefaults/");
    }
  }
  return null;
}

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

/**
 * Returns the graph configuration screen.
 *
 * @param link
 *            the link to check
 * @param request
 *            stapler request
 * @param response
 *            stapler response
 * @return the graph configuration or <code>null</code>
 */
public Object getDynamic(final String link, final StaplerRequest request, final StaplerResponse response) {
  if ("configureDefaults".equals(link)) {
    Ancestor ancestor = request.findAncestor(AbstractProject.class);
    if (ancestor.getObject() instanceof AbstractProject) {
      AbstractProject<?, ?> project = (AbstractProject<?, ?>)ancestor.getObject();
      return new DefaultGraphConfigurationView(
          new GraphConfiguration(WarningsProjectAction.getAllGraphs()), project, "warnings",
          new NullBuildHistory(),
          project.getAbsoluteUrl() + "/descriptorByName/WarningsPublisher/configureDefaults/");
    }
  }
  return null;
}

代码示例来源:origin: org.hudsonci.plugins/analysis-core

/**
 * This method will be called by Stapler if an example image for the
 * specified graph should be rendered.
 *
 * @param graphId
 *            the ID of the graph to render
 * @param request
 *            Stapler request
 * @param response
 *            Stapler response
 * @return <code>null</code>
 */
public Object getDynamic(final String graphId, final StaplerRequest request, final StaplerResponse response) {
  try {
    BuildResultGraph graph = configuration.getGraph(graphId);
    if (hasMeaningfulGraph()) {
      graph.setRootUrl(project.getAbsoluteUrl());
      if (graph.isVisible()) {
        return graph.getGraph(-1, configuration, null, buildHistory.getBaseline());
      }
    }
    response.sendRedirect2(request.getContextPath() + graph.getExampleImage());
  }
  catch (IOException exception) {
    LOGGER.log(Level.SEVERE, "Can't create graph: " + request, exception);
  }
  return null;
}

相关文章

微信公众号

最新文章

更多

AbstractProject类方法