1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.apache.myfaces.trinidad.webapp; 20 21 import java.io.IOException; 22 import org.apache.myfaces.trinidad.model.UploadedFile; 23 24 /** 25 * Marker Interface responsible for processing file uploads by multiple processors 26 * one after another in a chained fashion. An Apache Trinidad application could have 27 * multiple <code>ChainedUploadedFileProcessor</code> instances. A composite UploadedFileProcessor 28 * is accessible from the {@link org.apache.myfaces.trinidad.context.RequestContext}, 29 * but will be invoked automatically by the framework as needed. Developers 30 * can implement this interface and chain many of them up together using space 31 * separated class names in <code>trinidad-config.xml</code> file under 32 * <code>uploaded-file-processor</code> element. The order in which the processors 33 * will be instantated and called will be the same as how it appears inside the element. 34 * As such, it is expected that the input of the ChainedUploadedFileProcessor will be 35 * the output of the last ChainedUploadedFileProcessor. 36 * <p/> 37 * UploadedFileProcessors which implement this interface are subject to the following 38 * limitations/abilities: 39 * <ul> 40 * <li> 41 * Unlike in the <code>UploadedFileProcessor</code> the {@link UploadedFile} objects given 42 * to a chained UploadedFileProcessor should allow for multiple reads such that 43 * {@link UploadedFile#getInputStream()} may be called multiple times and must return a 44 * new <code>InputStream</code> every time it is called. 45 * </li> 46 * <li> 47 * Chained processors need not return new <code>UploadedFile</code> instances. They may, 48 * instead, return the same instance as its predecessor, thus saving the need to move 49 * content around with each call into the chain. If a <code>ChainedUploadedFileProcessor</code> 50 * DOES return a new instance of UploadedFile, it must be allowed to be read multiple times. 51 * </li> 52 * <li> 53 * Chained processors may extend the {@link ExtendedUploadedFileProcessor} abstract 54 * class. Any additional methods will be handled in accordance to the modifications listed above. 55 * </li> 56 * </ul> 57 * 58 * @see org.apache.myfaces.trinidad.model.UploadedFile 59 */ 60 public interface ChainedUploadedFileProcessor extends UploadedFileProcessor {}