本文整理了Java中org.apache.http.client.methods.CloseableHttpResponse.addHeader()
方法的一些代码示例,展示了CloseableHttpResponse.addHeader()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。CloseableHttpResponse.addHeader()
方法的具体详情如下:
包路径:org.apache.http.client.methods.CloseableHttpResponse
类名称:CloseableHttpResponse
方法名:addHeader
暂无
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.clients
@Override
public void addHeader(Header header) {
httpResponse.addHeader(header);
}
代码示例来源:origin: org.apache.sling/org.apache.sling.testing.clients
@Override
public void addHeader(String name, String value) {
httpResponse.addHeader(name, value);
}
代码示例来源:origin: org.esigate/esigate-core
@Override
public boolean event(EventDefinition id, Event event) {
FragmentEvent e = (FragmentEvent) event;
e.getHttpResponse().addHeader("X-Powered-By", "Esigate");
// Continue processing
return true;
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient
private CloseableHttpResponse unvalidatedCacheHit(
final HttpContext context, final HttpCacheEntry entry) {
final CloseableHttpResponse cachedResponse = responseGenerator.generateResponse(entry);
setResponseStatus(context, CacheResponseStatus.CACHE_HIT);
cachedResponse.addHeader(HeaderConstants.WARNING, "111 localhost \"Revalidation failed\"");
return cachedResponse;
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient
CloseableHttpResponse callBackend(
final HttpRoute route,
final HttpRequestWrapper request,
final HttpClientContext context,
final HttpExecutionAware execAware) throws IOException, HttpException {
final Date requestDate = getCurrentDate();
log.trace("Calling the backend");
final CloseableHttpResponse backendResponse = backend.execute(route, request, context, execAware);
try {
backendResponse.addHeader("Via", generateViaHeader(backendResponse));
return handleBackendResponse(route, request, context, execAware,
requestDate, getCurrentDate(), backendResponse);
} catch (final IOException ex) {
backendResponse.close();
throw ex;
} catch (final RuntimeException ex) {
backendResponse.close();
throw ex;
}
}
代码示例来源:origin: org.esigate/esigate-core
e.getHttpResponse().addHeader(H_SURROGATE_CONTROL, sb.toString());
e.getHttpResponse().addHeader("Vary", H_SURROGATE_CAPABILITIES);
代码示例来源:origin: org.esigate/esigate-core
response.addHeader("Cache-control", cacheControlHeader);
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient
private CloseableHttpResponse generateCachedResponse(final HttpRequestWrapper request,
final HttpContext context, final HttpCacheEntry entry, final Date now) {
final CloseableHttpResponse cachedResponse;
if (request.containsHeader(HeaderConstants.IF_NONE_MATCH)
|| request.containsHeader(HeaderConstants.IF_MODIFIED_SINCE)) {
cachedResponse = responseGenerator.generateNotModifiedResponse(entry);
} else {
cachedResponse = responseGenerator.generateResponse(entry);
}
setResponseStatus(context, CacheResponseStatus.CACHE_HIT);
if (validityPolicy.getStalenessSecs(entry, now) > 0L) {
cachedResponse.addHeader(HeaderConstants.WARNING,"110 localhost \"Response is stale\"");
}
return cachedResponse;
}
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient
final Date responseDate = getCurrentDate();
backendResponse.addHeader("Via", generateViaHeader(backendResponse));
代码示例来源:origin: at.bestsolution.efxclipse.eclipse/org.apache.httpcomponents.httpclient
backendResponse.addHeader(HeaderConstants.VIA, generateViaHeader(backendResponse));
try {
final CloseableHttpResponse cachedResponse = responseGenerator.generateResponse(cacheEntry);
cachedResponse.addHeader(HeaderConstants.WARNING, "110 localhost \"Response is stale\"");
return cachedResponse;
} finally {
代码示例来源:origin: org.esigate/esigate-core
" (" + request.getRequestLine().getMethod() + " " + request.getRequestLine().getUri()
+ ")";
response.addHeader("X-Cache", xCacheString);
内容来源于网络,如有侵权,请联系作者删除!