public T setHeaders(FluentCaseInsensitiveStringsMap headers) { request.headers = (headers == null ? new FluentCaseInsensitiveStringsMap() : new FluentCaseInsensitiveStringsMap(headers)); return derived.cast(this); }
public T setHeaders(Map<String, Collection<String>> headers) { request.headers = (headers == null ? new FluentCaseInsensitiveStringsMap() : new FluentCaseInsensitiveStringsMap(headers)); return derived.cast(this); }
private FluentCaseInsensitiveStringsMap computerHeaders(HttpURLConnection urlConnection) { FluentCaseInsensitiveStringsMap h = new FluentCaseInsensitiveStringsMap(); Map<String, List<String>> uh = urlConnection.getHeaderFields(); for (Map.Entry<String, List<String>> e : uh.entrySet()) { if (e.getKey() != null) { h.add(e.getKey(), e.getValue()); } } return h; }
@Override public final FluentCaseInsensitiveStringsMap getHeaders() { return headers != null ? headers.getHeaders() : new FluentCaseInsensitiveStringsMap(); }
private FluentCaseInsensitiveStringsMap computerHeaders() { FluentCaseInsensitiveStringsMap h = new FluentCaseInsensitiveStringsMap(); for (Map.Entry<String, String> header : responseHeaders) { h.add(header.getKey(), header.getValue()); } if (trailingHeaders != null) { for (Map.Entry<String, String> header : trailingHeaders) { h.add(header.getKey(), header.getValue()); } } return h; }
private void configureTransferAdapter(AsyncHandler<?> handler, HttpRequest httpRequest) { FluentCaseInsensitiveStringsMap h = new FluentCaseInsensitiveStringsMap(); for (Map.Entry<String, String> entries : httpRequest.headers()) { h.add(entries.getKey(), entries.getValue()); } TransferCompletionHandler.class.cast(handler).headers(h); }
= new FluentCaseInsensitiveStringsMap(request.getHeaders()); TransferCompletionHandler.class.cast(h).headers(map);
public T setHeaders(Map<String, Collection<String>> headers) { request.headers = (headers == null ? new FluentCaseInsensitiveStringsMap() : new FluentCaseInsensitiveStringsMap(headers)); return derived.cast(this); }
/** * Defines the request headers. */ @Override public WSRequest setHeaders(Map<String, Collection<String>> hdrs) { headers = (headers == null ? new FluentCaseInsensitiveStringsMap() : new FluentCaseInsensitiveStringsMap(headers)); return super.setHeaders(hdrs); }
public RequestImpl(Request prototype) { if (prototype != null) { this.method = prototype.getMethod(); this.uri = prototype.getUri(); this.address = prototype.getInetAddress(); this.localAddress = prototype.getLocalAddress(); this.headers = new FluentCaseInsensitiveStringsMap(prototype.getHeaders()); this.cookies = new ArrayList<>(prototype.getCookies()); this.byteData = prototype.getByteData(); this.compositeByteData = prototype.getCompositeByteData(); this.stringData = prototype.getStringData(); this.streamData = prototype.getStreamData(); this.bodyGenerator = prototype.getBodyGenerator(); this.formParams = prototype.getFormParams() == null ? null : new ArrayList<>(prototype.getFormParams()); this.parts = prototype.getParts() == null ? null : new ArrayList<>(prototype.getParts()); this.virtualHost = prototype.getVirtualHost(); this.length = prototype.getContentLength(); this.proxyServer = prototype.getProxyServer(); this.realm = prototype.getRealm(); this.file = prototype.getFile(); this.followRedirects = prototype.getFollowRedirect(); this.requestTimeout = prototype.getRequestTimeout(); this.rangeOffset = prototype.getRangeOffset(); this.charset = prototype.getBodyEncoding(); this.connectionPoolPartitioning = prototype.getConnectionPoolPartitioning(); this.nameResolver = prototype.getNameResolver(); } }
/** * Defines the request headers. */ @Override public WSRequest setHeaders(FluentCaseInsensitiveStringsMap hdrs) { headers = (headers == null ? new FluentCaseInsensitiveStringsMap() : headers); return super.setHeaders(hdrs); }
private FluentCaseInsensitiveStringsMap computerHeaders(HttpURLConnection urlConnection) { FluentCaseInsensitiveStringsMap h = new FluentCaseInsensitiveStringsMap(); Map<String, List<String>> uh = urlConnection.getHeaderFields(); for (Map.Entry<String, List<String>> e : uh.entrySet()) { if (e.getKey() != null) { h.add(e.getKey(), e.getValue()); } } return h; }
public XmlRpcAhcTransport( XmlRpcAhcTransportFactory xmlRpcAhcTransportFactory ) { super( xmlRpcAhcTransportFactory.getClient(), userAgent ); headers = new FluentCaseInsensitiveStringsMap(); }
@Override public final FluentCaseInsensitiveStringsMap getHeaders() { return headers != null ? headers.getHeaders() : new FluentCaseInsensitiveStringsMap(); }
private FluentCaseInsensitiveStringsMap computerHeaders() { FluentCaseInsensitiveStringsMap h = new FluentCaseInsensitiveStringsMap(); for (Map.Entry<String, String> header : responseHeaders) { h.add(header.getKey(), header.getValue()); } if (trailingHeaders != null) { for (Map.Entry<String, String> header : trailingHeaders) { h.add(header.getKey(), header.getValue()); } } return h; }
private void configureTransferAdapter(AsyncHandler<?> handler, HttpRequest httpRequest) { FluentCaseInsensitiveStringsMap h = new FluentCaseInsensitiveStringsMap(); for (Map.Entry<String, String> entries : httpRequest.headers()) { h.add(entries.getKey(), entries.getValue()); } TransferCompletionHandler.class.cast(handler).headers(h); }
@Test public void mapConstructorNullTest() { FluentCaseInsensitiveStringsMap map = new FluentCaseInsensitiveStringsMap((Map<String, Collection<String>>) null); assertEquals(map.keySet().size(), 0); }
@Test public void copyConstructorNullTest() { FluentCaseInsensitiveStringsMap map = new FluentCaseInsensitiveStringsMap((FluentCaseInsensitiveStringsMap) null); assertEquals(map.keySet().size(), 0); }
@Test public void emptyValueTest() { FluentCaseInsensitiveStringsMap map = new FluentCaseInsensitiveStringsMap(); map.add("foo", ""); assertEquals(map.keySet(), new LinkedHashSet<>(Arrays.asList("foo"))); assertEquals(map.getFirstValue("foo"), ""); assertEquals(map.getJoinedValue("foo", ", "), ""); assertEquals(map.get("foo"), Arrays.asList("")); }
@Test public void nullValueTest() { FluentCaseInsensitiveStringsMap map = new FluentCaseInsensitiveStringsMap(); map.add("foo", (String) null); assertEquals(map.getFirstValue("foo"), ""); assertEquals(map.getJoinedValue("foo", ", "), ""); assertEquals(map.get("foo").size(), 1); }