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