/** * Formats an array of header elements. * * @param elems the header elements to format * @param quote <code>true</code> to always format with quoted values, <code>false</code> to use * quotes only when necessary * @param formatter the formatter to use, or <code>null</code> for the {@link #DEFAULT default} * @return the formatted header elements */ public static final String formatElements( final HeaderElement[] elems, final boolean quote, HeaderValueFormatter formatter) { if (formatter == null) formatter = BasicHeaderValueFormatter.DEFAULT; return formatter.formatElements(null, elems, quote).toString(); }
/** * Formats a name-value pair. * * @param nvp the name-value pair to format * @param quote <code>true</code> to always format with a quoted value, <code>false</code> to use * quotes only when necessary * @param formatter the formatter to use, or <code>null</code> for the {@link #DEFAULT default} * @return the formatted name-value pair */ public static final String formatNameValuePair( final NameValuePair nvp, final boolean quote, HeaderValueFormatter formatter) { if (formatter == null) formatter = BasicHeaderValueFormatter.DEFAULT; return formatter.formatNameValuePair(null, nvp, quote).toString(); }