Source code: com/sonalb/net/http/cookie/CookieParser.java
1 /*
2 * -*- mode: java; c-basic-indent: 4; indent-tabs-mode: nil -*-
3 * :indentSize=4:noTabs=true:tabSize=4:indentOnTab=true:indentOnEnter=true:mode=java:
4 * ex: set tabstop=4 expandtab:
5 *
6 * MrPostman - webmail <-> email gateway
7 * Copyright (C) 2002-2003 MrPostman Development Group
8 * Projectpage: http://mrbook.org/mrpostman/
9 *
10 *
11 * This program is free software; you can redistribute it and/or modify
12 * it under the terms of the GNU General Public License as published by
13 * the Free Software Foundation; either version 2 of the License, or
14 * (at your option) any later version.
15 *
16 * This program is distributed in the hope that it will be useful,
17 * but WITHOUT ANY WARRANTY; without even the implied warranty of
18 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19 * GNU General Public License for more details.
20 * In particular, this implies that users are responsible for
21 * using MrPostman after reading the terms and conditions given
22 * by their web-mail provider.
23 *
24 * You should have received a copy of the GNU General Public License
25 * Named LICENSE in the base directory of this distribution,
26 * if not, write to the Free Software
27 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
28 */
29
30 package com.sonalb.net.http.cookie;
31
32 import com.sonalb.net.http.Header;
33
34 import java.net.URL;
35
36
37 /**
38 * Interface definition for cookie-parsing and specification implementations.
39 *
40 * @see Client#setCookieParser(CookieParser)
41 * @author Sonal Bansal
42 */
43 public interface CookieParser {
44 /**
45 * Converts the <code>Cookie</code>s in the <code>CookieJar</code>
46 * to a set of headers suitable to be sent along with an HTTP request.
47 */
48 public Header getCookieHeaders(CookieJar cj);
49
50 /**
51 * Checks whether a request to the given URL is allowed to return
52 * the specified Cookie.
53 */
54 public boolean allowedCookie(Cookie c, URL url);
55
56 /**
57 * Converts the headers in an HTTP response into a <code>CookieJar</code>
58 * of <code>Cookie</code> objects.
59 */
60 public CookieJar parseCookies(Header h, URL url) throws MalformedCookieException;
61
62 /**
63 * Checks whether the given Cookie can be sent alongwith a request for
64 * the given URL.
65 */
66 public boolean sendCookieWithURL(Cookie c, URL url, boolean bRespectExpires);
67 }