001 // Copyright 2005 The Apache Software Foundation 002 // 003 // Licensed under the Apache License, Version 2.0 (the "License"); 004 // you may not use this file except in compliance with the License. 005 // You may obtain a copy of the License at 006 // 007 // http://www.apache.org/licenses/LICENSE-2.0 008 // 009 // Unless required by applicable law or agreed to in writing, software 010 // distributed under the License is distributed on an "AS IS" BASIS, 011 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 012 // See the License for the specific language governing permissions and 013 // limitations under the License. 014 015 package org.apache.tapestry.multipart; 016 017 import javax.servlet.http.HttpServletRequest; 018 019 import org.apache.tapestry.request.IUploadFile; 020 021 /** 022 * Responsible for detecting and processing file upload requests, using Jakarta Commons FileUpload. 023 * Implementations of this service typically use the threaded service lifecycle model. 024 * 025 * @author Howard M. Lewis Ship 026 * @since 4.0 027 */ 028 public interface MultipartDecoder 029 { 030 /** 031 * Decodes the request, returning a new {@link javax.servlet.http.HttpServletRequest} 032 * implementation that will allow access to the form fields submitted in the request (but omits 033 * uploaded files. 034 */ 035 036 public HttpServletRequest decode(HttpServletRequest request); 037 038 /** 039 * Gets a file upload with the given name, or returns null if no such file upload was in the 040 * request. 041 */ 042 043 public IUploadFile getFileUpload(String parameterName); 044 045 /** 046 * Cleans up any temporary resources created during the request processing. This typically 047 * includes temporary files used to contain uploaded file content. 048 */ 049 050 public void cleanup(); 051 }