CookiePolicyHandler.java
上传用户:demmber
上传日期:2007-12-22
资源大小:717k
文件大小:3k
源码类别:

Java编程

开发平台:

Java

  1. /*
  2.  * @(#)CookiePolicyHandler.java 0.3-3 06/05/2001
  3.  *
  4.  *  This file is part of the HTTPClient package
  5.  *  Copyright (C) 1996-2001 Ronald Tschal鋜
  6.  *
  7.  *  This library is free software; you can redistribute it and/or
  8.  *  modify it under the terms of the GNU Lesser General Public
  9.  *  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.  *  The HTTPClient's home page is located at:
  28.  *
  29.  *  http://www.innovation.ch/java/HTTPClient/ 
  30.  *
  31.  */
  32. package HTTPClient;
  33. /**
  34.  * This is the interface that a cookie policy handler must implement. A
  35.  * policy handler allows you to control which cookies are accepted and
  36.  * which are sent.
  37.  *
  38.  * @see HTTPClient.CookieModule#setCookiePolicyHandler(HTTPClient.CookiePolicyHandler)
  39.  * @version 0.3-3  06/05/2001
  40.  * @author Ronald Tschal鋜
  41.  * @since V0.3
  42.  */
  43. public interface CookiePolicyHandler
  44. {
  45.     /**
  46.      * This method is called for each cookie that a server tries to set via
  47.      * the Set-Cookie header. This enables you to implement your own
  48.      * cookie acceptance policy.
  49.      *
  50.      * @param cookie the cookie in question
  51.      * @param req    the request sent which prompted the response
  52.      * @param resp   the response which is trying to set the cookie
  53.      * @return true if this cookie should be accepted, false if it is to
  54.      *         be rejected.
  55.      */
  56.     boolean acceptCookie(Cookie cookie, RoRequest req, RoResponse resp);
  57.     /**
  58.      * This method is called for each cookie that is eligible for sending
  59.      * with a request (according to the matching rules for the path, domain,
  60.      * protocol, etc). This enables you to control the sending of cookies.
  61.      *
  62.      * @param cookie the cookie in question
  63.      * @param req    the request this cookie is to be sent with
  64.      * @return true if this cookie should be sent, false if it is to be
  65.      *         ignored.
  66.      */
  67.     boolean sendCookie(Cookie cookie, RoRequest req);
  68. }