View Javadoc
1   /*
2    * Licensed to the Apache Software Foundation (ASF) under one or more
3    * contributor license agreements.  See the NOTICE file distributed with
4    * this work for additional information regarding copyright ownership.
5    * The ASF licenses this file to You under the Apache License, Version 2.0
6    * (the "License"); you may not use this file except in compliance with
7    * the License.  You may obtain a copy of the License at
8    *
9    *      http://www.apache.org/licenses/LICENSE-2.0
10   *
11   * Unless required by applicable law or agreed to in writing, software
12   * distributed under the License is distributed on an "AS IS" BASIS,
13   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14   * See the License for the specific language governing permissions and
15   * limitations under the License.
16   */
17  package org.apache.commons.fileupload;
18  
19  import java.util.Iterator;
20  
21  /**
22   * <p> This class provides support for accessing the headers for a file or form
23   * item that was received within a <code>multipart/form-data</code> POST
24   * request.</p>
25   *
26   * @since 1.2.1
27   *
28   * @version $Id$
29   */
30  public interface FileItemHeaders {
31  
32      /**
33       * Returns the value of the specified part header as a <code>String</code>.
34       *
35       * If the part did not include a header of the specified name, this method
36       * return <code>null</code>.  If there are multiple headers with the same
37       * name, this method returns the first header in the item.  The header
38       * name is case insensitive.
39       *
40       * @param name a <code>String</code> specifying the header name
41       * @return a <code>String</code> containing the value of the requested
42       *         header, or <code>null</code> if the item does not have a header
43       *         of that name
44       */
45      String getHeader(String name);
46  
47      /**
48       * <p>
49       * Returns all the values of the specified item header as an
50       * <code>Iterator</code> of <code>String</code> objects.
51       * </p>
52       * <p>
53       * If the item did not include any headers of the specified name, this
54       * method returns an empty <code>Iterator</code>. The header name is
55       * case insensitive.
56       * </p>
57       *
58       * @param name a <code>String</code> specifying the header name
59       * @return an <code>Iterator</code> containing the values of the
60       *         requested header. If the item does not have any headers of
61       *         that name, return an empty <code>Iterator</code>
62       */
63      Iterator<String> getHeaders(String name);
64  
65      /**
66       * <p>
67       * Returns an <code>Iterator</code> of all the header names.
68       * </p>
69       *
70       * @return an <code>Iterator</code> containing all of the names of
71       *         headers provided with this file item. If the item does not have
72       *         any headers return an empty <code>Iterator</code>
73       */
74      Iterator<String> getHeaderNames();
75  
76  }