APISonar


org.jboss.netty.handler.codec.http.HttpHeaders.Names.DATE

> org > jboss > netty > handler > codec > http > HttpHeaders > Names > DATE
org APIs jboss APIs netty APIs handler APIs codec APIs http APIs HttpHeaders APIs Names APIs DATE APIs

Example 1
public void handleHttpRequest(HttpRequest request, HttpResponse response, HttpControl control) throws Exception {
        if (!response.containsHeader(HttpHeaders.Names.DATE)) {
            response.header(HttpHeaders.Names.DATE, new Date());
        }
        control.nextHandler();
    }
Example 2
private void removeResponseBody(BaseMessage msg, MappingHttpResponse httpResponse) {
    // Populate all the common fields. These fields normally get populated in the outbound stage of the parent handler but get skipped in this case
    // due to an empty message body
    httpResponse.setHeader(HttpHeaders.Names.DATE, DateFormatter.dateToHeaderFormattedString(new Date()));
    httpResponse.setHeader(HttpHeaders.Names.CONTENT_LENGTH, String.valueOf(0));
    if (msg.getCorrelationId() != null) {
      httpResponse.setHeader(ObjectStorageProperties.AMZ_REQUEST_ID, msg.getCorrelationId());
    }
    // Null the message body to remove it
    httpResponse.setMessage(null);
  }