View Javadoc

1   /*
2    * Copyright 2012 The Netty Project
3    *
4    * The Netty Project licenses this file to you under the Apache License,
5    * version 2.0 (the "License"); you may not use this file except in compliance
6    * with the License. You may obtain a copy of the License at:
7    *
8    *   http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
12   * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
13   * License for the specific language governing permissions and limitations
14   * under the License.
15   */
16  package io.netty.handler.codec.http;
17  
18  import io.netty.handler.codec.http.cookie.ClientCookieDecoder;
19  
20  /**
21   * Encodes client-side {@link Cookie}s into an HTTP header value.  This encoder can encode
22   * the HTTP cookie version 0, 1, and 2.
23   * <pre>
24   * // Example
25   * {@link HttpRequest} req = ...;
26   * res.setHeader("Cookie", {@link ClientCookieEncoder}.encode("JSESSIONID", "1234"));
27   * </pre>
28   *
29   * @see CookieDecoder
30   * @deprecated Use {@link io.netty.handler.codec.http.cookie.ClientCookieEncoder} instead.
31   */
32  @Deprecated
33  public final class ClientCookieEncoder {
34  
35      /**
36       * Encodes the specified cookie into an HTTP header value.
37       */
38      @Deprecated
39      public static String encode(String name, String value) {
40          return io.netty.handler.codec.http.cookie.ClientCookieEncoder.LAX.encode(name, value);
41      }
42  
43      @Deprecated
44      public static String encode(Cookie cookie) {
45          return io.netty.handler.codec.http.cookie.ClientCookieEncoder.LAX.encode(cookie);
46      }
47  
48      @Deprecated
49      public static String encode(Cookie... cookies) {
50          return io.netty.handler.codec.http.cookie.ClientCookieEncoder.LAX.encode(cookies);
51      }
52  
53      @Deprecated
54      public static String encode(Iterable<Cookie> cookies) {
55          return io.netty.handler.codec.http.cookie.ClientCookieEncoder.LAX.encode(cookies);
56      }
57  
58      private ClientCookieEncoder() {
59          // Unused
60      }
61  }