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  public interface FileItemHeaders {
29  
30      /**
31       * Returns the value of the specified part header as a <code>String</code>.
32       *
33       * If the part did not include a header of the specified name, this method
34       * return <code>null</code>.  If there are multiple headers with the same
35       * name, this method returns the first header in the item.  The header
36       * name is case insensitive.
37       *
38       * @param name a <code>String</code> specifying the header name
39       * @return a <code>String</code> containing the value of the requested
40       *         header, or <code>null</code> if the item does not have a header
41       *         of that name
42       */
43      String getHeader(String name);
44  
45      /**
46       * <p>
47       * Returns all the values of the specified item header as an
48       * <code>Iterator</code> of <code>String</code> objects.
49       * </p>
50       * <p>
51       * If the item did not include any headers of the specified name, this
52       * method returns an empty <code>Iterator</code>. The header name is
53       * case insensitive.
54       * </p>
55       *
56       * @param name a <code>String</code> specifying the header name
57       * @return an <code>Iterator</code> containing the values of the
58       *         requested header. If the item does not have any headers of
59       *         that name, return an empty <code>Iterator</code>
60       */
61      Iterator<String> getHeaders(String name);
62  
63      /**
64       * <p>
65       * Returns an <code>Iterator</code> of all the header names.
66       * </p>
67       *
68       * @return an <code>Iterator</code> containing all of the names of
69       *         headers provided with this file item. If the item does not have
70       *         any headers return an empty <code>Iterator</code>
71       */
72      Iterator<String> getHeaderNames();
73  
74  }