builder.headers(newHeaders);
builder.headers(newHeaders);
.headers(headers) // this resets all headers so do this first
public Builder headers(MultivaluedMap<String, Object> headers) { return getOrCreateDelegate(delegate.headers(headers)); }
public Response publishAvro(String qualifiedTopicName, byte[] message, Map<String, String> headers) { return webTarget.path(qualifiedTopicName).request().headers(new MultivaluedHashMap<>(headers)).post(Entity.entity(message, "avro/binary")); }
@Override public CompletableBuilder headers(MultivaluedMap<String, Object> headers) { return new CompletableBuilder(builder.headers(headers)); }
@Override public void sendNotification(Notification notification) throws NotificationException { Response response = target.request() .headers(headers) .method(method, Entity.entity(notification, "application/json")); response.close(); if (response.getStatusInfo().getFamily() != SUCCESSFUL) { throw new NotificationException("Failed to send HTTP notification: status=" + response.getStatusInfo()); } } }
public Response publishAvro(String qualifiedTopicName, byte[] message, Map<String, String> headers) { return webTarget.path(qualifiedTopicName).request().headers(new MultivaluedHashMap<>(headers)).post(Entity.entity(message, "avro/binary")); }
@Override public RxBuilder headers(MultivaluedMap<String, Object> headers) { return new RxBuilder(builder.headers(headers)); }
public Response publish(String qualifiedTopicName, String message, Map<String, String> headers) { String contentType = headers.getOrDefault("Content-Type", MediaType.TEXT_PLAIN); return webTarget.path(qualifiedTopicName).request().headers(new MultivaluedHashMap<>(headers)).post(Entity.entity(message, contentType)); }
@Override public ForwardingInvocationBuilder headers(MultivaluedMap<String, Object> headers) { delegate().headers(headers); return this; }
public Response post(String path, Serializable body) { Entity<Serializable> msgEntity = Entity.entity(body, MediaType.APPLICATION_JSON); final Builder invocationBuilder = httpConnectorSpec.target .path(path) .request(MediaType.APPLICATION_JSON) .headers(httpConnectorSpec.headers); try(Response response = invocationBuilder.post(msgEntity)) { return response; } }
public Response post(IHttpPayload httpMsg) throws MalformedURLException { Entity<Serializable> msgEntity = Entity.entity(httpMsg.getBody(), MediaType.APPLICATION_JSON); final Builder invocationBuilder = httpConnectorSpec.target .path(httpMsg.getPath()) .request(MediaType.APPLICATION_JSON) .headers(httpConnectorSpec.headers); try(Response response = invocationBuilder.post(msgEntity)) { return response; } }
public Response get(String path) throws MalformedURLException { final Builder invocationBuilder = httpConnectorSpec.target .path(path) .request(MediaType.APPLICATION_JSON) .headers(httpConnectorSpec.headers); try(Response response = invocationBuilder.get()) { return response; } }
@Override protected Invocation.Builder addAuthHeaders(Invocation.Builder request) { MultivaluedMap<String, Object> map = new MultivaluedHashMap<>(); map.addAll(HttpHeaders.AUTHORIZATION, TestUtils.basicAuthToken("user1", "1111_aaaa")); return request.headers(map); }
public Response publish(String qualifiedTopicName, String message, Map<String, String> headers) { String contentType = headers.getOrDefault("Content-Type", MediaType.TEXT_PLAIN); return webTarget.path(qualifiedTopicName).request().headers(new MultivaluedHashMap<>(headers)).post(Entity.entity(message, contentType)); }
@Override protected Invocation.Builder addAuthHeaders(Invocation.Builder request) { MultivaluedMap<String, Object> map = new MultivaluedHashMap<>(); map.addAll(HttpHeaders.AUTHORIZATION, TestAuthHandler.testAuthToken(TestAuthHandler.DUMMY_USER)); return request.headers(map); } }
@Override protected Invocation.Builder addAuthHeaders(Invocation.Builder request) { MultivaluedMap<String, Object> map = new MultivaluedHashMap<>(); map.addAll(HttpHeaders.AUTHORIZATION, TestUtils.basicAuthToken("admin", "1111_aaaa")); return request.headers(map); } }
public CompletionStage<Response> forward() { WebTarget target = client.path(uriInfo.getPath()); for (final Map.Entry<String, List<String>> query : uriInfo.getQueryParameters().entrySet()) { target = target.queryParam(query.getKey(), query.getValue().toArray(emptyObjectsArray)); } final MultivaluedMap<String, String> requestHeaders = headers.getRequestHeaders(); final MediaType[] types = headers.getAcceptableMediaTypes().toArray(emptyMediaTypesArray); final CompletionStageRxInvoker invoker = target.request(types).headers(MultivaluedMap.class.cast(requestHeaders)).rx(); return decorate(invoker.method(request.getMethod())); } }
builder.headers(newHeaders);