private void doSetHeader(RuntimeDelegate rd, String name, Object value) {
   HeaderDelegate<Object> hd = HttpUtils.getHeaderDelegate(rd, value);
   if (hd != null) {
     value = hd.toString(value);
   }
   webClient.header(name, value);
 }
Example #2
0
  /**
   * Convert a header value, represented as a general object, to the string value.
   *
   * <p>This method defers to {@link RuntimeDelegate#createHeaderDelegate} to obtain a {@link
   * HeaderDelegate} to convert the value to a string. If a {@link HeaderDelegate} is not found then
   * the <code>toString</code> is utilized.
   *
   * @param headerValue the header value as an object
   * @return the string value
   */
  public static String getHeaderValue(Object headerValue) {
    HeaderDelegate hp = rd.createHeaderDelegate(headerValue.getClass());

    return (hp != null) ? hp.toString(headerValue) : headerValue.toString();
  }
Example #3
0
 /**
  * Convert the cookie to a string suitable for use as the value of the corresponding HTTP header.
  *
  * @return a stringified cookie
  */
 @Override
 public String toString() {
   return delegate.toString(this);
 }