1 // HTMLParser Library $Name: v1_5_20050313 $ - A java-based parser for HTML 2 // http://sourceforge.org/projects/htmlparser 3 // Copyright (C) 2004 Derrick Oswald 4 // 5 // Revision Control Information 6 // 7 // $Source: /cvsroot/htmlparser/htmlparser/src/org/htmlparser/http/ConnectionMonitor.java,v $ 8 // $Author: derrickoswald $ 9 // $Date: 2004/09/02 02:28:15 $ 10 // $Revision: 1.1 $ 11 // 12 // This library is free software; you can redistribute it and/or 13 // modify it under the terms of the GNU Lesser General Public 14 // License as published by the Free Software Foundation; either 15 // version 2.1 of the License, or (at your option) any later version. 16 // 17 // This library is distributed in the hope that it will be useful, 18 // but WITHOUT ANY WARRANTY; without even the implied warranty of 19 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 20 // Lesser General Public License for more details. 21 // 22 // You should have received a copy of the GNU Lesser General Public 23 // License along with this library; if not, write to the Free Software 24 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 25 // 26 27 package org.htmlparser.http; 28 29 import java.net.HttpURLConnection; 30 31 import org.htmlparser.util.ParserException; 32 33 /** 34 * Interface for HTTP connection notification callbacks. 35 */ 36 public interface ConnectionMonitor 37 { 38 /** 39 * Called just prior to calling connect. 40 * The connection has been conditioned with proxy, URL user/password, 41 * and cookie information. It is still possible to adjust the 42 * connection, to alter the request method for example. 43 * @param connection The connection which is about to be connected. 44 * @exception This exception is thrown if the connection monitor 45 * wants the ConnectionManager to bail out. 46 */ 47 void preConnect (HttpURLConnection connection) 48 throws 49 ParserException; 50 51 /** Called just after calling connect. 52 * The response code and header fields can be examined. 53 * @param connection The connection that was just connected. 54 * @exception This exception is thrown if the connection monitor 55 * wants the ConnectionManager to bail out. 56 */ 57 void postConnect (HttpURLConnection connection) 58 throws 59 ParserException; 60 } 61