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

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

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

StaplerRequest.getOriginalRestOfPath介绍

[英]Returns the same thing as #getRestOfPath() but in the pre-decoded form, so all "%HH"s as present in the request URL is intact.
[中]返回与#getRestOfPath()相同的内容,但以预解码的形式返回,因此请求URL中的所有“%HH”都是完整的。

代码示例

代码示例来源: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.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.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: 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: 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.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);
}

相关文章

微信公众号

最新文章

更多

StaplerRequest类方法