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

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

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

StaplerRequest.getQueryString介绍

暂无

代码示例

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

/**
 * RSS feed for log entries.
 *
 * @deprecated
 *   As on 1.267, moved to "/log/rss..."
 */
@Deprecated
public void doLogRss( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  String qs = req.getQueryString();
  rsp.sendRedirect2("./log/rss"+(qs==null?"":'?'+qs));
}

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

/**
 * Changes the icon size by changing the cookie
 */
public void doIconSize( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  String qs = req.getQueryString();
  if(qs==null)
    throw new ServletException();
  Cookie cookie = new Cookie("iconSize", Functions.validateIconSize(qs));
  cookie.setMaxAge(/* ~4 mo. */9999999); // #762
  rsp.addCookie(cookie);
  String ref = req.getHeader("Referer");
  if(ref==null)   ref=".";
  rsp.sendRedirect2(ref);
}

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

/**
 * Checks if the user was successfully authenticated.
 *
 * @see BasicAuthenticationFilter
 */
public void doSecured( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  // TODO fire something in SecurityListener? (seems to be used only for REST calls when LegacySecurityRealm is active)
  if(req.getUserPrincipal()==null) {
    // authentication must have failed
    rsp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
    return;
  }
  // the user is now authenticated, so send him back to the target
  String path = req.getContextPath()+req.getOriginalRestOfPath();
  String q = req.getQueryString();
  if(q!=null)
    path += '?'+q;
  rsp.sendRedirect2(path);
}

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

/**
 * RSS feed for log entries.
 *
 * @deprecated
 *   As on 1.267, moved to "/log/rss..."
 */
@Deprecated
public void doLogRss( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  String qs = req.getQueryString();
  rsp.sendRedirect2("./log/rss"+(qs==null?"":'?'+qs));
}

代码示例来源:origin: org.kohsuke.sorcerer/sorcerer-stapler

void doDynamic(StaplerRequest request, StaplerResponse rsp) throws IOException {
    rsp.sendRedirect(".?"+request.getQueryString());
  }
});

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

/**
 * RSS feed for log entries.
 *
 * @deprecated As on 1.267, moved to "/log/rss..."
 */
public void doLogRss(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  String qs = req.getQueryString();
  rsp.sendRedirect2("./log/rss" + (qs == null ? "" : '?' + qs));
}

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

/**
 * RSS feed for log entries.
 *
 * @deprecated
 *   As on 1.267, moved to "/log/rss..."
 */
public void doLogRss(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  String qs = req.getQueryString();
  rsp.sendRedirect2("./log/rss" + (qs == null ? "" : '?' + qs));
}

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

/**
 * RSS feed for log entries.
 *
 * @deprecated
 *   As on 1.267, moved to "/log/rss..."
 */
public void doLogRss(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  String qs = req.getQueryString();
  rsp.sendRedirect2("./log/rss" + (qs == null ? "" : '?' + qs));
}

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

/**
 * RSS feed for log entries.
 *
 * @deprecated
 *   As on 1.267, moved to "/log/rss..."
 */
public void doLogRss(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  String qs = req.getQueryString();
  rsp.sendRedirect2("./log/rss" + (qs == null ? "" : '?' + qs));
}

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

/**
 * Changes the icon size by changing the cookie
 */
public void doIconSize(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  String qs = req.getQueryString();
  if (qs == null || !ICON_SIZE.matcher(qs).matches()) {
    throw new ServletException();
  }
  Cookie cookie = new Cookie("iconSize", qs);
  cookie.setMaxAge(/* ~4 mo. */9999999); // #762
  rsp.addCookie(cookie);
  String ref = req.getHeader("Referer");
  if (ref == null) {
    ref = ".";
  }
  rsp.sendRedirect2(ref);
}

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

/**
 * Changes the icon size by changing the cookie
 */
public void doIconSize(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  String qs = req.getQueryString();
  if (qs == null || !ICON_SIZE.matcher(qs).matches()) {
    throw new ServletException();
  }
  Cookie cookie = new Cookie("iconSize", qs);
  cookie.setMaxAge(/* ~4 mo. */9999999); // #762
  rsp.addCookie(cookie);
  String ref = req.getHeader("Referer");
  if (ref == null) {
    ref = ".";
  }
  rsp.sendRedirect2(ref);
}

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

/**
 * Changes the icon size by changing the cookie
 */
public void doIconSize(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  String qs = req.getQueryString();
  if (qs == null || !ICON_SIZE.matcher(qs).matches()) {
    throw new ServletException();
  }
  Cookie cookie = new Cookie("iconSize", qs);
  cookie.setMaxAge(/* ~4 mo. */9999999); // #762
  rsp.addCookie(cookie);
  String ref = req.getHeader("Referer");
  if (ref == null) {
    ref = ".";
  }
  rsp.sendRedirect2(ref);
}

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

/**
 * Changes the icon size by changing the cookie
 */
public void doIconSize(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  String qs = req.getQueryString();
  if (qs == null || !ICON_SIZE.matcher(qs).matches()) {
    throw new ServletException();
  }
  Cookie cookie = new Cookie("iconSize", qs);
  cookie.setMaxAge(/* ~4 mo. */9999999); // #762
  rsp.addCookie(cookie);
  String ref = req.getHeader("Referer");
  if (ref == null) {
    ref = ".";
  }
  rsp.sendRedirect2(ref);
}

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

/**
 * Changes the icon size by changing the cookie
 */
public void doIconSize( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  String qs = req.getQueryString();
  if(qs==null)
    throw new ServletException();
  Cookie cookie = new Cookie("iconSize", Functions.validateIconSize(qs));
  cookie.setMaxAge(/* ~4 mo. */9999999); // #762
  rsp.addCookie(cookie);
  String ref = req.getHeader("Referer");
  if(ref==null)   ref=".";
  rsp.sendRedirect2(ref);
}

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

/**
 * Checks if the user was successfully authenticated.
 *
 * @see BasicAuthenticationFilter
 */
public void doSecured( StaplerRequest req, StaplerResponse rsp ) throws IOException, ServletException {
  // TODO fire something in SecurityListener? (seems to be used only for REST calls when LegacySecurityRealm is active)
  if(req.getUserPrincipal()==null) {
    // authentication must have failed
    rsp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
    return;
  }
  // the user is now authenticated, so send him back to the target
  String path = req.getContextPath()+req.getOriginalRestOfPath();
  String q = req.getQueryString();
  if(q!=null)
    path += '?'+q;
  rsp.sendRedirect2(path);
}

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

/**
 * Checks if the user was successfully authenticated.
 *
 * @see BasicAuthenticationFilter
 */
public void doSecured(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  if (req.getUserPrincipal() == null) {
    // authentication must have failed
    rsp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
    return;
  }
  // the user is now authenticated, so send him back to the target
  String path = req.getContextPath() + req.getOriginalRestOfPath();
  String q = req.getQueryString();
  if (q != null) {
    path += '?' + q;
  }
  rsp.sendRedirect2(path);
}

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

/**
 * Checks if the user was successfully authenticated.
 *
 * @see BasicAuthenticationFilter
 */
public void doSecured(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  if (req.getUserPrincipal() == null) {
    // authentication must have failed
    rsp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
    return;
  }
  // the user is now authenticated, so send him back to the target
  String path = req.getContextPath() + req.getOriginalRestOfPath();
  String q = req.getQueryString();
  if (q != null) {
    path += '?' + q;
  }
  rsp.sendRedirect2(path);
}

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

/**
 * Checks if the user was successfully authenticated.
 *
 * @see BasicAuthenticationFilter
 */
public void doSecured(StaplerRequest req, StaplerResponse rsp) throws IOException, ServletException {
  if (req.getUserPrincipal() == null) {
    // authentication must have failed
    rsp.setStatus(HttpServletResponse.SC_UNAUTHORIZED);
    return;
  }
  // the user is now authenticated, so send him back to the target
  String path = req.getContextPath() + req.getOriginalRestOfPath();
  String q = req.getQueryString();
  if (q != null) {
    path += '?' + q;
  }
  rsp.sendRedirect2(path);
}

代码示例来源:origin: groupon/DotCi

@Override
public Object getDynamic(final String token, final StaplerRequest req, final StaplerResponse rsp) {
  try {
    final Build item = getRun(Combination.fromString(token));
    if (item != null) {
      if (item.getNumber() == this.getNumber()) {
        return item;
      } else {
        // redirect the user to the correct URL
        String url = Functions.joinPath(item.getUrl(), req.getRestOfPath());
        final String qs = req.getQueryString();
        if (qs != null) {
          url += '?' + qs;
        }
        throw HttpResponses.redirectViaContextPath(url);
      }
    }
  } catch (final IllegalArgumentException e) {
    // failed to parse the token as Combination. Must be something else
  }
  return super.getDynamic(token, req, rsp);
}

代码示例来源:origin: org.jenkins-ci.plugins/matrix-project

@Override
public Object getDynamic(String token, StaplerRequest req, StaplerResponse rsp) {
  try {
    MatrixRun item = getRun(Combination.fromString(token));
    if(item!=null) {
      if (item.getNumber()==this.getNumber())
        return item;
      else {
        // redirect the user to the correct URL
        String url = Functions.joinPath(item.getUrl(), req.getRestOfPath());
        String qs = req.getQueryString();
        if (qs!=null)   url+='?'+qs;
        throw HttpResponses.redirectViaContextPath(url);
      }
    }
  } catch (IllegalArgumentException ignored) {
    // failed to parse the token as Combination. Must be something else
  }
  return super.getDynamic(token,req,rsp);
}

相关文章

微信公众号

最新文章

更多

StaplerRequest类方法