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

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

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

StaplerRequest.getCookies介绍

暂无

代码示例

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

/**
 * Changes the test result report display mode.
 */
public void doFlipTrend( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  boolean failureOnly = false;
  // check the current preference value
  Cookie[] cookies = req.getCookies();
  if(cookies!=null) {
    for (Cookie cookie : cookies) {
      if(cookie.getName().equals(FAILURE_ONLY_COOKIE))
        failureOnly = Boolean.parseBoolean(cookie.getValue());
    }
  }
  // flip!
  failureOnly = !failureOnly;
  // set the updated value
  Cookie cookie = new Cookie(FAILURE_ONLY_COOKIE,String.valueOf(failureOnly));
  List anc = req.getAncestors();
  Ancestor a = (Ancestor) anc.get(anc.size()-2);
  cookie.setPath(a.getUrl()); // just for this project
  cookie.setMaxAge(60*60*24*365); // 1 year
  rsp.addCookie(cookie);
  // back to the project page
  rsp.sendRedirect("..");
}

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

/**
 * Changes the test result report display mode.
 */
public void doFlipTrend( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  boolean failureOnly = false;
  // check the current preference value
  Cookie[] cookies = req.getCookies();
  if(cookies!=null) {
    for (Cookie cookie : cookies) {
      if(cookie.getName().equals(FAILURE_ONLY_COOKIE))
        failureOnly = Boolean.parseBoolean(cookie.getValue());
    }
  }
  // flip!
  failureOnly = !failureOnly;
  // set the updated value
  Cookie cookie = new Cookie(FAILURE_ONLY_COOKIE,String.valueOf(failureOnly));
  List anc = req.getAncestors();
  Ancestor a = (Ancestor) anc.get(anc.size()-2);
  cookie.setPath(a.getUrl()); // just for this project
  cookie.setMaxAge(60*60*24*365); // 1 year
  rsp.addCookie(cookie);
  // back to the project page
  rsp.sendRedirect("..");
}

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

/**
 * Changes the test result report display mode.
 */
public void doFlipTrend( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  boolean failureOnly = false;
  // check the current preference value
  Cookie[] cookies = req.getCookies();
  if(cookies!=null) {
    for (Cookie cookie : cookies) {
      if(cookie.getName().equals(FAILURE_ONLY_COOKIE))
        failureOnly = Boolean.parseBoolean(cookie.getValue());
    }
  }
  // flip!
  failureOnly = !failureOnly;
  // set the updated value
  Cookie cookie = new Cookie(FAILURE_ONLY_COOKIE,String.valueOf(failureOnly));
  List anc = req.getAncestors();
  Ancestor a = (Ancestor) anc.get(anc.size()-2);
  cookie.setPath(a.getUrl()); // just for this project
  cookie.setMaxAge(60*60*24*365); // 1 year
  rsp.addCookie(cookie);
  // back to the project page
  rsp.sendRedirect("..");
}

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

/**
 * Changes the test result report display mode.
 */
public void doFlipTrend( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  boolean failureOnly = false;
  // check the current preference value
  Cookie[] cookies = req.getCookies();
  if(cookies!=null) {
    for (Cookie cookie : cookies) {
      if(cookie.getName().equals(FAILURE_ONLY_COOKIE))
        failureOnly = Boolean.parseBoolean(cookie.getValue());
    }
  }
  // flip!
  failureOnly = !failureOnly;
  // set the updated value
  Cookie cookie = new Cookie(FAILURE_ONLY_COOKIE,String.valueOf(failureOnly));
  List anc = req.getAncestors();
  Ancestor a = (Ancestor) anc.get(anc.size()-2);
  cookie.setPath(a.getUrl()); // just for this project
  cookie.setMaxAge(60*60*24*365); // 1 year
  rsp.addCookie(cookie);
  // back to the project page
  rsp.sendRedirect("..");
}

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

/**
 * Changes the test result report display mode.
 */
public void doFlipTrend(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  boolean failureOnly = false;
  // check the current preference value
  Cookie[] cookies = req.getCookies();
  if (cookies != null) {
    for (Cookie cookie : cookies) {
      if (cookie.getName().equals(FAILURE_ONLY_COOKIE)) {
        failureOnly = Boolean.parseBoolean(cookie.getValue());
      }
    }
  }
  // flip!
  failureOnly = !failureOnly;
  // set the updated value
  Cookie cookie = new Cookie(FAILURE_ONLY_COOKIE, String.valueOf(failureOnly));
  List anc = req.getAncestors();
  Ancestor a = (Ancestor) anc.get(anc.size() - 2);
  cookie.setPath(a.getUrl()); // just for this project
  cookie.setMaxAge(60 * 60 * 24 * 365); // 1 year
  rsp.addCookie(cookie);
  // back to the project page
  rsp.sendRedirect("..");
}
private static final String FAILURE_ONLY_COOKIE = "TestResultAction_failureOnly";

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

public GraphConfigurationDetail(final Job<?, ?> project,
                final String pluginName, final StaplerRequest request) {
  String value = createCookieHandler(pluginName).getValue(
      request.getCookies());
  List<Integer> initializationListResult = initializeFrom(value);
  if (!initializationListResult.isEmpty()) {
    File defaultsFile = createDefaultsFile(project, pluginName);
    if (defaultsFile.exists()) {
      String defaultValue = readFromDefaultsFile(defaultsFile);
      initializationListResult = initializeFrom(defaultValue);
      if (!initializationListResult.isEmpty()) {
        reset(initializationListResult);
      }
    } else {
      reset(initializationListResult);
    }
  }
}

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

/**
 * Creates a view to configure the trend graph for the current user.
 *
 * @param request
 *            Stapler request
 * @return a view to configure the trend graph for the current user
 */
protected GraphConfigurationView createUserConfiguration(final StaplerRequest request) {
  return new UserGraphConfigurationView(createConfiguration(), getOwner(),
      getUrlName(), request.getCookies(), createBuildHistory());
}

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

/**
 * Creates a view to configure the trend graph for the current user.
 *
 * @param request
 *            Stapler request
 * @return a view to configure the trend graph for the current user
 */
protected GraphConfigurationView createUserConfiguration(final StaplerRequest request) {
  return new UserGraphConfigurationView(createConfiguration(), getProject(),
      getUrlName(), request.getCookies(), createBuildHistory());
}

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

private UserGraphConfigurationView createUserConfiguration(final StaplerRequest request, final String urlName) {
  return new UserGraphConfigurationView(
      createConfiguration(getAvailableGraphs()), getOwner(),
      urlName, WarningsDescriptor.getProjectUrl(null),
      request.getCookies(), createBuildHistory());
}

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

/** {@inheritDoc} */
@Override
protected GraphConfigurationView createUserConfiguration(final StaplerRequest request) {
  return new UserGraphConfigurationView(
      createConfiguration(getAvailableGraphs()), getProject(),
      WarningsDescriptor.getProjectUrl(parser), WarningsDescriptor.getProjectUrl(null),
      request.getCookies(), createBuildHistory());
}

相关文章

微信公众号

最新文章

更多

StaplerRequest类方法