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