1   package com.atlassian.seraph.cookie;
2   
3   import javax.servlet.http.HttpServletRequest;
4   import javax.servlet.http.HttpServletResponse;
5   import javax.servlet.http.Cookie;
6   
7   /**
8    * Handles basic cookie tasks
9    *
10   * @deprecated replaced by the {@link com.atlassian.seraph.service.rememberme.RememberMeService} code
11   */
12  public interface CookieHandler
13  {
14      /**
15       * Invalidate the specified cookie and delete it from the response object.
16       *
17       * @param response The HttpServletResponse object, known as "response" in a JSP page.
18       * @param cookieName The name of the cookie you want to delete.
19       * @param path of the path the cookie you want to delete.
20       */
21      public void invalidateCookie(HttpServletRequest request, HttpServletResponse response, String cookieName, String path);
22  
23  
24      /**
25       * Returns the specified Cookie object, or null if the cookie does not exist.
26       *
27       * @param request The HttpServletRequest object, known as "request" in a
28       *      JSP page.
29       * @param name the name of the cookie.
30       * @return the Cookie object if it exists, otherwise null.
31       */
32      public Cookie getCookie(HttpServletRequest request, String name);
33  
34  
35      /**
36       * Sets a cookie
37       *
38       * This will also put the cookie in a list of cookies to send with this request's response
39       * (so that in case of a redirect occurring down the chain, the first filter
40       * will always try to set this cookie again)
41       *
42       * The cookie secure flag is set if the request is secure.
43       */
44      public Cookie setCookie(HttpServletRequest request, HttpServletResponse response, String name, String value, int maxAge, String path);
45  
46  
47      /**
48       * Returns the value of the specified cookie as a String. If the cookie
49       * does not exist, the method returns null.
50       *
51       * @param request the HttpServletRequest object, known as "request" in a
52       *      JSP page.
53       * @param name the name of the cookie
54       * @return the value of the cookie, or null if the cookie does not exist.
55       */
56      public String getCookieValue(HttpServletRequest request, String name);
57  
58  }