/** * Add new cache control entry to the message headers. * * @param cacheControl cache control entry to be added. */ public void cacheControl(final CacheControl cacheControl) { getHeaders().add(HttpHeaders.CACHE_CONTROL, cacheControl); }
/** * Add new cookie to the message headers. * * @param cookie cookie to be added. */ public void cookie(final Cookie cookie) { getHeaders().add(HttpHeaders.COOKIE, cookie); }
/** * Add new cache control entry to the message headers. * * @param cacheControl cache control entry to be added. */ public void cacheControl(final CacheControl cacheControl) { getHeaders().add(HttpHeaders.CACHE_CONTROL, cacheControl); }
/** * Set message encoding. * * @param encoding message encoding to be set. */ public void encoding(final String encoding) { if (encoding == null) { getHeaders().remove(HttpHeaders.CONTENT_ENCODING); } else { getHeaders().putSingle(HttpHeaders.CONTENT_ENCODING, encoding); } }
/** * Set message language. * * @param language message language to be set. */ public void language(final String language) { if (language == null) { getHeaders().remove(HttpHeaders.CONTENT_LANGUAGE); } else { getHeaders().putSingle(HttpHeaders.CONTENT_LANGUAGE, language); } }
/** * Set message language. * * @param language message language to be set. */ public void language(final Locale language) { if (language == null) { getHeaders().remove(HttpHeaders.CONTENT_LANGUAGE); } else { getHeaders().putSingle(HttpHeaders.CONTENT_LANGUAGE, language); } }
/** * Set message encoding. * * @param encoding message encoding to be set. */ public void encoding(final String encoding) { if (encoding == null) { getHeaders().remove(HttpHeaders.CONTENT_ENCODING); } else { getHeaders().putSingle(HttpHeaders.CONTENT_ENCODING, encoding); } }
@Override public void onHeaders(final Response jettyResponse) { HeaderUtils.checkHeaderChanges(clientHeadersSnapshot, jerseyRequest.getHeaders(), JettyConnector.this.getClass().getName()); if (responseFuture.isDone()) { if (!callbackInvoked.compareAndSet(false, true)) { return; } } final ClientResponse response = translateResponse(jerseyRequest, jettyResponse, entityStream); jerseyResponse.set(response); }
@Override public STATE onHeadersReceived(HttpResponseHeaders headers) throws Exception { if (!futureSet.compareAndSet(false, true)) { return STATE.ABORT; } HeaderUtils.checkHeaderChanges(clientHeadersSnapshot, request.getHeaders(), GrizzlyConnector.this.getClass().getName()); responseFuture.complete(translate(request, this.status, headers, entityStream)); return STATE.CONTINUE; }
/** * Add new accepted types to the message headers. * * @param types accepted types to be added. */ public void accept(final MediaType... types) { getHeaders().addAll(HttpHeaders.ACCEPT, (Object[]) types); }
/** * Add new accepted types to the message headers. * * @param types accepted types to be added. */ public void accept(final String... types) { getHeaders().addAll(HttpHeaders.ACCEPT, (Object[]) types); }
@Override public Invocation.Builder acceptEncoding(final String... encodings) { requestContext.getHeaders().addAll(HttpHeaders.ACCEPT_ENCODING, (Object[]) encodings); return this; }
@Override public Invocation.Builder acceptEncoding(final String... encodings) { requestContext.getHeaders().addAll(HttpHeaders.ACCEPT_ENCODING, (Object[]) encodings); return this; }
/** * Add new accepted languages to the message headers. * * @param locales accepted languages to be added. */ public void acceptLanguage(final Locale... locales) { getHeaders().addAll(HttpHeaders.ACCEPT_LANGUAGE, (Object[]) locales); }
/** * Add new accepted languages to the message headers. * * @param locales accepted languages to be added. */ public void acceptLanguage(final String... locales) { getHeaders().addAll(HttpHeaders.ACCEPT_LANGUAGE, (Object[]) locales); }
/** * Add new accepted types to the message headers. * * @param types accepted types to be added. */ public void accept(final String... types) { getHeaders().addAll(HttpHeaders.ACCEPT, (Object[]) types); }
/** * Add new accepted types to the message headers. * * @param types accepted types to be added. */ public void accept(final MediaType... types) { getHeaders().addAll(HttpHeaders.ACCEPT, (Object[]) types); }
/** * Add new accepted languages to the message headers. * * @param locales accepted languages to be added. */ public void acceptLanguage(final String... locales) { getHeaders().addAll(HttpHeaders.ACCEPT_LANGUAGE, (Object[]) locales); }
@Override public OutputStream getOutputStream(int contentLength) throws IOException { final MultivaluedMap<String, Object> clientHeaders = clientRequest.getHeaders(); if (contentLength != -1 && !clientHeaders.containsKey(HttpHeaders.CONTENT_LENGTH)) { containerRequest.getHeaders().putSingle(HttpHeaders.CONTENT_LENGTH, String.valueOf(contentLength)); } return clientOutput; } });
private ClientResponse _apply(final ClientRequest request) { checkNotClosed(); final ClientResponse response = new ClientResponse(LOOPBACK_STATUS, request); // Headers. response.headers(HeaderUtils.asStringHeaders(request.getHeaders())); // Entity. if (request.hasEntity()) { response.setEntityStream(new ByteArrayInputStream(bufferEntity(request))); } return response; }