/** * Determines if the given response is generated from a stale cache entry. * @param httpResponse the response to be checked * @return whether the response is stale or not */ boolean isStale(final HttpResponse httpResponse) { for (final Iterator<Header> it = httpResponse.headerIterator(HeaderConstants.WARNING); it.hasNext(); ) { /* * warn-codes * 110 = Response is stale * 111 = Revalidation failed */ final Header warning = it.next(); final String warningValue = warning.getValue(); if (warningValue.startsWith("110") || warningValue.startsWith("111")) { return true; } } return false; }
headerGroup.setHeaders(entry.getHeaders()); for (final Iterator<Header> it = response.headerIterator(); it.hasNext(); ) { final Header responseHeader = it.next(); for (final Iterator<Header> it = response.headerIterator(); it.hasNext(); ) { final Header responseHeader = it.next();
@Override public void onResponseHead(final HttpConnection connection, final HttpResponse response) { if (headerLog.isDebugEnabled()) { headerLog.debug(id + " << " + new StatusLine(response)); for (final Iterator<Header> it = response.headerIterator(); it.hasNext(); ) { headerLog.debug(id + " << " + it.next()); } } }
@Override public void onResponseHead(final HttpConnection connection, final HttpResponse response) { if (headerLog.isDebugEnabled()) { final String idResponseDirection = LoggingSupport.getId(connection) + responseDirection; headerLog.debug(idResponseDirection + new StatusLine(response)); for (final Iterator<Header> it = response.headerIterator(); it.hasNext(); ) { headerLog.debug(idResponseDirection + it.next()); } } }
@Override public void onResponseHead(final HttpConnection connection, final HttpResponse response) { if (headerLog.isDebugEnabled()) { final String idResponseDirection = LoggingSupport.getId(connection) + responseDirection; headerLog.debug(idResponseDirection + new StatusLine(response)); for (final Iterator<Header> it = response.headerIterator(); it.hasNext(); ) { headerLog.debug(idResponseDirection + it.next()); } } }
/** * Determines if the given response is generated from a stale cache entry. * @param httpResponse the response to be checked * @return whether the response is stale or not */ boolean isStale(final HttpResponse httpResponse) { for (final Iterator<Header> it = httpResponse.headerIterator(HeaderConstants.WARNING); it.hasNext(); ) { /* * warn-codes * 110 = Response is stale * 111 = Revalidation failed */ final Header warning = it.next(); final String warningValue = warning.getValue(); if (warningValue.startsWith("110") || warningValue.startsWith("111")) { return true; } } return false; }
@Override public final void process(HttpResponse response, HttpContext context) { final TraceeFilterConfiguration filterConfiguration = backend.getConfiguration(profile); final Iterator<Header> headerIterator = response.headerIterator(TraceeConstants.TPIC_HEADER); if (headerIterator != null && headerIterator.hasNext() && filterConfiguration.shouldProcessContext(IncomingResponse)) { final List<String> stringTraceeHeaders = new ArrayList<>(); while (headerIterator.hasNext()) { stringTraceeHeaders.add(headerIterator.next().getValue()); } backend.putAll(filterConfiguration.filterDeniedParams(transportSerialization.parse(stringTraceeHeaders), IncomingResponse)); } } }
@Override public List<Header> convert(final HttpResponse message) throws HttpException { final int code = message.getCode(); if (code < 100 || code >= 600) { throw new ProtocolException("Response status %s is invalid", code); } final List<Header> headers = new ArrayList<>(); headers.add(new BasicHeader(H2PseudoResponseHeaders.STATUS, Integer.toString(code), false)); for (final Iterator<Header> it = message.headerIterator(); it.hasNext(); ) { final Header header = it.next(); final String name = header.getName(); final String value = header.getValue(); if (name.startsWith(":")) { throw new ProtocolException("Header name '%s' is invalid", name); } if (name.equalsIgnoreCase(HttpHeaders.CONNECTION)) { throw new ProtocolException("Header '%s: %s' is illegal for HTTP/2 messages", name, value); } headers.add(new BasicHeader(name.toLowerCase(Locale.ROOT), value)); } return headers; }
public static SimpleHttpResponse copy(final HttpResponse original) { Args.notNull(original, "HTTP response"); final SimpleHttpResponse copy = new SimpleHttpResponse(original.getCode()); copy.setVersion(original.getVersion()); for (final Iterator<Header> it = original.headerIterator(); it.hasNext(); ) { copy.addHeader(it.next()); } return copy; }
headerGroup.setHeaders(entry.getHeaders()); for (final Iterator<Header> it = response.headerIterator(); it.hasNext(); ) { final Header responseHeader = it.next(); for (final Iterator<Header> it = response.headerIterator(); it.hasNext(); ) { final Header responseHeader = it.next();
@Override public void process(final HttpResponse response, final EntityDetails entity, final HttpContext context) throws HttpException, IOException { Args.notNull(response, "HTTP request"); Args.notNull(context, "HTTP context"); final HttpClientContext clientContext = HttpClientContext.adapt(context); // Obtain actual CookieSpec instance final CookieSpec cookieSpec = clientContext.getCookieSpec(); if (cookieSpec == null) { this.log.debug("Cookie spec not specified in HTTP context"); return; } // Obtain cookie store final CookieStore cookieStore = clientContext.getCookieStore(); if (cookieStore == null) { this.log.debug("Cookie store not specified in HTTP context"); return; } // Obtain actual CookieOrigin instance final CookieOrigin cookieOrigin = clientContext.getCookieOrigin(); if (cookieOrigin == null) { this.log.debug("Cookie origin not specified in HTTP context"); return; } final Iterator<Header> it = response.headerIterator("Set-Cookie"); processCookies(it, cookieSpec, cookieOrigin, cookieStore); }
Iterator<Header> headerIterator = response.headerIterator(HttpHeaders.CONNECTION); if (!headerIterator.hasNext()) { headerIterator = response.headerIterator("Proxy-Connection");
Iterator<Header> headerIterator = response.headerIterator(HttpHeaders.CONNECTION); if (!headerIterator.hasNext()) { headerIterator = response.headerIterator("Proxy-Connection");