예제 #1
0
 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);
 }
예제 #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();
  }
예제 #3
0
 /**
  * Creates a new instance of Cookie by parsing the supplied string.
  *
  * @param value the cookie string
  * @return the newly created Cookie
  * @throws IllegalArgumentException if the supplied string cannot be parsed or is null
  */
 public static Cookie valueOf(String value) throws IllegalArgumentException {
   return delegate.fromString(value);
 }
예제 #4
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);
 }