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