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 */ 017package org.apache.commons.fileupload; 018 019import 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 * @since 1.2.1 027 * 028 * @version $Id$ 029 */ 030public interface FileItemHeaders { 031 032 /** 033 * Returns the value of the specified part header as a <code>String</code>. 034 * 035 * If the part did not include a header of the specified name, this method 036 * return <code>null</code>. If there are multiple headers with the same 037 * name, this method returns the first header in the item. The header 038 * name is case insensitive. 039 * 040 * @param name a <code>String</code> specifying the header name 041 * @return a <code>String</code> containing the value of the requested 042 * header, or <code>null</code> if the item does not have a header 043 * of that name 044 */ 045 String getHeader(String name); 046 047 /** 048 * <p> 049 * Returns all the values of the specified item header as an 050 * <code>Iterator</code> of <code>String</code> objects. 051 * </p> 052 * <p> 053 * If the item did not include any headers of the specified name, this 054 * method returns an empty <code>Iterator</code>. The header name is 055 * case insensitive. 056 * </p> 057 * 058 * @param name a <code>String</code> specifying the header name 059 * @return an <code>Iterator</code> containing the values of the 060 * requested header. If the item does not have any headers of 061 * that name, return an empty <code>Iterator</code> 062 */ 063 Iterator<String> getHeaders(String name); 064 065 /** 066 * <p> 067 * Returns an <code>Iterator</code> of all the header names. 068 * </p> 069 * 070 * @return an <code>Iterator</code> containing all of the names of 071 * headers provided with this file item. If the item does not have 072 * any headers return an empty <code>Iterator</code> 073 */ 074 Iterator<String> getHeaderNames(); 075 076}