コード例 #1
0
  /**
   * This is used to acquire all the individual header values from the message. The header values
   * provided by this are unparsed and represent the actual string values that have been added to
   * the message keyed by a given header name.
   *
   * @param name the name of the header to get the values for
   * @param token this provides a lower case version of the header
   * @return this returns a list of the values for the header name
   */
  private List<String> getAll(String name, String token) {
    Series series = new Series();
    String value = names.get(token);

    if (value == null) {
      names.put(token, name);
    }
    values.put(token, series);

    return series.getValues();
  }
コード例 #2
0
  /**
   * The <code>setCookie</code> method is used to set a cookie value with the cookie name. This will
   * add a cookie to the response stored under the name of the cookie, when this is committed it
   * will be added as a Set-Cookie header to the resulting response.
   *
   * @param cookie this is the cookie to be added to the response
   * @return returns the cookie that has been set in the response
   */
  public Cookie setCookie(Cookie cookie) {
    String name = cookie.getName();

    if (name != null) {
      cookies.put(name, cookie);
    }
    return cookie;
  }