javax.servlet.http.HttpServletRequestWrapper.getHeader()方法的使用及代码示例

x33g5p2x  于2022-01-19 转载在 其他  
字(4.8k)|赞(0)|评价(0)|浏览(197)

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

HttpServletRequestWrapper.getHeader介绍

[英]The default behavior of this method is to return getHeader(String name) on the wrapped request object.
[中]此方法的默认行为是在包装的请求对象上返回getHeader(字符串名称)。

代码示例

代码示例来源:origin: Netflix/eureka

@Override
  public String getHeader(String name) {
    if (HttpHeaders.ACCEPT_ENCODING.equals(name)) {
      return "gzip";
    }
    return super.getHeader(name);
  }
};

代码示例来源:origin: cloudfoundry/uaa

@Override
public String getHeader(String name) {
  return super.getHeader(name);
}

代码示例来源:origin: cloudfoundry/uaa

@Override
public String getScheme() {
  String scheme = super.getScheme();
  logger.debug("Request X-Forwarded-Proto " + super.getHeader("X-Forwarded-Proto"));
  if ("http".equals(scheme) &&
          "https".equals(super.getHeader("X-Forwarded-Proto"))) {
    scheme = "https";
  }
  return scheme;
}

代码示例来源:origin: oblac/jodd

/**
 * Returns <code>null</code> for excluded HTTP headers.
 */
@Override
public String getHeader(final String header) {
  if (isExcluded(header)) {
    return null;
  }
  return super.getHeader(header);
}

代码示例来源:origin: cloudfoundry/uaa

@Override
public String getHeader(String name) {
  if (shouldFilter(name)) {
    return null;
  }
  return super.getHeader(name);
}

代码示例来源:origin: cloudfoundry/uaa

@Override
public int getServerPort() {
  int port = super.getServerPort();
  String scheme = super.getScheme();
  if ("http".equals(scheme) &&
          "https".equals(super.getHeader("X-Forwarded-Proto"))) {
    port = 443;
  }
  return port;
}

代码示例来源:origin: wuyouzhuguli/FEBS-Shiro

/**
 * 覆盖getHeader方法,将参数名和参数值都做xss过滤
 * 如果需要获得原始的值,则通过super.getHeaders(name)来获取
 * getHeaderNames 也可能需要覆盖
 */
@Override
public String getHeader(String name) {
  name = JsoupUtil.clean(name);
  String value = super.getHeader(name);
  if (StringUtils.isNotBlank(value)) {
    value = JsoupUtil.clean(value);
  }
  return value;
}

代码示例来源:origin: haraldk/TwelveMonkeys

public String getHeader(String pName) {
    if (HTTP_HEADER_ACCEPT.equals(pName)) {
      return fakeAccept;
    }
    return super.getHeader(pName);
  }
};

代码示例来源:origin: org.eclipse.jetty/jetty-security

@Override
public String getHeader(String name)
{
  if (name.toLowerCase(Locale.ENGLISH).startsWith("if-"))
    return null;
  return super.getHeader(name);
}

代码示例来源:origin: com.liferay.portal/com.liferay.portal.kernel

@Override
public String getHeader(String name) {
  if (name.equals(HttpHeaders.IF_MODIFIED_SINCE) ||
    name.equals(HttpHeaders.IF_NONE_MATCH) ||
    name.equals(HttpHeaders.LAST_MODIFIED)) {
    return null;
  }
  return super.getHeader(name);
}

代码示例来源:origin: spring-projects/spring-data-rest

@Override
public String getHeader(String name) {
  if (HttpHeaders.ACCEPT.equalsIgnoreCase(name) && acceptMediaTypes != null) {
    return StringUtils.collectionToCommaDelimitedString(acceptMediaTypes);
  }
  return super.getHeader(name);
}

代码示例来源:origin: paoding-code/paoding-rose

@Override
public String getHeader(String name) {
  if (isDisabledHeader(name)) {
    return null;
  }
  return super.getHeader(name);
}

代码示例来源:origin: pig4cloud/pig

@Override
public String getHeader(String name) {
  String value = super.getHeader(xssEncode(name));
  if (StringUtils.isNotBlank(value)) {
    value = xssEncode(value);
  }
  return value;
}

代码示例来源:origin: pig4cloud/pig

@Override
public ServletInputStream getInputStream() throws IOException {
  if (!MediaType.APPLICATION_JSON_VALUE.equalsIgnoreCase(super.getHeader(HttpHeaders.CONTENT_TYPE))) {
    return super.getInputStream();

代码示例来源:origin: i2p/i2p.i2p

@Override
public String getHeader(String name) {
  String value = super.getHeader(name);
  String rv = stripXSS(value, headerValuePattern);
  if (value != null && rv == null) {
    Log log = I2PAppContext.getGlobalContext().logManager().getLog(XSSRequestWrapper.class);
    log.logAlways(Log.WARN, "URL \"" + getServletPath() + "\" Stripped header \"" + name + "\" : \"" + value + '"');
  }
  return rv;
}

代码示例来源:origin: com.atlassian.jira/jira-core

@Override
public String getHeader(final String name)
{
  String header = super.getHeader(name);
  return header;
}

代码示例来源:origin: rancher/cattle

@Override
public String getHeader(String name) {
  if (PROJECT_HEADER.equalsIgnoreCase(name)) {
    return projectId;
  } else {
    return super.getHeader(name);
  }
}

代码示例来源:origin: com.stormpath.spring/stormpath-spring-security-webmvc

@Override
  public String getHeader(String name) {
    if (RequestAuthenticator.AUTHORIZATION_HEADER.equals(name)) {
      return null;
    }
    return super.getHeader(name);
  }
};

代码示例来源:origin: info.magnolia/magnolia-core

/**
 * Introduced for MAGNOLIA-3233.
 */
@Override
public String getHeader(String name) {
  return UnicodeNormalizer.normalizeNFC(super.getHeader(name));
}

代码示例来源:origin: yjjdick/sdb-mall

@Override
public String getHeader(String name) {
  String value = super.getHeader(xssEncode(name));
  if (StringUtils.isNotBlank(value)) {
    value = xssEncode(value);
  }
  return value;
}

相关文章

HttpServletRequestWrapper类方法