001 /*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements. See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License. You may obtain a copy of the License at
008 *
009 * http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017 package org.apache.commons.fileupload;
018
019 import java.util.Iterator;
020
021 /**
022 * <p> This class provides support for accessing the headers for a file or form
023 * item that was received within a <code>multipart/form-data</code> POST
024 * request.</p>
025 *
026 * @author Michael C. Macaluso
027 * @since 1.3
028 */
029 public interface FileItemHeaders {
030 /**
031 * Returns the value of the specified part header as a <code>String</code>.
032 * If the part did not include a header of the specified name, this method
033 * return <code>null</code>. If there are multiple headers with the same
034 * name, this method returns the first header in the item. The header
035 * name is case insensitive.
036 *
037 * @param name a <code>String</code> specifying the header name
038 * @return a <code>String</code> containing the value of the requested
039 * header, or <code>null</code> if the item does not have a header
040 * of that name
041 */
042 String getHeader(String name);
043
044 /**
045 * <p>
046 * Returns all the values of the specified item header as an
047 * <code>Enumeration</code> of <code>String</code> objects.
048 * </p>
049 * <p>
050 * If the item did not include any headers of the specified name, this
051 * method returns an empty <code>Enumeration</code>. The header name is
052 * case insensitive.
053 * </p>
054 *
055 * @param name a <code>String</code> specifying the header name
056 * @return an <code>Enumeration</code> containing the values of the
057 * requested header. If the item does not have any headers of
058 * that name, return an empty <code>Enumeration</code>
059 */
060 Iterator getHeaders(String name);
061
062 /**
063 * <p>
064 * Returns an <code>Enumeration</code> of all the header names.
065 * </p>
066 * <p>
067 * If the item did not include any headers of the specified name, this
068 * method returns an empty <code>Enumeration</code>. The header name is
069 * case insensitive.
070 * </p>
071 *
072 * @return an <code>Enumeration</code> containing the values of the
073 * requested header. If the item does not have any headers of
074 * that name return an empty <code>Enumeration</code>
075 */
076 Iterator getHeaderNames();
077 }