Example #1
0
 protected HttpResponse newHttpResponse(HttpMessageBuffer msg, HttpResponseException e) {
   HttpResponse httpRsp = e.toHttpResponse(msg.getHttpVersionString());
   if (msg.getHttpVersion() > 1.0) {
     httpRsp.addHeader(HttpConstants.Headers.HOST, this.headerHostValue);
   }
   httpRsp.addHeader(HttpConstants.Headers.SERVER, this.getServerName());
   httpRsp.addHeader(HttpConstants.Headers.CONNECTION, "close");
   return httpRsp;
 }
Example #2
0
 protected HttpResponse newHttpResponse(
     HttpMessageBuffer origMsg, int statusCode, String reasonPhrase, Encoding encoding) {
   Encoding responseEncoding = null;
   if (this.encodeResponses) {
     responseEncoding = encoding;
   }
   HttpResponse httpRsp;
   if (origMsg == null) {
     httpRsp = new HttpResponse(statusCode, reasonPhrase, responseEncoding);
   } else {
     httpRsp =
         new HttpResponse(
             origMsg.getHttpVersionString(), statusCode, reasonPhrase, responseEncoding);
   }
   if (origMsg.getHttpVersion() > 1.0) {
     httpRsp.addHeader(HttpConstants.Headers.HOST, this.headerHostValue);
   }
   httpRsp.addHeader(HttpConstants.Headers.SERVER, this.getServerName());
   return httpRsp;
 }