01: /*
02: * @(#)CookiePolicyHandler.java 0.3-2 18/06/1999
03: *
04: * This file is part of the HTTPClient package
05: * Copyright (C) 1996-1999 Ronald Tschalär
06: *
07: * This library is free software; you can redistribute it and/or
08: * modify it under the terms of the GNU Lesser General Public
09: * License as published by the Free Software Foundation; either
10: * version 2 of the License, or (at your option) any later version.
11: *
12: * This library is distributed in the hope that it will be useful,
13: * but WITHOUT ANY WARRANTY; without even the implied warranty of
14: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15: * Lesser General Public License for more details.
16: *
17: * You should have received a copy of the GNU Lesser General Public
18: * License along with this library; if not, write to the Free
19: * Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
20: * MA 02111-1307, USA
21: *
22: * For questions, suggestions, bug-reports, enhancement-requests etc.
23: * I may be contacted at:
24: *
25: * ronald@innovation.ch
26: *
27: */
28:
29: package HTTPClient;
30:
31: /**
32: * This is the interface that a cookie policy handler must implement. A
33: * policy handler allows you to control which cookies are accepted and
34: * which are sent.
35: *
36: * @see HTTPClient.CookieModule#setCookiePolicyHandler(HTTPClient.CookiePolicyHandler)
37: * @version 0.3-2 18/06/1999
38: * @author Ronald Tschalär
39: * @since V0.3
40: */
41:
42: public interface CookiePolicyHandler {
43: /**
44: * This method is called for each cookie that a server tries to set via
45: * the Set-Cookie header. This enables you to implement your own
46: * cookie acceptance policy.
47: *
48: * @param cookie the cookie in question
49: * @param req the request sent which prompted the response
50: * @param resp the response which is trying to set the cookie
51: * @return true if this cookie should be accepted, false if it is to
52: * be rejected.
53: */
54: boolean acceptCookie(Cookie cookie, RoRequest req, RoResponse resp);
55:
56: /**
57: * This method is called for each cookie that is eligible for sending
58: * with a request (according to the matching rules for the path, domain,
59: * protocol, etc). This enables you to control the sending of cookies.
60: *
61: * @param cookie the cookie in question
62: * @param req the request this cookie is to be sent with
63: * @return true if this cookie should be sent, false if it is to be
64: * ignored.
65: */
66: boolean sendCookie(Cookie cookie, RoRequest req);
67: }
|