org.apache.coyote.Response.getMimeHeaders()方法的使用及代码示例

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

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

Response.getMimeHeaders介绍

暂无

代码示例

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

private static HttpHeaders createTomcatHttpHeaders(HttpServletResponse response) {
  ResponseFacade responseFacade = getResponseFacade(response);
  org.apache.catalina.connector.Response connectorResponse = (org.apache.catalina.connector.Response)
      ReflectionUtils.getField(COYOTE_RESPONSE_FIELD, responseFacade);
  Assert.state(connectorResponse != null, "No Tomcat connector response");
  Response tomcatResponse = connectorResponse.getCoyoteResponse();
  TomcatHeadersAdapter headers = new TomcatHeadersAdapter(tomcatResponse.getMimeHeaders());
  return new HttpHeaders(headers);
}

代码示例来源:origin: org.springframework/spring-web

private static HttpHeaders createTomcatHttpHeaders(HttpServletResponse response) {
  ResponseFacade responseFacade = getResponseFacade(response);
  org.apache.catalina.connector.Response connectorResponse = (org.apache.catalina.connector.Response)
      ReflectionUtils.getField(COYOTE_RESPONSE_FIELD, responseFacade);
  Assert.state(connectorResponse != null, "No Tomcat connector response");
  Response tomcatResponse = connectorResponse.getCoyoteResponse();
  TomcatHeadersAdapter headers = new TomcatHeadersAdapter(tomcatResponse.getMimeHeaders());
  return new HttpHeaders(headers);
}

代码示例来源:origin: line/armeria

private static HttpHeaders convertResponse(Response coyoteRes) {
  final HttpHeaders headers = HttpHeaders.of(HttpStatus.valueOf(coyoteRes.getStatus()));
  final String contentType = coyoteRes.getContentType();
  if (contentType != null && !contentType.isEmpty()) {
    headers.set(HttpHeaderNames.CONTENT_TYPE, contentType);
  }
  final long contentLength = coyoteRes.getBytesWritten(true); // 'true' will trigger flush.
  final String method = coyoteRes.getRequest().method().toString();
  if (!"HEAD".equals(method)) {
    headers.setLong(HttpHeaderNames.CONTENT_LENGTH, contentLength);
  }
  final MimeHeaders cHeaders = coyoteRes.getMimeHeaders();
  final int numHeaders = cHeaders.size();
  for (int i = 0; i < numHeaders; i++) {
    final AsciiString name = toHeaderName(cHeaders.getName(i));
    if (name == null) {
      continue;
    }
    final String value = toHeaderValue(cHeaders.getValue(i));
    if (value == null) {
      continue;
    }
    headers.add(name.toLowerCase(), value);
  }
  return headers;
}

代码示例来源:origin: tomcat/catalina

/**
 * Return the value for the specified header, or <code>null</code> if this
 * header has not been set.  If more than one value was added for this
 * name, only the first is returned; use getHeaderValues() to retrieve all
 * of them.
 *
 * @param name Header name to look up
 */
public String getHeader(String name) {
  return coyoteResponse.getMimeHeaders().getHeader(name);
}

代码示例来源:origin: org.osivia.portal.core/osivia-portal-jbossas-jbossweb-lib

/*      */   public String getHeader(String name)
/*      */   {
/*  849 */     return this.coyoteResponse.getMimeHeaders().getHeader(name);
/*      */   }
/*      */

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

@Override
public Collection<String> getHeaders(String name) {
  Enumeration<String> enumeration =
    coyoteResponse.getMimeHeaders().values(name);
  Vector<String> result = new Vector<String>();
  while (enumeration.hasMoreElements()) {
    result.addElement(enumeration.nextElement());
  }
  return result;
}

代码示例来源:origin: org.apache.catalina/com.springsource.org.apache.catalina

/**
 * Return the value for the specified header, or <code>null</code> if this
 * header has not been set.  If more than one value was added for this
 * name, only the first is returned; use {@link #getHeaders(String)} to
 * retrieve all of them.
 *
 * @param name Header name to look up
 */
@Override
public String getHeader(String name) {
  return coyoteResponse.getMimeHeaders().getHeader(name);
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-tomcat7

/**
 * Return the value for the specified header, or <code>null</code> if this
 * header has not been set.  If more than one value was added for this
 * name, only the first is returned; use {@link #getHeaders(String)} to
 * retrieve all of them.
 *
 * @param name Header name to look up
 */
@Override
public String getHeader(String name) {
  return coyoteResponse.getMimeHeaders().getHeader(name);
}

代码示例来源:origin: org.jboss.web/jbossweb

/**
 * Return the value for the specified header, or <code>null</code> if this
 * header has not been set.  If more than one value was added for this
 * name, only the first is returned; use getHeaderValues() to retrieve all
 * of them.
 *
 * @param name Header name to look up
 */
public String getHeader(String name) {
  return coyoteResponse.getMimeHeaders().getHeader(name);
}

代码示例来源:origin: jboss.web/jbossweb

/**
 * Return the value for the specified header, or <code>null</code> if this
 * header has not been set.  If more than one value was added for this
 * name, only the first is returned; use getHeaderValues() to retrieve all
 * of them.
 *
 * @param name Header name to look up
 */
public String getHeader(String name) {
  return coyoteResponse.getMimeHeaders().getHeader(name);
}

代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9

/**
 * Return the value for the specified header, or <code>null</code> if this
 * header has not been set.  If more than one value was added for this
 * name, only the first is returned; use {@link #getHeaders(String)} to
 * retrieve all of them.
 *
 * @param name Header name to look up
 */
@Override
public String getHeader(String name) {
  return coyoteResponse.getMimeHeaders().getHeader(name);
}

代码示例来源:origin: com.ovea.tajin.servers/tajin-server-jetty9

/**
 * Return the value for the specified header, or <code>null</code> if this
 * header has not been set.  If more than one value was added for this
 * name, only the first is returned; use {@link #getHeaders(String)} to
 * retrieve all of them.
 *
 * @param name Header name to look up
 */
@Override
public String getHeader(String name) {
  return coyoteResponse.getMimeHeaders().getHeader(name);
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
public Collection<String> getHeaders(String name) {
  Enumeration<String> enumeration =
    coyoteResponse.getMimeHeaders().values(name);
  Vector<String> result = new Vector<>();
  while (enumeration.hasMoreElements()) {
    result.addElement(enumeration.nextElement());
  }
  return result;
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

@Override
public Collection<String> getHeaders(String name) {
  Enumeration<String> enumeration =
      getCoyoteResponse().getMimeHeaders().values(name);
  Vector<String> result = new Vector<>();
  while (enumeration.hasMoreElements()) {
    result.addElement(enumeration.nextElement());
  }
  return result;
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
public Collection<String> getHeaders(String name) {
  Enumeration<String> enumeration =
      getCoyoteResponse().getMimeHeaders().values(name);
  Vector<String> result = new Vector<>();
  while (enumeration.hasMoreElements()) {
    result.addElement(enumeration.nextElement());
  }
  return result;
}

代码示例来源:origin: codefollower/Tomcat-Research

@Override
public Collection<String> getHeaderNames() {
  MimeHeaders headers = coyoteResponse.getMimeHeaders();
  int n = headers.size();
  List<String> result = new ArrayList<>(n);
  for (int i = 0; i < n; i++) {
    result.add(headers.getName(i).toString());
  }
  return result;
}

代码示例来源:origin: org.apache.geronimo.ext.tomcat/catalina

@Override
public Collection<String> getHeaderNames() {
  MimeHeaders headers = coyoteResponse.getMimeHeaders();
  int n = headers.size();
  List<String> result = new ArrayList<String>(n);
  for (int i = 0; i < n; i++) {
    result.add(headers.getName(i).toString());
  }
  return result;
}

代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.spring-web

private static HttpHeaders createTomcatHttpHeaders(HttpServletResponse response) {
  org.apache.catalina.connector.Response connectorResponse = (org.apache.catalina.connector.Response)
      ReflectionUtils.getField(COYOTE_RESPONSE_FIELD, response);
  Assert.state(connectorResponse != null, "No Tomcat connector response");
  Response tomcatResponse = connectorResponse.getCoyoteResponse();
  TomcatHeadersAdapter headers = new TomcatHeadersAdapter(tomcatResponse.getMimeHeaders());
  return new HttpHeaders(headers);
}

代码示例来源:origin: org.apache.tomcat/tomcat-catalina

@Override
public Collection<String> getHeaderNames() {
  MimeHeaders headers = getCoyoteResponse().getMimeHeaders();
  int n = headers.size();
  List<String> result = new ArrayList<>(n);
  for (int i = 0; i < n; i++) {
    result.add(headers.getName(i).toString());
  }
  return result;
}

代码示例来源:origin: org.ops4j.pax.tipi/org.ops4j.pax.tipi.tomcat-embed-core

@Override
public Collection<String> getHeaderNames() {
  MimeHeaders headers = getCoyoteResponse().getMimeHeaders();
  int n = headers.size();
  List<String> result = new ArrayList<>(n);
  for (int i = 0; i < n; i++) {
    result.add(headers.getName(i).toString());
  }
  return result;
}

相关文章