com.sun.grizzly.tcp.http11.GrizzlyResponse.addHeader()方法的使用及代码示例

x33g5p2x  于2022-01-20 转载在 其他  
字(4.6k)|赞(0)|评价(0)|浏览(112)

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

GrizzlyResponse.addHeader介绍

[英]Add the specified header to the specified value.
[中]将指定的标头添加到指定的值。

代码示例

代码示例来源:origin: org.jvnet.jax-ws-commons/jaxws-grizzly-httpspi

@Override
public void addResponseHeader(String name, String value) {
  response.addHeader(name, value);
}

代码示例来源:origin: com.sun.grizzly/grizzly-http-servlet

/**
 * {@inheritDoc}
 */
public void addHeader(String name, String value) {
  if (isCommitted())
    return;
  response.addHeader(name, value);
}

代码示例来源:origin: org.jvnet.jax-ws-commons/jaxws-grizzly-httpspi

@Override
public List<String> put(String key, List<String> value) {
  for(String val : value) {
    response.addHeader(key, val);
  }
  return super.put(key, value);
}

代码示例来源:origin: org.glassfish.external/grizzly-module

/**
 * Add the specified integer header to the specified value.
 *
 * @param name Name of the header to set
 * @param value Integer value to be set
 */
public void addIntHeader(String name, int value) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  addHeader(name, "" + value);
}

代码示例来源:origin: com.sun.grizzly/grizzly-http-utils

/**
 * Add the specified integer header to the specified value.
 *
 * @param name Name of the header to set
 * @param value Integer value to be set
 */
public void addIntHeader(String name, int value) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  addHeader(name, "" + value);
}

代码示例来源:origin: com.sun.grizzly/grizzly-utils

/**
 * Add the specified integer header to the specified value.
 *
 * @param name Name of the header to set
 * @param value Integer value to be set
 */
public void addIntHeader(String name, int value) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included)
    return;
  addHeader(name, "" + value);
}

代码示例来源:origin: com.sun.grizzly/grizzly-http-utils

/**
 * Add the specified date header to the specified value.
 *
 * @param name Name of the header to set
 * @param value Date value to be set
 */
public void addDateHeader(String name, long value) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included) {
    return;
  }
  if (format == null) {
    format = new SimpleDateFormat(DateTool.HTTP_RESPONSE_DATE_HEADER,
                   Locale.US);
    format.setTimeZone(TimeZone.getTimeZone("GMT"));
  }
  addHeader(name, FastHttpDateFormat.formatDate(value, format));
}

代码示例来源:origin: com.sun.grizzly/grizzly-utils

/**
 * Add the specified date header to the specified value.
 *
 * @param name Name of the header to set
 * @param value Date value to be set
 */
public void addDateHeader(String name, long value) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included) {
    return;
  }
  if (format == null) {
    format = new SimpleDateFormat(HTTP_RESPONSE_DATE_HEADER,
                   Locale.US);
    format.setTimeZone(TimeZone.getTimeZone("GMT"));
  }
  addHeader(name, FastHttpDateFormat.formatDate(value, format));
}

代码示例来源:origin: org.glassfish.external/grizzly-module

/**
 * Add the specified date header to the specified value.
 *
 * @param name Name of the header to set
 * @param value Date value to be set
 */
public void addDateHeader(String name, long value) {
  if (isCommitted())
    return;
  // Ignore any call from an included servlet
  if (included) {
    return;
  }
  if (format == null) {
    format = new SimpleDateFormat(DateTool.HTTP_RESPONSE_DATE_HEADER,
                   Locale.US);
    format.setTimeZone(TimeZone.getTimeZone("GMT"));
  }
  addHeader(name, FastHttpDateFormat.formatDate(value, format));
}

代码示例来源:origin: jcabi/jcabi-http

response.addHeader(name, value);
response.addHeader(
  HttpHeaders.SERVER,
  String.format(

代码示例来源:origin: org.glassfish.external/grizzly-module

addHeader("Set-Cookie", sb.toString());

代码示例来源:origin: com.sun.grizzly/grizzly-utils

addHeader("Set-Cookie", sb.toString());

代码示例来源:origin: com.sun.grizzly/grizzly-http-utils

addHeader("Set-Cookie", sb.toString());

代码示例来源:origin: com.sun.jersey/jersey-bundle

public OutputStream writeStatusAndHeaders(long contentLength, 
    ContainerResponse cResponse) throws IOException {
  final javax.ws.rs.core.Response.StatusType statusInfo = cResponse.getStatusType();
  if (statusInfo.getReasonPhrase() == null) {
    response.setStatus(statusInfo.getStatusCode());
  } else {
    response.setStatus(statusInfo.getStatusCode(), statusInfo.getReasonPhrase());
  }
  if (contentLength != -1 && contentLength < Integer.MAX_VALUE) 
    response.setContentLength((int)contentLength);
  for (Map.Entry<String, List<Object>> e : cResponse.getHttpHeaders().entrySet()) {
    for (Object value : e.getValue()) {
      response.addHeader(e.getKey(), ContainerResponse.getHeaderValue(value));
    }
  }
  String contentType = response.getHeader("Content-Type");
  if (contentType != null) {
    response.setContentType(contentType);
  }
    
  return response.getOutputStream();
}

相关文章

微信公众号

最新文章

更多