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