@Override public void process(final HttpResponse response, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(response, "HTTP response"); if (!response.containsHeader(HttpHeaders.SERVER) && this.originServer != null) { response.addHeader(HttpHeaders.SERVER, this.originServer); } }
@Override public void process(final HttpResponse response, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(response, "HTTP response"); if (!response.containsHeader(HttpHeaders.SERVER) && this.originServer != null) { response.addHeader(HttpHeaders.SERVER, this.originServer); } }
@Override public void process(final HttpResponse response, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(response, "HTTP response"); final int status = response.getCode(); if ((status >= HttpStatus.SC_OK) && !response.containsHeader(HttpHeaders.DATE)) { response.setHeader(HttpHeaders.DATE, HttpDateGenerator.INSTANCE.getCurrentDate()); } }
@Override public void process(final HttpResponse response, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(response, "HTTP response"); final int status = response.getCode(); if ((status >= HttpStatus.SC_OK) && !response.containsHeader(HttpHeaders.DATE)) { response.setHeader(HttpHeaders.DATE, HttpDateGenerator.INSTANCE.getCurrentDate()); } }
@Override public boolean isRedirected( final HttpRequest request, final HttpResponse response, final HttpContext context) throws ProtocolException { Args.notNull(request, "HTTP request"); Args.notNull(response, "HTTP response"); if (!response.containsHeader(HttpHeaders.LOCATION)) { return false; } final int statusCode = response.getCode(); switch (statusCode) { case HttpStatus.SC_MOVED_PERMANENTLY: case HttpStatus.SC_MOVED_TEMPORARILY: case HttpStatus.SC_SEE_OTHER: case HttpStatus.SC_TEMPORARY_REDIRECT: case HttpStatus.SC_PERMANENT_REDIRECT: return true; default: return false; } }
if (response.containsHeader(HttpHeaders.TRANSFER_ENCODING)) { return false;
if (response.containsHeader(HttpHeaders.TRANSFER_ENCODING)) { return false;
return; if (!response.containsHeader(HttpHeaders.CONNECTION)) { response.addHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE); } else { if (response.containsHeader(HttpHeaders.UPGRADE)) { response.addHeader(HttpHeaders.CONNECTION, HeaderElements.UPGRADE); } else {
return; if (!response.containsHeader(HttpHeaders.CONNECTION)) { response.addHeader(HttpHeaders.CONNECTION, HeaderElements.CLOSE); } else { if (response.containsHeader(HttpHeaders.UPGRADE)) { response.addHeader(HttpHeaders.CONNECTION, HeaderElements.UPGRADE); } else {
response.removeHeaders(HttpHeaders.CONTENT_LENGTH); } else { if (response.containsHeader(HttpHeaders.TRANSFER_ENCODING)) { throw new ProtocolException("Transfer-encoding header already present"); if (response.containsHeader(HttpHeaders.CONTENT_LENGTH)) { throw new ProtocolException("Content-Length header already present");
response.removeHeaders(HttpHeaders.CONTENT_LENGTH); } else { if (response.containsHeader(HttpHeaders.TRANSFER_ENCODING)) { throw new ProtocolException("Transfer-encoding header already present"); if (response.containsHeader(HttpHeaders.CONTENT_LENGTH)) { throw new ProtocolException("Content-Length header already present");