org.kohsuke.stapler.StaplerRequest.getRemoteAddr()方法的使用及代码示例

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

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

StaplerRequest.getRemoteAddr介绍

暂无

代码示例

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

@Override
  public void run() {
    try {
      ACL.impersonate(ACL.SYSTEM);
      LOGGER.info(String.format("Shutting down VM as requested by %s from %s",
          getAuthentication().getName(), req != null ? req.getRemoteAddr() : "???"));
      cleanUp();
      System.exit(0);
    } catch (Exception e) {
      LOGGER.log(Level.WARNING, "Failed to shut down Jenkins", e);
    }
  }
}.start();

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

/**
 * Computes the build cause, using RemoteCause or UserCause as appropriate.
 */
@Restricted(NoExternalUse.class)
public static final CauseAction getBuildCause(ParameterizedJob job, StaplerRequest req) {
  Cause cause;
  @SuppressWarnings("deprecation")
  hudson.model.BuildAuthorizationToken authToken = job.getAuthToken();
  if (authToken != null && authToken.getToken() != null && req.getParameter("token") != null) {
    // Optional additional cause text when starting via token
    String causeText = req.getParameter("cause");
    cause = new Cause.RemoteCause(req.getRemoteAddr(), causeText);
  } else {
    cause = new Cause.UserIdCause();
  }
  return new CauseAction(cause);
}

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

isQuietingDown = true;
final String exitUser = getAuthentication().getName();
final String exitAddr = req!=null ? req.getRemoteAddr() : "unknown";
new Thread("safe-exit thread") {
  @Override

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

/**
 * Shutdown the system.
 *
 * @since 1.161
 */
public void doExit(StaplerRequest req, StaplerResponse rsp) throws IOException {
  checkPermission(ADMINISTER);
  logger.error(String.format("Shutting down VM as requested by %s from %s",
      getAuthentication().getName(), req.getRemoteAddr()));
  rsp.setStatus(HttpServletResponse.SC_OK);
  rsp.setContentType("text/plain");
  PrintWriter w = rsp.getWriter();
  w.println("Shutting down");
  w.close();
  System.exit(0);
}

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

/**
 * Shutdown the system.
 * @since 1.161
 */
public void doExit(StaplerRequest req, StaplerResponse rsp) throws IOException {
  checkPermission(ADMINISTER);
  LOGGER.severe(String.format("Shutting down VM as requested by %s from %s",
      getAuthentication().getName(), req.getRemoteAddr()));
  rsp.setStatus(HttpServletResponse.SC_OK);
  rsp.setContentType("text/plain");
  PrintWriter w = rsp.getWriter();
  w.println("Shutting down");
  w.close();
  System.exit(0);
}

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

/**
 * Shutdown the system.
 * @since 1.161
 */
public void doExit(StaplerRequest req, StaplerResponse rsp) throws IOException {
  checkPermission(ADMINISTER);
  LOGGER.severe(String.format("Shutting down VM as requested by %s from %s",
      getAuthentication().getName(), req.getRemoteAddr()));
  rsp.setStatus(HttpServletResponse.SC_OK);
  rsp.setContentType("text/plain");
  PrintWriter w = rsp.getWriter();
  w.println("Shutting down");
  w.close();
  System.exit(0);
}

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

/**
 * Shutdown the system.
 * @since 1.161
 */
public void doExit(StaplerRequest req, StaplerResponse rsp) throws IOException {
  checkPermission(ADMINISTER);
  LOGGER.severe(String.format("Shutting down VM as requested by %s from %s",
      getAuthentication().getName(), req.getRemoteAddr()));
  rsp.setStatus(HttpServletResponse.SC_OK);
  rsp.setContentType("text/plain");
  PrintWriter w = rsp.getWriter();
  w.println("Shutting down");
  w.close();
  System.exit(0);
}

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

isQuietingDown = true;
final String exitUser = getAuthentication().getName();
final String exitAddr = req.getRemoteAddr().toString();
new Thread("safe-exit thread") {
  @Override

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

/**
 * Shutdown the system.
 * @since 1.161
 */
@CLIMethod(name="shutdown")
@RequirePOST
public void doExit( StaplerRequest req, StaplerResponse rsp ) throws IOException {
  checkPermission(ADMINISTER);
  LOGGER.severe(String.format("Shutting down VM as requested by %s from %s",
      getAuthentication().getName(), req!=null?req.getRemoteAddr():"???"));
  if (rsp!=null) {
    rsp.setStatus(HttpServletResponse.SC_OK);
    rsp.setContentType("text/plain");
    try (PrintWriter w = rsp.getWriter()) {
      w.println("Shutting down");
    }
  }
  cleanUp();
  System.exit(0);
}

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

isQuietingDown = true;
final String exitUser = getAuthentication().getName();
final String exitAddr = req.getRemoteAddr().toString();
new Thread("safe-exit thread") {

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

isQuietingDown = true;
final String exitUser = getAuthentication().getName();
final String exitAddr = req.getRemoteAddr().toString();
new Thread("safe-exit thread") {

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

isQuietingDown = true;
final String exitUser = getAuthentication().getName();
final String exitAddr = req.getRemoteAddr().toString();
new Thread("safe-exit thread") {

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

/**
 * Computes the build cause, using RemoteCause or UserCause as appropriate.
 */
/*package*/ CauseAction getBuildCause(StaplerRequest req) {
  Cause cause;
  if (authToken != null && authToken.getToken() != null && req.getParameter("token") != null) {
    // Optional additional cause text when starting via token
    String causeText = req.getParameter("cause");
    cause = new RemoteCause(req.getRemoteAddr(), causeText);
  } else {
    cause = new UserCause();
  }
  return new CauseAction(cause);
}

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

/**
 * Computes the build cause, using RemoteCause or UserCause as appropriate.
 */
/*package*/ CauseAction getBuildCause(StaplerRequest req) {
  Cause cause;
  if (authToken != null && authToken.getToken() != null && req.getParameter("token") != null) {
    // Optional additional cause text when starting via token
    String causeText = req.getParameter("cause");
    cause = new RemoteCause(req.getRemoteAddr(), causeText);
  } else {
    cause = new UserCause();
  }
  return new CauseAction(cause);
}

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

/**
 * Computes the build cause, using RemoteCause or UserCause as appropriate.
 */
/*
 * package
 */ CauseAction getBuildCause(StaplerRequest req) {
  Cause cause;
  if (authToken != null && authToken.getToken() != null && req.getParameter("token") != null) {
    // Optional additional cause text when starting via token
    String causeText = req.getParameter("cause");
    cause = new RemoteCause(req.getRemoteAddr(), causeText);
  } else {
    cause = new UserCause();
  }
  return new CauseAction(cause);
}

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

/**
 * Computes the build cause, using RemoteCause or UserCause as appropriate.
 */
/*
 * package
 */ CauseAction getBuildCause(StaplerRequest req) {
  Cause cause;
  if (authToken != null && authToken.getToken() != null && req.getParameter("token") != null) {
    // Optional additional cause text when starting via token
    String causeText = req.getParameter("cause");
    cause = new RemoteCause(req.getRemoteAddr(), causeText);
  } else {
    cause = new UserCause();
  }
  return new CauseAction(cause);
}

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

/**
 * Computes the build cause, using RemoteCause or UserCause as appropriate.
 */
@Restricted(NoExternalUse.class)
public static final CauseAction getBuildCause(ParameterizedJob job, StaplerRequest req) {
  Cause cause;
  @SuppressWarnings("deprecation")
  hudson.model.BuildAuthorizationToken authToken = job.getAuthToken();
  if (authToken != null && authToken.getToken() != null && req.getParameter("token") != null) {
    // Optional additional cause text when starting via token
    String causeText = req.getParameter("cause");
    cause = new Cause.RemoteCause(req.getRemoteAddr(), causeText);
  } else {
    cause = new Cause.UserIdCause();
  }
  return new CauseAction(cause);
}

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

isQuietingDown = true;
final String exitUser = getAuthentication().getName();
final String exitAddr = req!=null ? req.getRemoteAddr() : "unknown";
new Thread("safe-exit thread") {
  @Override

代码示例来源:origin: hudson.plugins/project-inheritance

/**
 * This is a copy (not a wrapper) of getBuildCause() in
 * {@link AbstractProject}. This is necessary, because we can't access
 * that field as our parent is loaded by a different class loader.
 * <p>
 * The function is used, because we need to splice-in one additional
 * {@link Action} for creation of Builds: {@link VersioningAction}.
 * <p>
 * FIXME: The ideal solution to this is to simply add an Extension Point
 * into Jenkins, that allows one to contribute additional actions.
 * 
 * @param req
 * @return
 */
@SuppressWarnings("deprecation")
public CauseAction getBuildCauseOverride(StaplerRequest req) {
  Cause cause;
  if (getAuthToken() != null &&
      getAuthToken().getToken() != null &&
      req.getParameter("token") != null) {
    // Optional additional cause text when starting via token
    String causeText = req.getParameter("cause");
    cause = new RemoteCause(req.getRemoteAddr(), causeText);
  } else {
    cause = new UserIdCause();
  }
  return new CauseAction(cause);
}

代码示例来源:origin: i-m-c/jenkins-inheritance-plugin

cause = new RemoteCause(req.getRemoteAddr(), causeText);
} else {
  Object rebuild = req.getAttribute("rebuildCause");

相关文章

微信公众号

最新文章

更多

StaplerRequest类方法