hudson.model.Job.sendError()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(3.3k)|赞(0)|评价(0)|浏览(101)

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

Job.sendError介绍

暂无

代码示例

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

} catch (JSONException e) {
  LOGGER.log(Level.WARNING, "failed to parse " + json, e);
  sendError(e, req, rsp);

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

/**
 * Accepts submission from the configuration page.
 */
public synchronized void doConfigSubmit(StaplerRequest req,
    StaplerResponse rsp) throws IOException, ServletException, FormException {
  checkPermission(CONFIGURE);
  try {
    setAllowSave(false);
    submit(req, rsp);
    setAllowSave(true);
    save();
    String newName = req.getParameter("name");
    if (newName != null && !newName.equals(name)) {
      // check this error early to avoid HTTP response splitting.
      Hudson.checkGoodName(newName);
      rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8"));
    } else {
      rsp.sendRedirect(".");
    }
  } catch (JSONException e) {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    pw.println("Failed to parse form data. Please report this problem as a bug");
    pw.println("JSON=" + req.getSubmittedForm());
    pw.println();
    e.printStackTrace(pw);
    rsp.setStatus(SC_BAD_REQUEST);
    sendError(sw.toString(), req, rsp, true);
  }
}

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

/**
 * Accepts submission from the configuration page.
 */
public synchronized void doConfigSubmit(StaplerRequest req,
    StaplerResponse rsp) throws IOException, ServletException, FormException {
  checkPermission(CONFIGURE);
  try {
    setAllowSave(false);
    submit(req, rsp);
    setAllowSave(true);
    save();
    String newName = req.getParameter("name");
    if (newName != null && !newName.equals(name)) {
      // check this error early to avoid HTTP response splitting.
      Hudson.checkGoodName(newName);
      rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8"));
    } else {
      rsp.sendRedirect(".");
    }
  } catch (JSONException e) {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    pw.println("Failed to parse form data. Please report this problem as a bug");
    pw.println("JSON=" + req.getSubmittedForm());
    pw.println();
    e.printStackTrace(pw);
    rsp.setStatus(SC_BAD_REQUEST);
    sendError(sw.toString(), req, rsp, true);
  }
}

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

/**
 * Accepts submission from the configuration page.
 */
public synchronized void doConfigSubmit(StaplerRequest req,
    StaplerResponse rsp) throws IOException, ServletException, FormException {
  checkPermission(CONFIGURE);
  try {
    setAllowSave(false);
    submit(req, rsp);
    setAllowSave(true);
    save();
    String newName = req.getParameter("name");
    if (newName != null && !newName.equals(name)) {
      // check this error early to avoid HTTP response splitting.
      Hudson.checkGoodName(newName);
      rsp.sendRedirect("rename?newName=" + URLEncoder.encode(newName, "UTF-8"));
    } else {
      rsp.sendRedirect(".");
    }
  } catch (JSONException e) {
    StringWriter sw = new StringWriter();
    PrintWriter pw = new PrintWriter(sw);
    pw.println("Failed to parse form data. Please report this problem as a bug");
    pw.println("JSON=" + req.getSubmittedForm());
    pw.println();
    e.printStackTrace(pw);
    rsp.setStatus(SC_BAD_REQUEST);
    sendError(sw.toString(), req, rsp, true);
  }
}

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

sendError(sw.toString(), req, rsp, true);

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

sendError(e, req, rsp);

相关文章

微信公众号

最新文章

更多

Job类方法