本文整理了Java中org.eclipse.jetty.client.api.Response.getHeaders
方法的一些代码示例,展示了Response.getHeaders
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Response.getHeaders
方法的具体详情如下:
包路径:org.eclipse.jetty.client.api.Response
类名称:Response
方法名:getHeaders
暂无
代码示例来源:origin: spring-projects/spring-framework
@Override
public void onHeaders(Response response) {
if (logger.isTraceEnabled()) {
// Convert to HttpHeaders to avoid "\n"
logger.trace("XHR receive headers: " + toHttpHeaders(response.getHeaders()));
}
}
代码示例来源:origin: konsoletyper/teavm
void send(Response response) {
if (sent) {
return;
}
sent = true;
resp.setStatus(response.getStatus());
for (HttpField field : response.getHeaders()) {
if (field.getName().toLowerCase().equals("location")) {
String value = field.getValue();
if (value.startsWith(proxyUrl)) {
String relLocation = value.substring(proxyUrl.length());
resp.addHeader(field.getName(), "http://localhost:" + port + proxyPath + relLocation);
continue;
}
}
resp.addHeader(field.getName(), field.getValue());
}
}
}
代码示例来源:origin: jersey/jersey
private static ClientResponse translateResponse(final ClientRequest jerseyRequest,
final org.eclipse.jetty.client.api.Response jettyResponse,
final NonBlockingInputStream entityStream) {
final ClientResponse jerseyResponse = new ClientResponse(Statuses.from(jettyResponse.getStatus()), jerseyRequest);
processResponseHeaders(jettyResponse.getHeaders(), jerseyResponse);
jerseyResponse.setEntityStream(entityStream);
return jerseyResponse;
}
代码示例来源:origin: resteasy/Resteasy
@Override
public void onHeaders(Response response) {
cr = new JettyClientResponse(invocation.getClientConfiguration(), stream, () -> {
if (!completing.get()) {
future.cancel(true);
}
});
cr.setProperties(invocation.getMutableProperties());
cr.setStatus(response.getStatus());
cr.setHeaders(extract(response.getHeaders()));
if (!buffered) {
complete();
}
}
代码示例来源:origin: com.ovea.tajin.server/tajin-server-jetty9
@Override
public HttpFields getHeaders()
{
return response.getHeaders();
}
代码示例来源:origin: org.eclipse.jetty/jetty-reactive-httpclient
/**
* @return the HTTP response headers
*/
public HttpFields getHeaders() {
return response.getHeaders();
}
代码示例来源:origin: org.eclipse.jetty/jetty-client
@Override
public HttpFields getHeaders()
{
return response.getHeaders();
}
代码示例来源:origin: org.springframework/spring-websocket
@Override
public void onHeaders(Response response) {
if (logger.isTraceEnabled()) {
// Convert to HttpHeaders to avoid "\n"
logger.trace("XHR receive headers: " + toHttpHeaders(response.getHeaders()));
}
}
代码示例来源:origin: blazegraph/database
/** The http headers. */
public HttpFields getHeaders() throws IOException {
ensureResponse();
return m_response.getHeaders();
}
代码示例来源:origin: com.playtika.reactivefeign/feign-reactor-jetty
@Override
public Map<String, List<String>> headers() {
return clientResponse.getHeaders().stream()
.collect(Collectors.toMap(HttpField::getName, field -> asList(field.getValues())));
}
代码示例来源:origin: blazegraph/database
/**
* Return the value of the <code>Content-Type</code> header.
* @return
* @throws IOException
*/
public String getContentType() throws IOException {
ensureResponse();
final HttpFields headers = m_response.getHeaders();
return headers.get(HttpHeader.CONTENT_TYPE);
}
代码示例来源:origin: airlift/airlift
public JettyResponse(Response response, InputStream inputStream)
{
this.response = response;
this.inputStream = new CountingInputStream(inputStream);
this.headers = toHeadersMap(response.getHeaders());
}
代码示例来源:origin: com.betfair.cougar/baseline-security
@Override
public List<IdentityToken> resolve(Response input, X509Certificate[] certificateChain) {
List<IdentityToken> credentials = new ArrayList<IdentityToken>();
for (SimpleIdentityTokenName securityToken : SimpleIdentityTokenName.values()) {
String authHeaderValue = input.getHeaders().getStringField(TOKEN_PREFIX + securityToken.name());
if (authHeaderValue != null) {
credentials.add(new IdentityToken(securityToken.name(), authHeaderValue));
}
}
return credentials;
}
代码示例来源:origin: org.eclipse.jetty/jetty-proxy
@Override
public void onHeaders(Response serverResponse)
{
contentLength = serverResponse.getHeaders().getLongField(HttpHeader.CONTENT_LENGTH.asString());
onServerResponseHeaders(clientRequest, proxyResponse, serverResponse);
}
代码示例来源:origin: airlift/airlift
@Override
public synchronized void onHeaders(Response response)
{
long length = response.getHeaders().getLongField(HttpHeader.CONTENT_LENGTH.asString());
if (length > maxLength) {
response.abort(new ResponseTooLargeException());
}
}
代码示例来源:origin: com.proofpoint.platform/http-client
@Override
public synchronized void onHeaders(Response response)
{
long length = response.getHeaders().getLongField(HttpHeader.CONTENT_LENGTH.asString());
if (length > maxLength) {
response.abort(new ResponseTooLargeException());
}
}
代码示例来源:origin: isucon/isucon5-final
public boolean isContentLength(long bytes) {
String value = response.getHeaders().get("Content-Length");
if (value == null) {
addViolation(String.format("リクエストパス %s に対して Content-Length がありませんでした", response.getRequest().getPath()));
return wrap(false);
} else if (Long.parseLong(value) == bytes) {
return wrap(true);
} else {
addViolation(String.format("パス %s に対するレスポンスのサイズが正しくありません: %s bytes", response.getRequest().getPath(), value));
return wrap(false);
}
}
代码示例来源:origin: org.glassfish.jersey.connectors/jersey-jetty-connector
private static ClientResponse translateResponse(final ClientRequest jerseyRequest,
final org.eclipse.jetty.client.api.Response jettyResponse,
final NonBlockingInputStream entityStream) {
final ClientResponse jerseyResponse = new ClientResponse(Statuses.from(jettyResponse.getStatus()), jerseyRequest);
processResponseHeaders(jettyResponse.getHeaders(), jerseyResponse);
jerseyResponse.setEntityStream(entityStream);
return jerseyResponse;
}
代码示例来源:origin: com.cisco.oss.foundation/http-client-jetty
@Override
public Map<String, Collection<String>> getHeaders() {
ImmutableListMultimap.Builder<String, String> builder = ImmutableListMultimap.builder();
HttpFields headers = httpResponse.getHeaders();
for (HttpField header : headers) {
builder.put(header.getName(), header.getValue());
}
return builder.build().asMap();
}
代码示例来源:origin: org.eclipse.jetty.spdy/spdy-http-server
private Fields createResponseHeaders(Stream clientStream, Response response)
{
Fields responseHeaders = new Fields();
for (HttpField header : response.getHeaders())
responseHeaders.add(header.getName(), header.getValue());
short version = clientStream.getSession().getVersion();
if (response.getStatus() > 0)
responseHeaders.add(HTTPSPDYHeader.STATUS.name(version),
String.valueOf(response.getStatus()));
responseHeaders.add(HTTPSPDYHeader.VERSION.name(version), HttpVersion.HTTP_1_1.asString());
addResponseProxyHeaders(clientStream, responseHeaders);
return responseHeaders;
}
内容来源于网络,如有侵权,请联系作者删除!