001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.http;
018
019import static org.apache.juneau.internal.ClassUtils.*;
020
021import java.net.*;
022import java.time.*;
023import java.util.*;
024import java.util.function.*;
025
026import org.apache.http.*;
027import org.apache.juneau.*;
028import org.apache.juneau.common.utils.*;
029import org.apache.juneau.http.header.*;
030import org.apache.juneau.http.header.Date;
031import org.apache.juneau.http.part.*;
032import org.apache.juneau.httppart.*;
033import org.apache.juneau.oapi.*;
034import org.apache.juneau.reflect.*;
035
036/**
037 * Standard predefined HTTP headers.
038 *
039 * <h5 class='section'>See Also:</h5><ul>
040 *    <li class='link'><a class="doclink" href="https://juneau.apache.org/docs/topics/JuneauRestCommonBasics">juneau-rest-common Basics</a>
041 * </ul>
042 */
043public class HttpHeaders {
044
045   @SuppressWarnings("javadoc")
046   public static final Accept
047      ACCEPT_APPLICATION_ATOM_XML = Accept.APPLICATION_ATOM_XML,
048      ACCEPT_APPLICATION_FORM_URLENCODED = Accept.APPLICATION_FORM_URLENCODED,
049      ACCEPT_APPLICATION_JSON = Accept.APPLICATION_JSON,
050      ACCEPT_APPLICATION_OCTET_STREAM = Accept.APPLICATION_OCTET_STREAM,
051      ACCEPT_APPLICATION_SOAP_XML = Accept.APPLICATION_SOAP_XML,
052      ACCEPT_APPLICATION_SVG_XML = Accept.APPLICATION_SVG_XML,
053      ACCEPT_APPLICATION_XHTML_XML = Accept.APPLICATION_XHTML_XML,
054      ACCEPT_APPLICATION_XML = Accept.APPLICATION_XML,
055      ACCEPT_IMAGE_BMP = Accept.IMAGE_BMP,
056      ACCEPT_IMAGE_GIF = Accept.IMAGE_GIF,
057      ACCEPT_IMAGE_JPEG = Accept.IMAGE_JPEG,
058      ACCEPT_IMAGE_PNG = Accept.IMAGE_PNG,
059      ACCEPT_IMAGE_SVG = Accept.IMAGE_SVG,
060      ACCEPT_IMAGE_TIFF = Accept.IMAGE_TIFF,
061      ACCEPT_IMAGE_WEBP = Accept.IMAGE_WEBP,
062      ACCEPT_MULTIPART_FORM_DATA = Accept.MULTIPART_FORM_DATA,
063      ACCEPT_TEXT_HTML = Accept.TEXT_HTML,
064      ACCEPT_TEXT_PLAIN = Accept.TEXT_PLAIN,
065      ACCEPT_TEXT_XML = Accept.TEXT_XML,
066      ACCEPT_WILDCARD = Accept.WILDCARD;
067
068   @SuppressWarnings("javadoc")
069   public static final ContentType
070      CONTENTTYPE_APPLICATION_ATOM_XML = ContentType.APPLICATION_ATOM_XML,
071      CONTENTTYPE_APPLICATION_FORM_URLENCODED = ContentType.APPLICATION_FORM_URLENCODED,
072      CONTENTTYPE_APPLICATION_JSON = ContentType.APPLICATION_JSON,
073      CONTENTTYPE_APPLICATION_OCTET_STREAM = ContentType.APPLICATION_OCTET_STREAM,
074      CONTENTTYPE_APPLICATION_SOAP_XML = ContentType.APPLICATION_SOAP_XML,
075      CONTENTTYPE_APPLICATION_SVG_XML = ContentType.APPLICATION_SVG_XML,
076      CONTENTTYPE_APPLICATION_XHTML_XML = ContentType.APPLICATION_XHTML_XML,
077      CONTENTTYPE_APPLICATION_XML = ContentType.APPLICATION_XML,
078      CONTENTTYPE_IMAGE_BMP = ContentType.IMAGE_BMP,
079      CONTENTTYPE_IMAGE_GIF = ContentType.IMAGE_GIF,
080      CONTENTTYPE_IMAGE_JPEG = ContentType.IMAGE_JPEG,
081      CONTENTTYPE_IMAGE_PNG = ContentType.IMAGE_PNG,
082      CONTENTTYPE_IMAGE_SVG = ContentType.IMAGE_SVG,
083      CONTENTTYPE_IMAGE_TIFF = ContentType.IMAGE_TIFF,
084      CONTENTTYPE_IMAGE_WEBP = ContentType.IMAGE_WEBP,
085      CONTENTTYPE_MULTIPART_FORM_DATA = ContentType.MULTIPART_FORM_DATA,
086      CONTENTTYPE_TEXT_HTML = ContentType.TEXT_HTML,
087      CONTENTTYPE_TEXT_PLAIN = ContentType.TEXT_PLAIN,
088      CONTENTTYPE_TEXT_XML = ContentType.TEXT_XML,
089      CONTENTTYPE_WILDCARD = ContentType.WILDCARD;
090
091   //-----------------------------------------------------------------------------------------------------------------
092   // Standard HTTP headers
093   //-----------------------------------------------------------------------------------------------------------------
094
095   /**
096    * Creates a new {@link Accept} header.
097    *
098    * @param value
099    *    The header value.
100    *    <br>Must be parsable by {@link MediaRanges#of(String)}.
101    *    <br>Can be <jk>null</jk>.
102    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
103    */
104   public static final Accept accept(String value) {
105      return Accept.of(value);
106   }
107
108   /**
109    * Creates a new {@link Accept} header.
110    *
111    * @param value
112    *    The header value.
113    *    <br>Can be <jk>null</jk>.
114    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
115    */
116   public static final Accept accept(MediaRanges value) {
117      return Accept.of(value);
118   }
119
120   /**
121    * Creates a new {@link Accept} header.
122    *
123    * @param value
124    *    The header value.
125    *    <br>Can be <jk>null</jk>.
126    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
127    */
128   public static final Accept accept(MediaType value) {
129      return Accept.of(value);
130   }
131
132   /**
133    * Creates a new {@link Accept} header with a delayed value.
134    *
135    * <p>
136    * Header value is re-evaluated on each call to {@link Header#getValue()}.
137    *
138    * @param value
139    *    The header value.
140    *    <br>Can be <jk>null</jk>.
141    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
142    */
143   public static final Accept accept(Supplier<MediaRanges> value) {
144      return Accept.of(value);
145   }
146
147   /**
148    * Creates a new {@link AcceptCharset} header.
149    *
150    * @param value
151    *    The header value.
152    *    <br>Must be parsable by {@link StringRanges#of(String)}.
153    *    <br>Can be <jk>null</jk>.
154    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
155    */
156   public static final AcceptCharset acceptCharset(String value) {
157      return AcceptCharset.of(value);
158   }
159
160   /**
161    * Creates a new {@link AcceptCharset} header.
162    *
163    * @param value
164    *    The header value.
165    *    <br>Can be <jk>null</jk>.
166    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
167    */
168   public static final AcceptCharset acceptCharset(StringRanges value) {
169      return AcceptCharset.of(value);
170   }
171
172   /**
173    * Creates a new {@link AcceptCharset} header with a delayed value.
174    *
175    * <p>
176    * Header value is re-evaluated on each call to {@link Header#getValue()}.
177    *
178    * @param value
179    *    The supplier of the header value.
180    *    <br>Can be <jk>null</jk>.
181    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
182    */
183   public static final AcceptCharset acceptCharset(Supplier<StringRanges> value) {
184      return AcceptCharset.of(value);
185   }
186
187   /**
188    * Creates a new {@link AcceptEncoding} header.
189    *
190    * @param value
191    *    The header value.
192    *    <br>Must be parsable by {@link StringRanges#of(String)}.
193    *    <br>Can be <jk>null</jk>.
194    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
195    */
196   public static final AcceptEncoding acceptEncoding(String value) {
197      return AcceptEncoding.of(value);
198   }
199
200   /**
201    * Creates a new {@link AcceptEncoding} header.
202    *
203    * @param value
204    *    The header value.
205    *    <br>Can be <jk>null</jk>.
206    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
207    */
208   public static final AcceptEncoding acceptEncoding(StringRanges value) {
209      return AcceptEncoding.of(value);
210   }
211
212   /**
213    * Creates a new {@link AcceptEncoding} header with a delayed value.
214    *
215    * <p>
216    * Header value is re-evaluated on each call to {@link Header#getValue()}.
217    *
218    * @param value
219    *    The supplier of the header value.
220    *    <br>Can be <jk>null</jk>.
221    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
222    */
223   public static final AcceptEncoding acceptEncoding(Supplier<StringRanges> value) {
224      return AcceptEncoding.of(value);
225   }
226
227   /**
228    * Creates a new {@link AcceptLanguage} header.
229    *
230    * @param value
231    *    The header value.
232    *    <br>Must be parsable by {@link StringRanges#of(String)}.
233    *    <br>Can be <jk>null</jk>.
234    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
235    */
236   public static final AcceptLanguage acceptLanguage(String value) {
237      return AcceptLanguage.of(value);
238   }
239
240   /**
241    * Creates a new {@link AcceptLanguage} header.
242    *
243    * @param value
244    *    The header value.
245    *    <br>Can be <jk>null</jk>.
246    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
247    */
248   public static final AcceptLanguage acceptLanguage(StringRanges value) {
249      return AcceptLanguage.of(value);
250   }
251
252   /**
253    * Creates a new {@link AcceptLanguage} header with a delayed value.
254    *
255    * <p>
256    * Header value is re-evaluated on each call to {@link Header#getValue()}.
257    *
258    * @param value
259    *    The supplier of the header value.
260    *    <br>Can be <jk>null</jk>.
261    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
262    */
263   public static final AcceptLanguage acceptLanguage(Supplier<StringRanges> value) {
264      return AcceptLanguage.of(value);
265   }
266
267   /**
268    * Creates a new {@link AcceptRanges} header.
269    *
270    * @param value
271    *    The header value.
272    *    <br>Can be <jk>null</jk>.
273    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
274    */
275   public static final AcceptRanges acceptRanges(String value) {
276      return AcceptRanges.of(value);
277   }
278
279   /**
280    * Creates a new {@link AcceptRanges} header with a delayed value.
281    *
282    * <p>
283    * Header value is re-evaluated on each call to {@link Header#getValue()}.
284    *
285    * @param value
286    *    The supplier of the header value.
287    *    <br>Can be <jk>null</jk>.
288    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
289    */
290   public static final AcceptRanges acceptRanges(Supplier<String> value) {
291      return AcceptRanges.of(value);
292   }
293
294   /**
295    * Creates a new {@link Age} header.
296    *
297    * @param value
298    *    The header value.
299    *    <br>Must be parsable using {@link Integer#parseInt(String)}.
300    *    <br>Can be <jk>null</jk>.
301    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
302    */
303   public static final Age age(String value) {
304      return Age.of(value);
305   }
306
307   /**
308    * Creates a new {@link Age} header.
309    *
310    * @param value
311    *    The header value.
312    *    <br>Can be <jk>null</jk>.
313    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
314    */
315   public static final Age age(Integer value) {
316      return Age.of(value);
317   }
318
319   /**
320    * Creates a new {@link Age} header with a delayed value.
321    *
322    * <p>
323    * Header value is re-evaluated on each call to {@link Header#getValue()}.
324    *
325    * @param value
326    *    The supplier of the header value.
327    *    <br>Can be <jk>null</jk>.
328    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
329    */
330   public static final Age age(Supplier<Integer> value) {
331      return Age.of(value);
332   }
333
334   /**
335    * Creates a new {@link Allow} header.
336    *
337    * @param value
338    *    The header value.
339    *    <br>Can be <jk>null</jk>.
340    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
341    */
342   public static final Allow allow(String value) {
343      return Allow.of(value);
344   }
345
346   /**
347    * Creates a new {@link Allow} header.
348    *
349    * @param value
350    *    The header value.
351    *    <br>Can be <jk>null</jk>.
352    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
353    */
354   public static final Allow allow(String...value) {
355      return Allow.of(value);
356   }
357
358   /**
359    * Creates a new {@link Allow} header with a delayed value.
360    *
361    * <p>
362    * Header value is re-evaluated on each call to {@link Header#getValue()}.
363    *
364    * @param value
365    *    The supplier of the header value.
366    *    <br>Can be <jk>null</jk>.
367    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
368    */
369   public static final Allow allow(Supplier<String[]> value) {
370      return Allow.of(value);
371   }
372
373   /**
374    * Creates a new {@link Authorization} header.
375    *
376    * @param value
377    *    The header value.
378    *    <br>Can be <jk>null</jk>.
379    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
380    */
381   public static final Authorization authorization(String value) {
382      return Authorization.of(value);
383   }
384
385   /**
386    * Creates a new {@link Authorization} header with a delayed value.
387    *
388    * <p>
389    * Header value is re-evaluated on each call to {@link Header#getValue()}.
390    *
391    * @param value
392    *    The supplier of the header value.
393    *    <br>Can be <jk>null</jk>.
394    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
395    */
396   public static final Authorization authorization(Supplier<String> value) {
397      return Authorization.of(value);
398   }
399
400   /**
401    * Creates a new {@link CacheControl} header.
402    *
403    * @param value
404    *    The header value.
405    *    <br>Can be <jk>null</jk>.
406    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
407    */
408   public static final CacheControl cacheControl(String value) {
409      return CacheControl.of(value);
410   }
411
412   /**
413    * Creates a new {@link CacheControl} header with a delayed value.
414    *
415    * <p>
416    * Header value is re-evaluated on each call to {@link Header#getValue()}.
417    *
418    * @param value
419    *    The supplier of the header value.
420    *    <br>Can be <jk>null</jk>.
421    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
422    */
423   public static final CacheControl cacheControl(Supplier<String> value) {
424      return CacheControl.of(value);
425   }
426
427   /**
428    * Creates a new {@link ClientVersion} header.
429    *
430    * @param value
431    *    The header value.
432    *    <br>Must be parsable by {@link Version#of(String)}
433    *    <br>Can be <jk>null</jk>.
434    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
435    */
436   public static final ClientVersion clientVersion(String value) {
437      return ClientVersion.of(value);
438   }
439
440   /**
441    * Creates a new {@link ClientVersion} header.
442    *
443    * @param value
444    *    The header value.
445    *    <br>Can be <jk>null</jk>.
446    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
447    */
448   public static final ClientVersion clientVersion(Version value) {
449      return ClientVersion.of(value);
450   }
451
452   /**
453    * Creates a new {@link ClientVersion} header with a delayed value.
454    *
455    * <p>
456    * Header value is re-evaluated on each call to {@link Header#getValue()}.
457    *
458    * @param value
459    *    The supplier of the header value.
460    *    <br>Can be <jk>null</jk>.
461    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
462    */
463   public static final ClientVersion clientVersion(Supplier<Version> value) {
464      return ClientVersion.of(value);
465   }
466
467   /**
468    * Creates a new {@link Connection} header.
469    *
470    * @param value
471    *    The header value.
472    *    <br>Can be <jk>null</jk>.
473    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
474    */
475   public static final Connection connection(String value) {
476      return Connection.of(value);
477   }
478
479   /**
480    * Creates a new {@link Connection} header with a delayed value.
481    *
482    * <p>
483    * Header value is re-evaluated on each call to {@link Header#getValue()}.
484    *
485    * @param value
486    *    The supplier of the header value.
487    *    <br>Can be <jk>null</jk>.
488    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
489    */
490   public static final Connection connection(Supplier<String> value) {
491      return Connection.of(value);
492   }
493
494   /**
495    * Creates a new {@link ContentDisposition} header.
496    *
497    * @param value
498    *    The header value.
499    *    <br>Must be parsable by {@link StringRanges#of(String)}.
500    *    <br>Can be <jk>null</jk>.
501    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
502    */
503   public static final ContentDisposition contentDisposition(String value) {
504      return ContentDisposition.of(value);
505   }
506
507   /**
508    * Creates a new {@link ContentDisposition} header.
509    *
510    * @param value
511    *    The header value.
512    *    <br>Can be <jk>null</jk>.
513    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
514    */
515   public static final ContentDisposition contentDisposition(StringRanges value) {
516      return ContentDisposition.of(value);
517   }
518
519   /**
520    * Creates a new {@link ContentDisposition} header with a delayed value.
521    *
522    * <p>
523    * Header value is re-evaluated on each call to {@link Header#getValue()}.
524    *
525    * @param value
526    *    The supplier of the header value.
527    *    <br>Can be <jk>null</jk>.
528    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
529    */
530   public static final ContentDisposition contentDisposition(Supplier<StringRanges> value) {
531      return ContentDisposition.of(value);
532   }
533
534   /**
535    * Creates a new {@link ContentEncoding} header.
536    *
537    * @param value
538    *    The header value.
539    *    <br>Can be <jk>null</jk>.
540    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
541    */
542   public static final ContentEncoding contentEncoding(String value) {
543      return ContentEncoding.of(value);
544   }
545
546   /**
547    * Creates a new {@link ContentEncoding} header with a delayed value.
548    *
549    * <p>
550    * Header value is re-evaluated on each call to {@link Header#getValue()}.
551    *
552    * @param value
553    *    The supplier of the header value.
554    *    <br>Can be <jk>null</jk>.
555    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
556    */
557   public static final ContentEncoding contentEncoding(Supplier<String> value) {
558      return ContentEncoding.of(value);
559   }
560
561   /**
562    * Creates a new {@link ContentLanguage} header.
563    *
564    * @param value
565    *    The header value.
566    *    <br>Can be <jk>null</jk>.
567    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
568    */
569   public static final ContentLanguage contentLanguage(String value) {
570      return ContentLanguage.of(value);
571   }
572
573   /**
574    * Creates a new {@link ContentLanguage} header.
575    *
576    * @param value
577    *    The header value.
578    *    <br>Can be <jk>null</jk>.
579    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
580    */
581   public static final ContentLanguage contentLanguage(String...value) {
582      return ContentLanguage.of(value);
583   }
584
585   /**
586    * Creates a new {@link ContentLanguage} header with a delayed value.
587    *
588    * <p>
589    * Header value is re-evaluated on each call to {@link Header#getValue()}.
590    *
591    * @param value
592    *    The supplier of the header value.
593    *    <br>Can be <jk>null</jk>.
594    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
595    */
596   public static final ContentLanguage contentLanguage(Supplier<String[]> value) {
597      return ContentLanguage.of(value);
598   }
599
600   /**
601    * Creates a new {@link ContentLength} header.
602    *
603    * @param value
604    *    The header value.
605    *    <br>Must be parsable using {@link Long#parseLong(String)}.
606    *    <br>Can be <jk>null</jk>.
607    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
608    */
609   public static final ContentLength contentLength(String value) {
610      return ContentLength.of(value);
611   }
612
613   /**
614    * Creates a new {@link ContentLength} header.
615    *
616    * @param value
617    *    The header value.
618    *    <br>Can be <jk>null</jk>.
619    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
620    */
621   public static final ContentLength contentLength(Long value) {
622      return ContentLength.of(value);
623   }
624
625   /**
626    * Creates a new {@link ContentLength} header with a delayed value.
627    *
628    * <p>
629    * Header value is re-evaluated on each call to {@link Header#getValue()}.
630    *
631    * @param value
632    *    The supplier of the header value.
633    *    <br>Can be <jk>null</jk>.
634    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
635    */
636   public static final ContentLength contentLength(Supplier<Long> value) {
637      return ContentLength.of(value);
638   }
639
640   /**
641    * Creates a new {@link ContentLocation} header.
642    *
643    * @param value
644    *    The header value.
645    *    <br>Must be parsable by {@link URI#create(String)}.
646    *    <br>Can be <jk>null</jk>.
647    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
648    */
649   public static final ContentLocation contentLocation(String value) {
650      return ContentLocation.of(value);
651   }
652
653   /**
654    * Creates a new {@link ContentLocation} header.
655    *
656    * @param value
657    *    The header value.
658    *    <br>Can be <jk>null</jk>.
659    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
660    */
661   public static final ContentLocation contentLocation(URI value) {
662      return ContentLocation.of(value);
663   }
664
665   /**
666    * Creates a new {@link ContentLocation} header with a delayed value.
667    *
668    * <p>
669    * Header value is re-evaluated on each call to {@link Header#getValue()}.
670    *
671    * @param value
672    *    The supplier of the header value.
673    *    <br>Can be <jk>null</jk>.
674    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
675    */
676   public static final ContentLocation contentLocation(Supplier<URI> value) {
677      return ContentLocation.of(value);
678   }
679
680   /**
681    * Creates a new {@link ContentRange} header.
682    *
683    * @param value
684    *    The header value.
685    *    <br>Can be <jk>null</jk>.
686    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
687    */
688   public static final ContentRange contentRange(String value) {
689      return ContentRange.of(value);
690   }
691
692   /**
693    * Creates a new {@link ContentRange} header with a delayed value.
694    *
695    * <p>
696    * Header value is re-evaluated on each call to {@link Header#getValue()}.
697    *
698    * @param value
699    *    The supplier of the header value.
700    *    <br>Can be <jk>null</jk>.
701    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
702    */
703   public static final ContentRange contentRange(Supplier<String> value) {
704      return ContentRange.of(value);
705   }
706
707   /**
708    * Creates a new {@link ContentType} header.
709    *
710    * @param value
711    *    The header value.
712    *    <br>Must be parsable by {@link MediaType#of(String)}.
713    *    <br>Can be <jk>null</jk>.
714    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
715    */
716   public static final ContentType contentType(String value) {
717      return ContentType.of(value);
718   }
719
720   /**
721    * Creates a new {@link ContentType} header.
722    *
723    * @param value
724    *    The header value.
725    *    <br>Can be <jk>null</jk>.
726    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
727    */
728   public static final ContentType contentType(MediaType value) {
729      return ContentType.of(value);
730   }
731
732   /**
733    * Creates a new {@link ContentType} header with a delayed value.
734    *
735    * <p>
736    * Header value is re-evaluated on each call to {@link Header#getValue()}.
737    *
738    * @param value
739    *    The header value.
740    *    <br>Can be <jk>null</jk>.
741    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
742    */
743   public static final ContentType contentType(Supplier<MediaType> value) {
744      return ContentType.of(value);
745   }
746
747   /**
748    * Creates a new {@link Date} header.
749    *
750    * @param value
751    *    The header value.
752    *    <br>Must be an RFC-1123 formated string (e.g. <js>"Sat, 29 Oct 1994 19:43:31 GMT"</js>).
753    *    <br>Can be <jk>null</jk>.
754    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
755    */
756   public static final Date date(String value) {
757      return Date.of(value);
758   }
759
760   /**
761    * Creates a new {@link Date} header.
762    *
763    * @param value
764    *    The header value.
765    *    <br>Can be <jk>null</jk>.
766    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
767    */
768   public static final Date date(ZonedDateTime value) {
769      return Date.of(value);
770   }
771
772   /**
773    * Creates a new {@link Date} header with a delayed value.
774    *
775    * <p>
776    * Header value is re-evaluated on each call to {@link Header#getValue()}.
777    *
778    * @param value
779    *    The supplier of the header value.
780    *    <br>Can be <jk>null</jk>.
781    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
782    */
783   public static final Date date(Supplier<ZonedDateTime> value) {
784      return Date.of(value);
785   }
786
787   /**
788    * Creates a new {@link Debug} header.
789    *
790    * @param value
791    *    The header value.
792    *    <br>Must be parsable by {@link Boolean#parseBoolean(String)}.
793    *    <br>Can be <jk>null</jk>.
794    * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>.
795    */
796   public static final Debug debug(String value) {
797      return Debug.of(value);
798   }
799
800   /**
801    * Creates a new {@link Debug} header.
802    *
803    * @param value
804    *    The header value.
805    *    <br>Must be parsable by {@link Boolean#parseBoolean(String)}.
806    *    <br>Can be <jk>null</jk>.
807    * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>.
808    */
809   public static final Debug debug(Boolean value) {
810      return Debug.of(value);
811   }
812
813   /**
814    * Creates a new {@link Debug} header with a delayed value.
815    *
816    * <p>
817    * Header value is re-evaluated on each call to {@link Header#getValue()}.
818    *
819    * @param value
820    *    The header value supplier.
821    *    <br>Can be <jk>null</jk>.
822    * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>.
823    */
824   public static final Debug debug(Supplier<Boolean> value) {
825      return Debug.of(value);
826   }
827
828   /**
829    * Creates a new {@link ETag} header.
830    *
831    * @param value
832    *    The header value.
833    *    <br>Must be an entity tag value (e.g. <js>"\"xyzzy\""</js>).
834    *    <br>Can be <jk>null</jk>.
835    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
836    */
837   public static final ETag eTag(String value) {
838      return ETag.of(value);
839   }
840
841   /**
842    * Creates a new {@link ETag} header.
843    *
844    * @param value
845    *    The header value.
846    *    <br>Can be <jk>null</jk>.
847    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
848    */
849   public static final ETag eTag(EntityTag value) {
850      return ETag.of(value);
851   }
852
853   /**
854    * Creates a new {@link ETag} header with a delayed value.
855    *
856    * <p>
857    * Header value is re-evaluated on each call to {@link Header#getValue()}.
858    *
859    * @param value
860    *    The supplier of the header value.
861    *    <br>Can be <jk>null</jk>.
862    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
863    */
864   public static final ETag eTag(Supplier<EntityTag> value) {
865      return ETag.of(value);
866   }
867
868   /**
869    * Creates a new {@link Expect} header.
870    *
871    * @param value
872    *    The header value.
873    *    <br>Can be <jk>null</jk>.
874    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
875    */
876   public static final Expect expect(String value) {
877      return Expect.of(value);
878   }
879
880   /**
881    * Creates a new {@link Expect} header with a delayed value.
882    *
883    * <p>
884    * Header value is re-evaluated on each call to {@link Header#getValue()}.
885    *
886    * @param value
887    *    The supplier of the header value.
888    *    <br>Can be <jk>null</jk>.
889    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
890    */
891   public static final Expect expect(Supplier<String> value) {
892      return Expect.of(value);
893   }
894
895   /**
896    * Creates a new {@link Expires} header.
897    *
898    * @param value
899    *    The header value.
900    *    <br>Must be an RFC-1123 formated string (e.g. <js>"Sat, 29 Oct 1994 19:43:31 GMT"</js>).
901    *    <br>Can be <jk>null</jk>.
902    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
903    */
904   public static final Expires expires(String value) {
905      return Expires.of(value);
906   }
907
908   /**
909    * Creates a new {@link Expires} header.
910    *
911    * @param value
912    *    The header value.
913    *    <br>Can be <jk>null</jk>.
914    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
915    */
916   public static final Expires expires(ZonedDateTime value) {
917      return Expires.of(value);
918   }
919
920   /**
921    * Creates a new {@link Expires} header with a delayed value.
922    *
923    * <p>
924    * Header value is re-evaluated on each call to {@link Header#getValue()}.
925    *
926    * @param value
927    *    The supplier of the header value.
928    *    <br>Can be <jk>null</jk>.
929    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
930    */
931   public static final Expires expires(Supplier<ZonedDateTime> value) {
932      return Expires.of(value);
933   }
934
935   /**
936    * Creates a new {@link Forwarded} header.
937    *
938    * @param value
939    *    The header value.
940    *    <br>Can be <jk>null</jk>.
941    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
942    */
943   public static final Forwarded forwarded(String value) {
944      return Forwarded.of(value);
945   }
946
947   /**
948    * Creates a new {@link Forwarded} header with a delayed value.
949    *
950    * <p>
951    * Header value is re-evaluated on each call to {@link Header#getValue()}.
952    *
953    * @param value
954    *    The supplier of the header value.
955    *    <br>Can be <jk>null</jk>.
956    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
957    */
958   public static final Forwarded forwarded(Supplier<String> value) {
959      return Forwarded.of(value);
960   }
961
962   /**
963    * Creates a new {@link From} header.
964    *
965    * @param value
966    *    The header value.
967    *    <br>Can be <jk>null</jk>.
968    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
969    */
970   public static final From from(String value) {
971      return From.of(value);
972   }
973
974   /**
975    * Creates a new {@link From} header with a delayed value.
976    *
977    * <p>
978    * Header value is re-evaluated on each call to {@link Header#getValue()}.
979    *
980    * @param value
981    *    The supplier of the header value.
982    *    <br>Can be <jk>null</jk>.
983    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
984    */
985   public static final From from(Supplier<String> value) {
986      return From.of(value);
987   }
988
989   /**
990    * Creates a new {@link Host} header.
991    *
992    * @param value
993    *    The header value.
994    *    <br>Can be <jk>null</jk>.
995    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
996    */
997   public static final Host host(String value) {
998      return Host.of(value);
999   }
1000
1001   /**
1002    * Creates a new {@link Host} header with a delayed value.
1003    *
1004    * <p>
1005    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1006    *
1007    * @param value
1008    *    The supplier of the header value.
1009    *    <br>Can be <jk>null</jk>.
1010    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1011    */
1012   public static final Host host(Supplier<String> value) {
1013      return Host.of(value);
1014   }
1015
1016   /**
1017    * Creates a new {@link IfMatch} header.
1018    *
1019    * @param value
1020    *    The header value.
1021    *    <br>Must be a comma-delimited list of entity validator values (e.g. <js>"\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\""</js>).
1022    *    <br>Can be <jk>null</jk>.
1023    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1024    */
1025   public static final IfMatch ifMatch(String value) {
1026      return IfMatch.of(value);
1027   }
1028
1029   /**
1030    * Creates a new {@link IfMatch} header.
1031    *
1032    * @param value
1033    *    The header value.
1034    *    <br>Can be <jk>null</jk>.
1035    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1036    */
1037   public static final IfMatch ifMatch(EntityTags value) {
1038      return IfMatch.of(value);
1039   }
1040
1041   /**
1042    * Creates a new {@link IfMatch} header with a delayed value.
1043    *
1044    * <p>
1045    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1046    *
1047    * @param value
1048    *    The supplier of the header value.
1049    *    <br>Can be <jk>null</jk>.
1050    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1051    */
1052   public static final IfMatch ifMatch(Supplier<EntityTags> value) {
1053      return IfMatch.of(value);
1054   }
1055
1056   /**
1057    * Creates a new {@link IfModifiedSince} header.
1058    *
1059    * @param value
1060    *    The header value.
1061    *    <br>Must be an RFC-1123 formated string (e.g. <js>"Sat, 29 Oct 1994 19:43:31 GMT"</js>).
1062    *    <br>Can be <jk>null</jk>.
1063    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1064    */
1065   public static final IfModifiedSince ifModifiedSince(String value) {
1066      return IfModifiedSince.of(value);
1067   }
1068
1069   /**
1070    * Creates a new {@link IfModifiedSince} header.
1071    *
1072    * @param value
1073    *    The header value.
1074    *    <br>Can be <jk>null</jk>.
1075    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1076    */
1077   public static final IfModifiedSince ifModifiedSince(ZonedDateTime value) {
1078      return IfModifiedSince.of(value);
1079   }
1080
1081   /**
1082    * Creates a new {@link IfModifiedSince} header with a delayed value.
1083    *
1084    * <p>
1085    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1086    *
1087    * @param value
1088    *    The supplier of the header value.
1089    *    <br>Can be <jk>null</jk>.
1090    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1091    */
1092   public static final IfModifiedSince ifModifiedSince(Supplier<ZonedDateTime> value) {
1093      return IfModifiedSince.of(value);
1094   }
1095
1096   /**
1097    * Creates a new {@link IfNoneMatch} header.
1098    *
1099    * @param value
1100    *    The header value.
1101    *    <br>Must be a comma-delimited list of entity validator values (e.g. <js>"\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\""</js>).
1102    *    <br>Can be <jk>null</jk>.
1103    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1104    */
1105   public static final IfNoneMatch ifNoneMatch(String value) {
1106      return IfNoneMatch.of(value);
1107   }
1108
1109   /**
1110    * Creates a new {@link IfNoneMatch} header.
1111    *
1112    * @param value
1113    *    The header value.
1114    *    <br>Can be <jk>null</jk>.
1115    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1116    */
1117   public static final IfNoneMatch ifNoneMatch(EntityTags value) {
1118      return IfNoneMatch.of(value);
1119   }
1120
1121   /**
1122    * Creates a new {@link IfNoneMatch} header with a delayed value.
1123    *
1124    * <p>
1125    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1126    *
1127    * @param value
1128    *    The supplier of the header value.
1129    *    <br>Can be <jk>null</jk>.
1130    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1131    */
1132   public static final IfNoneMatch ifNoneMatch(Supplier<EntityTags> value) {
1133      return IfNoneMatch.of(value);
1134   }
1135
1136   /**
1137    * Creates a new {@link IfRange} header.
1138    *
1139    * @param value
1140    *    The header value.
1141    *    <br>Must be an RFC-1123 formated string (e.g. <js>"Sat, 29 Oct 1994 19:43:31 GMT"</js>).
1142    *    <br>Can be <jk>null</jk>.
1143    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1144    */
1145   public static final IfRange ifRange(String value) {
1146      return IfRange.of(value);
1147   }
1148
1149   /**
1150    * Creates a new {@link IfRange} header.
1151    *
1152    * @param value
1153    *    The header value.
1154    *    <br>Can be <jk>null</jk>.
1155    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1156    */
1157   public static final IfRange ifRange(ZonedDateTime value) {
1158      return IfRange.of(value);
1159   }
1160
1161   /**
1162    * Creates a new {@link IfRange} header.
1163    *
1164    * @param value
1165    *    The header value.
1166    *    <br>Can be <jk>null</jk>.
1167    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1168    */
1169   public static final IfRange ifRange(EntityTag value) {
1170      return IfRange.of(value);
1171   }
1172
1173   /**
1174    * Creates a new {@link IfRange} header with a delayed value.
1175    *
1176    * <p>
1177    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1178    *
1179    * @param value
1180    *    The supplier of the header value.
1181    *    <br>Supplier must supply either {@link EntityTag} or {@link ZonedDateTime} objects.
1182    *    <br>Can be <jk>null</jk>.
1183    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1184    */
1185   public static final IfRange ifRange(Supplier<?> value) {
1186      return IfRange.of(value);
1187   }
1188
1189   /**
1190    * Creates a new {@link IfUnmodifiedSince} header.
1191    *
1192    * @param value
1193    *    The header value.
1194    *    <br>Must be an RFC-1123 formated string (e.g. <js>"Sat, 29 Oct 1994 19:43:31 GMT"</js>).
1195    *    <br>Can be <jk>null</jk>.
1196    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1197    */
1198   public static final IfUnmodifiedSince ifUnmodifiedSince(String value) {
1199      return IfUnmodifiedSince.of(value);
1200   }
1201
1202   /**
1203    * Creates a new {@link IfUnmodifiedSince} header.
1204    *
1205    * @param value
1206    *    The header value.
1207    *    <br>Can be <jk>null</jk>.
1208    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1209    */
1210   public static final IfUnmodifiedSince ifUnmodifiedSince(ZonedDateTime value) {
1211      return IfUnmodifiedSince.of(value);
1212   }
1213
1214   /**
1215    * Creates a new {@link IfUnmodifiedSince} header with a delayed value.
1216    *
1217    * <p>
1218    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1219    *
1220    * @param value
1221    *    The supplier of the header value.
1222    *    <br>Can be <jk>null</jk>.
1223    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1224    */
1225   public static final IfUnmodifiedSince ifUnmodifiedSince(Supplier<ZonedDateTime> value) {
1226      return IfUnmodifiedSince.of(value);
1227   }
1228
1229   /**
1230    * Creates a new {@link LastModified} header.
1231    *
1232    * @param value
1233    *    The header value.
1234    *    <br>Must be an RFC-1123 formated string (e.g. <js>"Sat, 29 Oct 1994 19:43:31 GMT"</js>).
1235    *    <br>Can be <jk>null</jk>.
1236    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1237    */
1238   public static final LastModified lastModified(String value) {
1239      return LastModified.of(value);
1240   }
1241
1242   /**
1243    * Creates a new {@link LastModified} header.
1244    *
1245    * @param value
1246    *    The header value.
1247    *    <br>Can be <jk>null</jk>.
1248    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1249    */
1250   public static final LastModified lastModified(ZonedDateTime value) {
1251      return LastModified.of(value);
1252   }
1253
1254   /**
1255    * Creates a new {@link LastModified} header with a delayed value.
1256    *
1257    * <p>
1258    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1259    *
1260    * @param value
1261    *    The supplier of the header value.
1262    *    <br>Can be <jk>null</jk>.
1263    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1264    */
1265   public static final LastModified lastModified(Supplier<ZonedDateTime> value) {
1266      return LastModified.of(value);
1267   }
1268
1269   /**
1270    * Creates a new {@link Location} header.
1271    *
1272    * @param value
1273    *    The header value.
1274    *    <br>Must be parsable by {@link URI#create(String)}.
1275    *    <br>Can be <jk>null</jk>.
1276    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1277    */
1278   public static final Location location(String value) {
1279      return Location.of(value);
1280   }
1281
1282   /**
1283    * Creates a new {@link Location} header.
1284    *
1285    * @param value
1286    *    The header value.
1287    *    <br>Can be <jk>null</jk>.
1288    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1289    */
1290   public static final Location location(URI value) {
1291      return Location.of(value);
1292   }
1293
1294   /**
1295    * Creates a new {@link Location} header with a delayed value.
1296    *
1297    * <p>
1298    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1299    *
1300    * @param value
1301    *    The supplier of the header value.
1302    *    <br>Can be <jk>null</jk>.
1303    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1304    */
1305   public static final Location location(Supplier<URI> value) {
1306      return Location.of(value);
1307   }
1308
1309   /**
1310    * Creates a new {@link MaxForwards} header.
1311    *
1312    * @param value
1313    *    The header value.
1314    *    <br>Must be parsable using {@link Integer#parseInt(String)}.
1315    *    <br>Can be <jk>null</jk>.
1316    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1317    */
1318   public static final MaxForwards maxForwards(String value) {
1319      return MaxForwards.of(value);
1320   }
1321
1322   /**
1323    * Creates a new {@link MaxForwards} header.
1324    *
1325    * @param value
1326    *    The header value.
1327    *    <br>Can be <jk>null</jk>.
1328    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1329    */
1330   public static final MaxForwards maxForwards(Integer value) {
1331      return MaxForwards.of(value);
1332   }
1333
1334   /**
1335    * Creates a new {@link MaxForwards} header with a delayed value.
1336    *
1337    * <p>
1338    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1339    *
1340    * @param value
1341    *    The supplier of the header value.
1342    *    <br>Can be <jk>null</jk>.
1343    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1344    */
1345   public static final MaxForwards maxForwards(Supplier<Integer> value) {
1346      return MaxForwards.of(value);
1347   }
1348
1349   /**
1350    * Creates a new {@link NoTrace} header.
1351    *
1352    * @param value
1353    *    The header value.
1354    *    <br>Must be parsable by {@link Boolean#parseBoolean(String)}.
1355    *    <br>Can be <jk>null</jk>.
1356    * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>.
1357    */
1358   public static final NoTrace noTrace(String value) {
1359      return NoTrace.of(value);
1360   }
1361
1362   /**
1363    * Creates a new {@link NoTrace} header.
1364    *
1365    * @param value
1366    *    The header value.
1367    *    <br>Can be <jk>null</jk>.
1368    * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>.
1369    */
1370   public static final NoTrace noTrace(Boolean value) {
1371      return NoTrace.of(value);
1372   }
1373
1374   /**
1375    * Creates a new {@link NoTrace} header with a delayed value.
1376    *
1377    * <p>
1378    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1379    *
1380    * @param value
1381    *    The header value supplier.
1382    *    <br>Can be <jk>null</jk>.
1383    * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>.
1384    */
1385   public static final NoTrace noTrace(Supplier<Boolean> value) {
1386      return NoTrace.of(value);
1387   }
1388
1389   /**
1390    * Creates a new {@link Origin} header.
1391    *
1392    * @param value
1393    *    The header value.
1394    *    <br>Can be <jk>null</jk>.
1395    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1396    */
1397   public static final Origin origin(String value) {
1398      return Origin.of(value);
1399   }
1400
1401   /**
1402    * Creates a new {@link Origin} header with a delayed value.
1403    *
1404    * <p>
1405    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1406    *
1407    * @param value
1408    *    The supplier of the header value.
1409    *    <br>Can be <jk>null</jk>.
1410    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1411    */
1412   public static final Origin origin(Supplier<String> value) {
1413      return Origin.of(value);
1414   }
1415
1416   /**
1417    * Creates a new {@link Pragma} header.
1418    *
1419    * @param value
1420    *    The header value.
1421    *    <br>Can be <jk>null</jk>.
1422    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1423    */
1424   public static final Pragma pragma(String value) {
1425      return Pragma.of(value);
1426   }
1427
1428   /**
1429    * Creates a new {@link Pragma} header with a delayed value.
1430    *
1431    * <p>
1432    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1433    *
1434    * @param value
1435    *    The header value.
1436    *    <br>Can be <jk>null</jk>.
1437    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1438    */
1439   public static final Pragma pragma(Supplier<String> value) {
1440      return Pragma.of(value);
1441   }
1442
1443   /**
1444    * Creates a new {@link ProxyAuthenticate} header.
1445    *
1446    * @param value
1447    *    The header value.
1448    *    <br>Can be <jk>null</jk>.
1449    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1450    */
1451   public static final ProxyAuthenticate proxyAuthenticate(String value) {
1452      return ProxyAuthenticate.of(value);
1453   }
1454
1455   /**
1456    * Creates a new {@link ProxyAuthenticate} header with a delayed value.
1457    *
1458    * <p>
1459    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1460    *
1461    * @param value
1462    *    The supplier of the header value.
1463    *    <br>Can be <jk>null</jk>.
1464    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1465    */
1466   public static final ProxyAuthenticate proxyAuthenticate(Supplier<String> value) {
1467      return ProxyAuthenticate.of(value);
1468   }
1469
1470   /**
1471    * Creates a new {@link ProxyAuthorization} header.
1472    *
1473    * @param value
1474    *    The header value.
1475    *    <br>Can be <jk>null</jk>.
1476    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1477    */
1478   public static final ProxyAuthorization proxyAuthorization(String value) {
1479      return ProxyAuthorization.of(value);
1480   }
1481
1482   /**
1483    * Creates a new {@link ProxyAuthorization} header with a delayed value.
1484    *
1485    * <p>
1486    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1487    *
1488    * @param value
1489    *    The supplier of the header value.
1490    *    <br>Can be <jk>null</jk>.
1491    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1492    */
1493   public static final ProxyAuthorization proxyAuthorization(Supplier<String> value) {
1494      return ProxyAuthorization.of(value);
1495   }
1496
1497   /**
1498    * Creates a new {@link Range} header.
1499    *
1500    * @param value
1501    *    The header value.
1502    *    <br>Can be <jk>null</jk>.
1503    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1504    */
1505   public static final Range range(String value) {
1506      return Range.of(value);
1507   }
1508
1509   /**
1510    * Creates a new {@link Range} header with a delayed value.
1511    *
1512    * <p>
1513    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1514    *
1515    * @param value
1516    *    The supplier of the header value.
1517    *    <br>Can be <jk>null</jk>.
1518    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1519    */
1520   public static final Range range(Supplier<String> value) {
1521      return Range.of(value);
1522   }
1523
1524   /**
1525    * Creates a new {@link Referer} header.
1526    *
1527    * @param value
1528    *    The header value.
1529    *    <br>Must be parsable by {@link URI#create(String)}.
1530    *    <br>Can be <jk>null</jk>.
1531    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1532    */
1533   public static final Referer referer(String value) {
1534      return Referer.of(value);
1535   }
1536
1537   /**
1538    * Creates a new {@link Referer} header.
1539    *
1540    * @param value
1541    *    The header value.
1542    *    <br>Must be parsable by {@link URI#create(String)}.
1543    *    <br>Can be <jk>null</jk>.
1544    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1545    */
1546   public static final Referer referer(URI value) {
1547      return Referer.of(value);
1548   }
1549
1550   /**
1551    * Creates a new {@link Referer} header with a delayed value.
1552    *
1553    * <p>
1554    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1555    *
1556    * @param value
1557    *    The supplier of the header value.
1558    *    <br>Can be <jk>null</jk>.
1559    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1560    */
1561   public static final Referer referer(Supplier<URI> value) {
1562      return Referer.of(value);
1563   }
1564
1565   /**
1566    * Creates a new {@link RetryAfter} header.
1567    *
1568    * @param value
1569    *    The header value.
1570    *    <br>Must be an RFC-1123 formated string (e.g. <js>"Sat, 29 Oct 1994 19:43:31 GMT"</js>) or an integer.
1571    *    <br>Can be <jk>null</jk>.
1572    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1573    */
1574   public static final RetryAfter retryAfter(String value) {
1575      return RetryAfter.of(value);
1576   }
1577
1578   /**
1579    * Creates a new {@link RetryAfter} header.
1580    *
1581    * @param value
1582    *    The header value.
1583    *    <br>Can be <jk>null</jk>.
1584    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1585    */
1586   public static final RetryAfter retryAfter(ZonedDateTime value) {
1587      return RetryAfter.of(value);
1588   }
1589
1590   /**
1591    * Creates a new {@link RetryAfter} header.
1592    *
1593    * @param value
1594    *    The header value.
1595    *    <br>Can be <jk>null</jk>.
1596    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1597    */
1598   public static final RetryAfter retryAfter(Integer value) {
1599      return RetryAfter.of(value);
1600   }
1601
1602   /**
1603    * Creates a new {@link RetryAfter} header with a delayed value.
1604    *
1605    * <p>
1606    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1607    *
1608    * @param value
1609    *    The supplier of the header value.
1610    *    <br>Supplier must supply either {@link Integer} or {@link ZonedDateTime} objects.
1611    *    <br>Can be <jk>null</jk>.
1612    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1613    */
1614   public static final RetryAfter retryAfter(Supplier<?> value) {
1615      return RetryAfter.of(value);
1616   }
1617
1618   /**
1619    * Creates a new {@link Server} header.
1620    *
1621    * @param value
1622    *    The header value.
1623    *    <br>Can be <jk>null</jk>.
1624    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1625    */
1626   public static final Server server(String value) {
1627      return Server.of(value);
1628   }
1629
1630   /**
1631    * Creates a new {@link Server} header with a delayed value.
1632    *
1633    * <p>
1634    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1635    *
1636    * @param value
1637    *    The supplier of the header value.
1638    *    <br>Can be <jk>null</jk>.
1639    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1640    */
1641   public static final Server server(Supplier<String> value) {
1642      return Server.of(value);
1643   }
1644
1645   /**
1646    * Creates a new {@link TE} header.
1647    *
1648    * @param value
1649    *    The header value.
1650    *    <br>Must be parsable by {@link StringRanges#of(String)}.
1651    *    <br>Can be <jk>null</jk>.
1652    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1653    */
1654   public static final TE te(String value) {
1655      return TE.of(value);
1656   }
1657
1658   /**
1659    * Creates a new {@link TE} header.
1660    *
1661    * @param value
1662    *    The header value.
1663    *    <br>Can be <jk>null</jk>.
1664    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1665    */
1666   public static final TE te(StringRanges value) {
1667      return TE.of(value);
1668   }
1669
1670   /**
1671    * Creates a new {@link TE} header with a delayed value.
1672    *
1673    * <p>
1674    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1675    *
1676    * @param value
1677    *    The supplier of the header value.
1678    *    <br>Can be <jk>null</jk>.
1679    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1680    */
1681   public static final TE te(Supplier<StringRanges> value) {
1682      return TE.of(value);
1683   }
1684
1685   /**
1686    * Creates a new {@link Thrown} header.
1687    *
1688    * @param value
1689    *    The header value.
1690    *    <br>Can be <jk>null</jk>.
1691    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1692    */
1693   public static final Thrown thrown(String value) {
1694      return Thrown.of(value);
1695   }
1696
1697   /**
1698    * Creates a new {@link Thrown} header.
1699    *
1700    * @param value
1701    *    The header value.
1702    *    <br>Can be <jk>null</jk>.
1703    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1704    */
1705   public static final Thrown thrown(Throwable...value) {
1706      return Thrown.of(value);
1707   }
1708
1709   /**
1710    * Creates a new {@link Trailer} header.
1711    *
1712    * @param value
1713    *    The header value.
1714    *    <br>Can be <jk>null</jk>.
1715    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1716    */
1717   public static final Trailer trailer(String value) {
1718      return Trailer.of(value);
1719   }
1720
1721   /**
1722    * Creates a new {@link Trailer} header with a delayed value.
1723    *
1724    * <p>
1725    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1726    *
1727    * @param value
1728    *    The supplier of the header value.
1729    *    <br>Can be <jk>null</jk>.
1730    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1731    */
1732   public static final Trailer trailer(Supplier<String> value) {
1733      return Trailer.of(value);
1734   }
1735
1736   /**
1737    * Creates a new {@link TransferEncoding} header.
1738    *
1739    * @param value
1740    *    The header value.
1741    *    <br>Can be <jk>null</jk>.
1742    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1743    */
1744   public static final TransferEncoding transferEncoding(String value) {
1745      return TransferEncoding.of(value);
1746   }
1747
1748   /**
1749    * Creates a new {@link TransferEncoding} header with a delayed value.
1750    *
1751    * <p>
1752    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1753    *
1754    * @param value
1755    *    The supplier of the header value.
1756    *    <br>Can be <jk>null</jk>.
1757    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1758    */
1759   public static final TransferEncoding transferEncoding(Supplier<String> value) {
1760      return TransferEncoding.of(value);
1761   }
1762
1763   /**
1764    * Creates a new {@link Upgrade} header.
1765    *
1766    * @param value
1767    *    The header value.
1768    *    <br>Can be <jk>null</jk>.
1769    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1770    */
1771   public static final Upgrade upgrade(String value) {
1772      return Upgrade.of(value);
1773   }
1774
1775   /**
1776    * Creates a new {@link Upgrade} header.
1777    *
1778    * @param value
1779    *    The header value.
1780    *    <br>Can be <jk>null</jk>.
1781    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1782    */
1783   public static final Upgrade upgrade(String...value) {
1784      return Upgrade.of(value);
1785   }
1786
1787   /**
1788    * Creates a new {@link Upgrade} header with a delayed value.
1789    *
1790    * <p>
1791    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1792    *
1793    * @param value
1794    *    The supplier of the header value.
1795    *    <br>Can be <jk>null</jk>.
1796    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1797    */
1798   public static final Upgrade upgrade(Supplier<String[]> value) {
1799      return Upgrade.of(value);
1800   }
1801
1802   /**
1803    * Creates a new {@link UserAgent} header.
1804    *
1805    * @param value
1806    *    The header value.
1807    *    <br>Can be <jk>null</jk>.
1808    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1809    */
1810   public static final UserAgent userAgent(String value) {
1811      return UserAgent.of(value);
1812   }
1813
1814   /**
1815    * Creates a new {@link UserAgent} header with a delayed value.
1816    *
1817    * <p>
1818    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1819    *
1820    * @param value
1821    *    The supplier of the header value.
1822    *    <br>Can be <jk>null</jk>.
1823    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1824    */
1825   public static final UserAgent userAgent(Supplier<String> value) {
1826      return UserAgent.of(value);
1827   }
1828
1829   /**
1830    * Creates a new {@link Vary} header.
1831    *
1832    * @param value
1833    *    The header value.
1834    *    <br>Can be <jk>null</jk>.
1835    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1836    */
1837   public static final Vary vary(String value) {
1838      return Vary.of(value);
1839   }
1840
1841   /**
1842    * Creates a new {@link Vary} header with a delayed value.
1843    *
1844    * <p>
1845    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1846    *
1847    * @param value
1848    *    The supplier of the header value.
1849    *    <br>Can be <jk>null</jk>.
1850    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1851    */
1852   public static final Vary vary(Supplier<String> value) {
1853      return Vary.of(value);
1854   }
1855
1856   /**
1857    * Creates a new {@link Via} header.
1858    *
1859    * @param value
1860    *    The header value.
1861    *    <br>Can be <jk>null</jk>.
1862    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1863    */
1864   public static final Via via(String value) {
1865      return Via.of(value);
1866   }
1867
1868   /**
1869    * Creates a new {@link Via} header.
1870    *
1871    * @param value
1872    *    The header value.
1873    *    <br>Can be <jk>null</jk>.
1874    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1875    */
1876   public static final Via via(String...value) {
1877      return Via.of(value);
1878   }
1879
1880   /**
1881    * Creates a new {@link Via} header with a delayed value.
1882    *
1883    * <p>
1884    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1885    *
1886    * @param value
1887    *    The supplier of the header value.
1888    *    <br>Can be <jk>null</jk>.
1889    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1890    */
1891   public static final Via via(Supplier<String[]> value) {
1892      return Via.of(value);
1893   }
1894
1895   /**
1896    * Creates a new {@link Warning} header.
1897    *
1898    * @param value
1899    *    The header value.
1900    *    <br>Can be <jk>null</jk>.
1901    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1902    */
1903   public static final Warning warning(String value) {
1904      return Warning.of(value);
1905   }
1906
1907   /**
1908    * Creates a new {@link Warning} header with a delayed value.
1909    *
1910    * <p>
1911    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1912    *
1913    * @param value
1914    *    The supplier of the header value.
1915    *    <br>Can be <jk>null</jk>.
1916    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1917    */
1918   public static final Warning warning(Supplier<String> value) {
1919      return Warning.of(value);
1920   }
1921
1922   /**
1923    * Creates a new {@link WwwAuthenticate} header.
1924    *
1925    * @param value
1926    *    The header value.
1927    *    <br>Can be <jk>null</jk>.
1928    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1929    */
1930   public static final WwwAuthenticate wwwAuthenticate(String value) {
1931      return WwwAuthenticate.of(value);
1932   }
1933
1934   /**
1935    * Creates a new {@link WwwAuthenticate} header with a delayed value.
1936    *
1937    * <p>
1938    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1939    *
1940    * @param value
1941    *    The supplier of the header value.
1942    *    <br>Can be <jk>null</jk>.
1943    * @return A new header bean, or <jk>null</jk> if the value is <jk>null</jk>.
1944    */
1945   public static final WwwAuthenticate wwwAuthenticate(Supplier<String> value) {
1946      return WwwAuthenticate.of(value);
1947   }
1948
1949   //-----------------------------------------------------------------------------------------------------------------
1950   // Custom headers
1951   //-----------------------------------------------------------------------------------------------------------------
1952
1953   /**
1954    * Creates a new {@link BasicBooleanHeader} header.
1955    *
1956    * @param name The header name.
1957    * @param value
1958    *    The header value.
1959    *    <br>Must be parsable by {@link Boolean#parseBoolean(String)}.
1960    *    <br>Can be <jk>null</jk>.
1961    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1962    */
1963   public static final BasicBooleanHeader booleanHeader(String name, String value) {
1964      return BasicBooleanHeader.of(name, value);
1965   }
1966
1967   /**
1968    * Creates a new {@link BasicBooleanHeader} header.
1969    *
1970    * @param name The header name.
1971    * @param value
1972    *    The header value.
1973    *    <br>Can be <jk>null</jk>.
1974    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1975    */
1976   public static final BasicBooleanHeader booleanHeader(String name, Boolean value) {
1977      return BasicBooleanHeader.of(name, value);
1978   }
1979
1980   /**
1981    * Creates a new {@link BasicBooleanHeader} header with a delayed value.
1982    *
1983    * <p>
1984    * Header value is re-evaluated on each call to {@link Header#getValue()}.
1985    *
1986    * @param name The header name.
1987    * @param value
1988    *    The supplier of the header value.
1989    *    <br>Can be <jk>null</jk>.
1990    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
1991    */
1992   public static final BasicBooleanHeader booleanHeader(String name, Supplier<Boolean> value) {
1993      return BasicBooleanHeader.of(name, value);
1994   }
1995
1996   /**
1997    * Creates a new {@link BasicCsvHeader} header.
1998    *
1999    * @param name The header name.
2000    * @param value
2001    *    The header value.
2002    *    <br>Must be a comma-delimited list.
2003    *    <br>Can be <jk>null</jk>.
2004    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2005    */
2006   public static final BasicCsvHeader csvHeader(String name, String value) {
2007      return BasicCsvHeader.of(name, value);
2008   }
2009
2010   /**
2011    * Creates a new {@link BasicCsvHeader} header.
2012    *
2013    * @param name The header name.
2014    * @param value
2015    *    The header value.
2016    *    <br>Can be <jk>null</jk>.
2017    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2018    */
2019   public static final BasicCsvHeader csvHeader(String name, String...value) {
2020      return BasicCsvHeader.of(name, value);
2021   }
2022
2023   /**
2024    * Creates a new {@link BasicCsvHeader} header with a delayed value.
2025    *
2026    * <p>
2027    * Header value is re-evaluated on each call to {@link Header#getValue()}.
2028    *
2029    * @param name The header name.
2030    * @param value
2031    *    The supplier of the header value.
2032    *    <br>Can be <jk>null</jk>.
2033    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2034    */
2035   public static final BasicCsvHeader csvHeader(String name, Supplier<String[]> value) {
2036      return BasicCsvHeader.of(name, value);
2037   }
2038
2039   /**
2040    * Creates a new {@link BasicDateHeader} header.
2041    *
2042    * @param name The header name.
2043    * @param value
2044    *    The header value.
2045    *    <br>Must be an RFC-1123 formated string (e.g. <js>"Sat, 29 Oct 1994 19:43:31 GMT"</js>).
2046    *    <br>Can be <jk>null</jk>.
2047    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2048    */
2049   public static final BasicDateHeader dateHeader(String name, String value) {
2050      return BasicDateHeader.of(name, value);
2051   }
2052
2053   /**
2054    * Creates a new {@link BasicDateHeader} header.
2055    *
2056    * @param name The header name.
2057    * @param value
2058    *    The header value.
2059    *    <br>Can be <jk>null</jk>.
2060    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2061    */
2062   public static final BasicDateHeader dateHeader(String name, ZonedDateTime value) {
2063      return BasicDateHeader.of(name, value);
2064   }
2065
2066   /**
2067    * Creates a new {@link BasicDateHeader} header with a delayed value.
2068    *
2069    * <p>
2070    * Header value is re-evaluated on each call to {@link Header#getValue()}.
2071    *
2072    * @param name The header name.
2073    * @param value
2074    *    The supplier of the header value.
2075    *    <br>Can be <jk>null</jk>.
2076    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2077    */
2078   public static final BasicDateHeader dateHeader(String name, Supplier<ZonedDateTime> value) {
2079      return BasicDateHeader.of(name, value);
2080   }
2081
2082   /**
2083    * Creates a new {@link BasicEntityTagsHeader} header.
2084    *
2085    * @param name The header name.
2086    * @param value
2087    *    The header value.
2088    *    <br>Must be a comma-delimited list of entity validator values (e.g. <js>"\"xyzzy\", \"r2d2xxxx\", \"c3piozzzz\""</js>).
2089    *    <br>Can be <jk>null</jk>.
2090    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2091    */
2092   public static final BasicEntityTagsHeader entityTagsHeader(String name, String value) {
2093      return BasicEntityTagsHeader.of(name, value);
2094   }
2095
2096   /**
2097    * Creates a new {@link BasicEntityTagsHeader} header.
2098    *
2099    * @param name The header name.
2100    * @param value
2101    *    The header value.
2102    *    <br>Can be <jk>null</jk>.
2103    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2104    */
2105   public static final BasicEntityTagsHeader entityTagsHeader(String name, EntityTags value) {
2106      return BasicEntityTagsHeader.of(name, value);
2107   }
2108
2109   /**
2110    * Creates a new {@link BasicEntityTagsHeader} header with a delayed value.
2111    *
2112    * <p>
2113    * Header value is re-evaluated on each call to {@link Header#getValue()}.
2114    *
2115    * @param name The header name.
2116    * @param value
2117    *    The supplier of the header value.
2118    *    <br>Can be <jk>null</jk>.
2119    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2120    */
2121   public static final BasicEntityTagsHeader entityTagsHeader(String name, Supplier<EntityTags> value) {
2122      return BasicEntityTagsHeader.of(name, value);
2123   }
2124
2125   /**
2126    * Creates a new {@link BasicEntityTagHeader} header.
2127    *
2128    * @param name The header name.
2129    * @param value
2130    *    The header value.
2131    *    <br>Must be an entity tag value (e.g. <js>"\"xyzzy\""</js>).
2132    *    <br>Can be <jk>null</jk>.
2133    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2134    */
2135   public static final BasicEntityTagHeader entityTagHeader(String name, String value) {
2136      return BasicEntityTagHeader.of(name, value);
2137   }
2138
2139   /**
2140    * Creates a new {@link BasicEntityTagHeader} header.
2141    *
2142    * @param name The header name.
2143    * @param value
2144    *    The header value.
2145    *    <br>Can be <jk>null</jk>.
2146    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2147    */
2148   public static final BasicEntityTagHeader entityTagHeader(String name, EntityTag value) {
2149      return BasicEntityTagHeader.of(name, value);
2150   }
2151
2152   /**
2153    * Creates a new {@link BasicEntityTagHeader} header with a delayed value.
2154    *
2155    * <p>
2156    * Header value is re-evaluated on each call to {@link Header#getValue()}.
2157    *
2158    * @param name The header name.
2159    * @param value
2160    *    The supplier of the header value.
2161    *    <br>Can be <jk>null</jk>.
2162    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2163    */
2164   public static final BasicEntityTagHeader entityTagHeader(String name, Supplier<EntityTag> value) {
2165      return BasicEntityTagHeader.of(name, value);
2166   }
2167
2168   /**
2169    * Creates a new {@link BasicIntegerHeader} header.
2170    *
2171    * @param name The header name.
2172    * @param value
2173    *    The header value.
2174    *    <br>Must be parsable using {@link Integer#parseInt(String)}.
2175    *    <br>Can be <jk>null</jk>.
2176    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2177    */
2178   public static final BasicIntegerHeader integerHeader(String name, String value) {
2179      return BasicIntegerHeader.of(name, value);
2180   }
2181
2182   /**
2183    * Creates a new {@link BasicIntegerHeader} header.
2184    *
2185    * @param name The header name.
2186    * @param value
2187    *    The header value.
2188    *    <br>Can be <jk>null</jk>.
2189    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2190    */
2191   public static final BasicIntegerHeader integerHeader(String name, Integer value) {
2192      return BasicIntegerHeader.of(name, value);
2193   }
2194
2195   /**
2196    * Creates a new {@link BasicIntegerHeader} header with a delayed value.
2197    *
2198    * <p>
2199    * Header value is re-evaluated on each call to {@link Header#getValue()}.
2200    *
2201    * @param name The header name.
2202    * @param value
2203    *    The supplier of the header value.
2204    *    <br>Can be <jk>null</jk>.
2205    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2206    */
2207   public static final BasicIntegerHeader integerHeader(String name, Supplier<Integer> value) {
2208      return BasicIntegerHeader.of(name, value);
2209   }
2210
2211   /**
2212    * Creates a new {@link BasicLongHeader} header.
2213    *
2214    * @param name The header name.
2215    * @param value
2216    *    The header value.
2217    *    <br>Must be parsable by {@link Long#parseLong(String)}.
2218    *    <br>Can be <jk>null</jk>.
2219    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2220    */
2221   public static final BasicLongHeader longHeader(String name, String value) {
2222      return BasicLongHeader.of(name, value);
2223   }
2224
2225   /**
2226    * Creates a new {@link BasicLongHeader} header.
2227    *
2228    * @param name The header name.
2229    * @param value
2230    *    The header value.
2231    *    <br>Must be parsable by {@link Long#parseLong(String)}.
2232    *    <br>Can be <jk>null</jk>.
2233    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2234    */
2235   public static final BasicLongHeader longHeader(String name, Long value) {
2236      return BasicLongHeader.of(name, value);
2237   }
2238
2239   /**
2240    * Creates a new {@link BasicLongHeader} header with a delayed value.
2241    *
2242    * <p>
2243    * Header value is re-evaluated on each call to {@link Header#getValue()}.
2244    *
2245    * @param name The header name.
2246    * @param value
2247    *    The supplier of the header value.
2248    *    <br>Can be <jk>null</jk>.
2249    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2250    */
2251   public static final BasicLongHeader longHeader(String name, Supplier<Long> value) {
2252      return BasicLongHeader.of(name, value);
2253   }
2254
2255   /**
2256    * Creates a new {@link BasicMediaRangesHeader} header.
2257    *
2258    * @param name The header name.
2259    * @param value
2260    *    The header value.
2261    *    <br>Must be parsable by {@link MediaRanges#of(String)}.
2262    *    <br>Can be <jk>null</jk>.
2263    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2264    */
2265   public static final BasicMediaRangesHeader mediaRangesHeader(String name, String value) {
2266      return BasicMediaRangesHeader.of(name, value);
2267   }
2268
2269   /**
2270    * Creates a new {@link BasicMediaRangesHeader} header.
2271    *
2272    * @param name The header name.
2273    * @param value
2274    *    The header value.
2275    *    <br>Can be <jk>null</jk>.
2276    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2277    */
2278   public static final BasicMediaRangesHeader mediaRangesHeader(String name, MediaRanges value) {
2279      return BasicMediaRangesHeader.of(name, value);
2280   }
2281
2282   /**
2283    * Creates a new {@link BasicMediaRangesHeader} header with a delayed value.
2284    *
2285    * <p>
2286    * Header value is re-evaluated on each call to {@link Header#getValue()}.
2287    *
2288    * @param name The header name.
2289    * @param value
2290    *    The header value.
2291    *    <br>Must be parsable by {@link MediaRanges#of(String)}.
2292    *    <br>Can be <jk>null</jk>.
2293    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2294    */
2295   public static final BasicMediaRangesHeader mediaRangesHeader(String name, Supplier<MediaRanges> value) {
2296      return value == null ? null : new BasicMediaRangesHeader(name, value);
2297   }
2298
2299   /**
2300    * Creates a new {@link BasicMediaTypeHeader} header.
2301    *
2302    * @param name The header name.
2303    * @param value
2304    *    The header value.
2305    *    <br>Must be parsable by {@link MediaType#of(String)}.
2306    *    <br>Can be <jk>null</jk>.
2307    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2308    */
2309   public static final BasicMediaTypeHeader mediaTypeHeader(String name, String value) {
2310      return BasicMediaTypeHeader.of(name, value);
2311   }
2312
2313   /**
2314    * Creates a new {@link BasicMediaTypeHeader} header.
2315    *
2316    * @param name The header name.
2317    * @param value
2318    *    The header value.
2319    *    <br>Can be <jk>null</jk>.
2320    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2321    */
2322   public static final BasicMediaTypeHeader mediaTypeHeader(String name, MediaType value) {
2323      return BasicMediaTypeHeader.of(name, value);
2324   }
2325
2326   /**
2327    * Creates a new {@link BasicMediaTypeHeader} header with a delayed value.
2328    *
2329    * <p>
2330    * Header value is re-evaluated on each call to {@link Header#getValue()}.
2331    *
2332    * @param name The header name.
2333    * @param value
2334    *    The header value.
2335    *    <br>Can be <jk>null</jk>.
2336    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2337    */
2338   public static final BasicMediaTypeHeader mediaTypeHeader(String name, Supplier<MediaType> value) {
2339      return value == null ? null : new BasicMediaTypeHeader(name, value);
2340   }
2341
2342   /**
2343    * Creates a {@link BasicHeader} from a name/value pair string (e.g. <js>"Foo: bar"</js>)
2344    *
2345    * @param pair The pair string.
2346    * @return A new header bean, or <jk>null</jk> if the value was <jk>null</jk>.
2347    */
2348   public static final BasicStringHeader stringHeader(String pair) {
2349      return BasicStringHeader.ofPair(pair);
2350   }
2351
2352   /**
2353    * Creates a new {@link BasicHeader} header.
2354    *
2355    * @param name The parameter name.
2356    * @param value
2357    *    The parameter value.
2358    *    <br>Can be <jk>null</jk>.
2359    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2360    */
2361   public static final BasicHeader basicHeader(String name, Object value) {
2362      return BasicHeader.of(name, value);
2363   }
2364
2365   /**
2366    * Creates a new {@link BasicHeader} header with a delayed value.
2367    *
2368    * <p>
2369    * Header value is re-evaluated on each call to {@link Header#getValue()}.
2370    *
2371    * @param name The header name.
2372    * @param value
2373    *    The supplier of the header value.
2374    *    <br>Can be <jk>null</jk>.
2375    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2376    * */
2377   public static final BasicHeader basicHeader(String name, Supplier<?> value) {
2378      return new BasicHeader(name, value);
2379   }
2380
2381   /**
2382    * Creates a new {@link SerializedHeader} header.
2383    *
2384    * @param name The header name.
2385    * @param value
2386    *    The POJO to serialize as the header value.
2387    *    <br>Can be <jk>null</jk>.
2388    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty.
2389    */
2390   public static final SerializedHeader serializedHeader(String name, Object value) {
2391      return SerializedHeader.of(name, value);
2392   }
2393
2394   /**
2395    * Creates a new {@link SerializedHeader} header.
2396    *
2397    * @param name The HTTP header name name.
2398    * @param value
2399    *    The POJO to serialize as the header value.
2400    * @param serializer
2401    *    The serializer to use for serializing the value to a string value.
2402    * @param schema
2403    *    The schema object that defines the format of the output.
2404    *    <br>If <jk>null</jk>, defaults to the schema defined on the serializer.
2405    *    <br>If that's also <jk>null</jk>, defaults to {@link HttpPartSchema#DEFAULT}.
2406    *    <br>Only used if serializer is schema-aware (e.g. {@link OpenApiSerializer}).
2407    *    <br>Can also be a {@link Supplier}.
2408    * @param skipIfEmpty If value is a blank string, the value should return as <jk>null</jk>.
2409    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty.
2410    */
2411   public static SerializedHeader serializedHeader(String name, Object value, HttpPartSerializerSession serializer, HttpPartSchema schema, boolean skipIfEmpty) {
2412      return SerializedHeader.of(name, value, serializer, schema, skipIfEmpty);
2413   }
2414
2415   /**
2416    * Creates a new {@link SerializedHeader} header.
2417    *
2418    * <p>
2419    * Header value is re-evaluated on each call to {@link Header#getValue()}.
2420    *
2421    * @param name The HTTP header name name.
2422    * @param value
2423    *    The supplier of the POJO to serialize as the header value.
2424    * @param serializer
2425    *    The serializer to use for serializing the value to a string value.
2426    * @param schema
2427    *    The schema object that defines the format of the output.
2428    *    <br>If <jk>null</jk>, defaults to the schema defined on the serializer.
2429    *    <br>If that's also <jk>null</jk>, defaults to {@link HttpPartSchema#DEFAULT}.
2430    *    <br>Only used if serializer is schema-aware (e.g. {@link OpenApiSerializer}).
2431    *    <br>Can also be a {@link Supplier}.
2432    * @param skipIfEmpty If value is a blank string, the value should return as <jk>null</jk>.
2433    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty.
2434    */
2435   public static SerializedHeader serializedHeader(String name, Supplier<?> value, HttpPartSerializerSession serializer, HttpPartSchema schema, boolean skipIfEmpty) {
2436      return SerializedHeader.of(name, value, serializer, schema, skipIfEmpty);
2437   }
2438
2439   /**
2440    * Creates a new {@link SerializedHeader} header with a delayed value.
2441    *
2442    * <p>
2443    * Header value is re-evaluated on each call to {@link Header#getValue()}.
2444    *
2445    * @param name The header name.
2446    * @param value
2447    *    The supplier of the POJO to serialize as the header value.
2448    *    <br>Can be <jk>null</jk>.
2449    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty.
2450    */
2451   public static final SerializedHeader serializedHeader(String name, Supplier<?> value) {
2452      return SerializedHeader.of(name, value);
2453   }
2454
2455   /**
2456    * Creates a new {@link BasicStringHeader} header.
2457    *
2458    * @param name The header name.
2459    * @param value
2460    *    The header value.
2461    *    <br>Can be <jk>null</jk>.
2462    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2463    */
2464   public static final BasicStringHeader stringHeader(String name, String value) {
2465      return BasicStringHeader.of(name, value);
2466   }
2467
2468   /**
2469    * Creates a new {@link BasicStringHeader} header with a delayed value.
2470    *
2471    * <p>
2472    * Header value is re-evaluated on each call to {@link Header#getValue()}.
2473    *
2474    * @param name The header name.
2475    * @param value
2476    *    The supplier of the header value.
2477    *    <br>Can be <jk>null</jk>.
2478    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2479    */
2480   public static final BasicStringHeader stringHeader(String name, Supplier<String> value) {
2481      return BasicStringHeader.of(name, value);
2482   }
2483
2484   /**
2485    * Creates a new {@link BasicStringRangesHeader} header.
2486    *
2487    * @param name The header name.
2488    * @param value
2489    *    The header value.
2490    *    <br>Must be parsable by {@link StringRanges#of(String)}.
2491    *    <br>Can be <jk>null</jk>.
2492    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2493    */
2494   public static final BasicStringRangesHeader stringRangesHeader(String name, String value) {
2495      return BasicStringRangesHeader.of(name, value);
2496   }
2497
2498   /**
2499    * Creates a new {@link BasicStringRangesHeader} header.
2500    *
2501    * @param name The header name.
2502    * @param value
2503    *    The header value.
2504    *    <br>Can be <jk>null</jk>.
2505    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2506    */
2507   public static final BasicStringRangesHeader stringRangesHeader(String name, StringRanges value) {
2508      return BasicStringRangesHeader.of(name, value);
2509   }
2510
2511   /**
2512    * Creates a new {@link BasicStringRangesHeader} header with a delayed value.
2513    *
2514    * <p>
2515    * Header value is re-evaluated on each call to {@link Header#getValue()}.
2516    *
2517    * @param name The header name.
2518    * @param value
2519    *    The supplier of the header value.
2520    *    <br>Can be <jk>null</jk>.
2521    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2522    */
2523   public static final BasicStringRangesHeader stringRangesHeader(String name, Supplier<StringRanges> value) {
2524      return BasicStringRangesHeader.of(name, value);
2525   }
2526
2527   /**
2528    * Creates a new {@link BasicUriHeader} header.
2529    *
2530    * @param name The header name.
2531    * @param value
2532    *    The header value.
2533    *    <br>Must be parsable by {@link URI#create(String)}.
2534    *    <br>Can be <jk>null</jk>.
2535    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2536    */
2537   public static final BasicUriHeader uriHeader(String name, String value) {
2538      return BasicUriHeader.of(name, value);
2539   }
2540
2541   /**
2542    * Creates a new {@link BasicUriHeader} header.
2543    *
2544    * @param name The header name.
2545    * @param value
2546    *    The header value.
2547    *    <br>Can be <jk>null</jk>.
2548    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2549    */
2550   public static final BasicUriHeader uriHeader(String name, URI value) {
2551      return BasicUriHeader.of(name, value);
2552   }
2553
2554   /**
2555    * Creates a new {@link BasicUriHeader} header with a delayed value.
2556    *
2557    * <p>
2558    * Header value is re-evaluated on each call to {@link Header#getValue()}.
2559    *
2560    * @param name The header name.
2561    * @param value
2562    *    The supplier of the header value.
2563    *    <br>Can be <jk>null</jk>.
2564    * @return A new header bean, or <jk>null</jk> if the name is <jk>null</jk> or empty or the value is <jk>null</jk>.
2565    */
2566   public static final BasicUriHeader uriHeader(String name, Supplier<URI> value) {
2567      return BasicUriHeader.of(name, value);
2568   }
2569
2570   /**
2571    * Creates a new {@link Header} of the specified type.
2572    *
2573    * <p>
2574    * The implementation class must have a public constructor taking in one of the following argument lists:
2575    * <ul>
2576    *    <li><c><jk>public</jk> X(String <jv>headerValue</jv>)</c>
2577    *    <li><c><jk>public</jk> X(Object <jv>headerValue</jv>)</c>
2578    *    <li><c><jk>public</jk> X(String <jv>headerName</jv>, String <jv>headerValue</jv>)</c>
2579    *    <li><c><jk>public</jk> X(String <jv>headerName</jv>, Object <jv>headerValue</jv>)</c>
2580    * </ul>
2581    *
2582    * @param <T> The header implementation class.
2583    * @param type The header implementation class.
2584    * @param name The header name.
2585    * @param value The header value.
2586    * @return A new unmodifiable instance, never <jk>null</jk>.
2587    */
2588   public static final <T extends Header> T header(Class<T> type, String name, Object value) {
2589      return HeaderBeanMeta.of(type).construct(name, value);
2590   }
2591
2592   /**
2593    * Creates a new {@link Header} of the specified type.
2594    *
2595    * <p>
2596    * Same as {@link #header(Class, String, Object)} but the header name is pulled from the {@link org.apache.juneau.http.annotation.Header#name() @Header(name)} or
2597    *    {@link org.apache.juneau.http.annotation.Header#value() @Header(value)} annotations.
2598    *
2599    * @param <T> The header implementation class.
2600    * @param type The header implementation class.
2601    * @param value The header value.
2602    * @return A new unmodifiable instance, never <jk>null</jk>.
2603    */
2604   public static final <T extends Header> T header(Class<T> type, Object value) {
2605      return HeaderBeanMeta.of(type).construct(null, value);
2606   }
2607
2608   /**
2609    * Instantiates a new {@link org.apache.juneau.http.header.HeaderList}.
2610    *
2611    * @return A new empty builder.
2612    */
2613   public static final HeaderList headerList() {
2614      return HeaderList.create();
2615   }
2616
2617   /**
2618    * Creates a new {@link HeaderList} initialized with the specified headers.
2619    *
2620    * @param headers The headers to add to the list.  Can be <jk>null</jk>.  <jk>null</jk> entries are ignored.
2621    * @return A new unmodifiable instance, never <jk>null</jk>.
2622    */
2623   public static final HeaderList headerList(List<Header> headers) {
2624      return HeaderList.of(headers);
2625   }
2626
2627   /**
2628    * Creates a new {@link HeaderList} initialized with the specified headers.
2629    *
2630    * @param headers The headers to add to the list.  <jk>null</jk> entries are ignored.
2631    * @return A new unmodifiable instance, never <jk>null</jk>.
2632    */
2633   public static final HeaderList headerList(Header...headers) {
2634      return HeaderList.of(headers);
2635   }
2636
2637   /**
2638    * Creates a new {@link HeaderList} initialized with the specified name/value pairs.
2639    *
2640    * @param pairs
2641    *    Initial list of pairs.
2642    *    <br>Must be an even number of parameters representing key/value pairs.
2643    * @throws RuntimeException If odd number of parameters were specified.
2644    * @return A new instance.
2645    */
2646   public static HeaderList headerList(String...pairs) {
2647      return HeaderList.ofPairs(pairs);
2648   }
2649
2650   //-----------------------------------------------------------------------------------------------------------------
2651   // Utility methods
2652   //-----------------------------------------------------------------------------------------------------------------
2653
2654   /**
2655    * Returns <jk>true</jk> if the {@link #cast(Object)} method can be used on the specified object.
2656    *
2657    * @param o The object to check.
2658    * @return <jk>true</jk> if the {@link #cast(Object)} method can be used on the specified object.
2659    */
2660   public static boolean canCast(Object o) {
2661      ClassInfo ci = ClassInfo.of(o);
2662      return ci != null && ci.isChildOfAny(Header.class, Headerable.class, NameValuePair.class, NameValuePairable.class, Map.Entry.class);
2663   }
2664
2665   /**
2666    * Utility method for converting an arbitrary object to a {@link Header}.
2667    *
2668    * @param o
2669    *    The object to cast or convert to a {@link Header}.
2670    * @return Either the same object cast as a {@link Header} or converted to a {@link Header}.
2671    */
2672   @SuppressWarnings("rawtypes")
2673   public static Header cast(Object o) {
2674      if (o instanceof Header)
2675         return (Header)o;
2676      if (o instanceof Headerable)
2677         return ((Headerable)o).asHeader();
2678      if (o instanceof NameValuePair)
2679         return BasicHeader.of((NameValuePair)o);
2680      if (o instanceof NameValuePairable)
2681         return BasicHeader.of(((NameValuePairable)o).asNameValuePair());
2682      if (o instanceof Map.Entry) {
2683         Map.Entry e = (Map.Entry)o;
2684         return BasicHeader.of(Utils.s(e.getKey()), Utils.s(e.getValue()));
2685      }
2686      throw new BasicRuntimeException("Object of type {0} could not be converted to a Header.", className(o));
2687   }
2688}