@Test public void testTokensFormattingSameName() throws Exception { final Header header = MessageSupport.format(HttpHeaders.TRAILER, "a", "a", "a"); Assert.assertNotNull(header); Assert.assertEquals("a, a, a", header.getValue()); }
public static Header format(final String name, final Set<String> tokens) { Args.notBlank(name, "Header name"); if (tokens == null || tokens.isEmpty()) { return null; } final CharArrayBuffer buffer = new CharArrayBuffer(256); buffer.append(name); buffer.append(": "); formatTokens(buffer, tokens); return BufferedHeader.create(buffer); }
MessageSupport { public static Header format(final String name, final Set<String> tokens) { Args.notBlank(name, "Header name"); if (tokens == null || tokens.isEmpty()) { return null; } final CharArrayBuffer buffer = new CharArrayBuffer(256); buffer.append(name); buffer.append(": "); formatTokens(buffer, tokens); return BufferedHeader.create(buffer); } }
MessageSupport { public static Header format(final String name, final Set<String> tokens) { Args.notBlank(name, "Header name"); if (tokens == null || tokens.isEmpty()) { return null; } final CharArrayBuffer buffer = new CharArrayBuffer(256); buffer.append(name); buffer.append(": "); formatTokens(buffer, tokens); return BufferedHeader.create(buffer); } private  MessageSupport(); }
MessageSupport { public static Header format(final String name, final Set<String> tokens) { Args.notBlank(name, "Header name"); if (tokens == null || tokens.isEmpty()) { return null; } final CharArrayBuffer buffer = new CharArrayBuffer(256); buffer.append(name); buffer.append(": "); formatTokens(buffer, tokens); return BufferedHeader.create(buffer); } private  MessageSupport(); static void formatTokens(final CharArrayBuffer dst, final String... tokens); static void formatTokens(final CharArrayBuffer dst, final Set<String> tokens); static Header format(final String name, final Set<String> tokens); static Header format(final String name, final String... tokens); static Set<String> parseTokens(final CharSequence src, final ParserCursor cursor); static Set<String> parseTokens(final Header header); static void addContentTypeHeader(final HttpMessage message, final EntityDetails entity); static void addContentEncodingHeader(final HttpMessage message, final EntityDetails entity); static void addTrailerHeader(final HttpMessage message, final EntityDetails entity); static Iterator<HeaderElement> iterate(final MessageHeaders headers, final String name); static HeaderElement[] parse(final Header header); static boolean canResponseHaveBody(final String method, final HttpResponse response); }
MessageSupport { public static Header format(final String name, final Set<String> tokens) { Args.notBlank(name, "Header name"); if (tokens == null || tokens.isEmpty()) { return null; } final CharArrayBuffer buffer = new CharArrayBuffer(256); buffer.append(name); buffer.append(": "); formatTokens(buffer, tokens); return BufferedHeader.create(buffer); } private  MessageSupport(); static void formatTokens(final CharArrayBuffer dst, final String... tokens); static void formatTokens(final CharArrayBuffer dst, final Set<String> tokens); static Header format(final String name, final Set<String> tokens); static Header format(final String name, final String... tokens); static Set<String> parseTokens(final CharSequence src, final ParserCursor cursor); static Set<String> parseTokens(final Header header); static void addContentTypeHeader(final HttpMessage message, final EntityDetails entity); static void addContentEncodingHeader(final HttpMessage message, final EntityDetails entity); static void addTrailerHeader(final HttpMessage message, final EntityDetails entity); static Iterator<HeaderElement> iterate(final MessageHeaders headers, final String name); static HeaderElement[] parse(final Header header); static boolean canResponseHaveBody(final String method, final HttpResponse response);  }