3 * Copyright (C) 2006 David Roden
5 * This program is free software; you can redistribute it and/or modify
6 * it under the terms of the GNU General Public License as published by
7 * the Free Software Foundation; either version 2 of the License, or
8 * (at your option) any later version.
10 * This program is distributed in the hope that it will be useful,
11 * but WITHOUT ANY WARRANTY; without even the implied warranty of
12 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 * GNU General Public License for more details.
15 * You should have received a copy of the GNU General Public License
16 * along with this program; if not, write to the Free Software
17 * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
20 package de.todesbaum.util.freenet.fcp2;
22 import java.io.IOException;
23 import java.io.Writer;
26 * Abstract base class for all put requests that insert a directory.
28 * @author David Roden <droden@gmail.com>
31 public class ClientPutDir extends ClientPut {
33 /** The default file of the directory. */
34 protected String defaultName;
37 * Creates a new request with the specified name, identifier, and URI.
40 * The name of the request
42 * The identifier of the request
44 * The URI of the request
46 public ClientPutDir(String name, String identifier, String uri) {
47 super(name, identifier, uri);
51 * Returns the default name of the directory.
53 * @return The default name of the directory
55 public String getDefaultName() {
60 * Sets the default name of the directory. The default name of a directory
61 * is the name of the file that will be delivered if the directory was
62 * requested without a filename. It's about the same as the
63 * <code>index.html</code> file that gets delivered if you only request a
64 * directory from a webserver.
67 * The default name of the directory
69 public void setDefaultName(String defaultName) {
70 this.defaultName = defaultName;
77 protected void write(Writer writer) throws IOException {
79 if (defaultName != null)
80 writer.write("DefaultName=" + defaultName + LINEFEED);