1 /* 2 * @(#)FilenameMangler.java 0.3-2 18/06/1999 3 * 4 * This file is part of the HTTPClient package 5 * Copyright (C) 1996-1999 Ronald Tschalär 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 */ 28 29 package HTTPClient; 30 31 32 /** 33 * HTTPClient.Codecs.mpFormDataDecode() and HTTPClient.Codecs.mpFormDataEncode() 34 * may be handed class which implements this interface in order to control 35 * names of the decoded files or the names sent in the encoded data. 36 * 37 * @version 0.3-2 18/06/1999 38 * @author Ronald Tschalär 39 * @since V0.3-1 40 */ 41 public interface FilenameMangler 42 { 43 /** 44 * This is invoked by Codecs.mpFormDataDecode() for each file found in 45 * the data, just before the file is created and written. If null is 46 * returned then the file is not created or written. This allows you to 47 * control which files are written and the names of the resulting files. 48 * 49 * <P>For Codecs.mpFormDataEncode() this is also invoked on each filename, 50 * allowing you to control the actual name used in the <var>filename</var> 51 * attribute of the Content-Disposition header. This does not change the 52 * name of the file actually read. If null is returned then the file is 53 * ignored. 54 * 55 * @param filename the original filename in the Content-Disposition header 56 * @param fieldname the name of the this field, i.e. the value of the 57 * <var>name</var> attribute in Content-Disposition 58 * header 59 * @return the new file name, or null if the file is to be ignored. 60 */ 61 public String mangleFilename(String filename, String fieldname); 62 } 63 64