Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@apache.org Received: (qmail 33313 invoked from network); 5 Nov 2002 20:29:02 -0000 Received: from unknown (HELO nagoya.betaversion.org) (192.18.49.131) by daedalus.apache.org with SMTP; 5 Nov 2002 20:29:02 -0000 Received: (qmail 22015 invoked by uid 97); 5 Nov 2002 20:28:44 -0000 Delivered-To: qmlist-jakarta-archive-commons-dev@jakarta.apache.org Received: (qmail 21998 invoked by uid 97); 5 Nov 2002 20:28:43 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 21984 invoked by uid 98); 5 Nov 2002 20:28:43 -0000 X-Antivirus: nagoya (v4218 created Aug 14 2002) Date: Tue, 5 Nov 2002 19:15:35 +0000 Subject: [PATCH][fileupload] additional isMultipartContent method Content-Type: multipart/mixed; boundary=Apple-Mail-1-234477622 Mime-Version: 1.0 (Apple Message framework v482) From: robert burrell donkin To: "Jakarta Commons Developers List" In-Reply-To: <3DC7BC18.1060102@CodeRage.ORG> Message-Id: X-Mailer: Apple Mail (2.482) X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N --Apple-Mail-1-234477622 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII; format=flowed fileupload works with multipart content - and only multipart content. this patch adds a utility method that determines (in the same way as fileupload does) whether a request contains multipart content. - robert --Apple-Mail-1-234477622 Content-Disposition: attachment; filename=fileupload.txt Content-Transfer-Encoding: 7bit Content-Type: text/plain; x-unix-mode=0644; name="fileupload.txt" Index: src/java/org/apache/commons/fileupload/FileUpload.java =================================================================== RCS file: /home/cvs/jakarta-commons/fileupload/src/java/org/apache/commons/fileupload/FileUpload.java,v retrieving revision 1.13 diff -u -r1.13 FileUpload.java --- src/java/org/apache/commons/fileupload/FileUpload.java 27 Oct 2002 17:11:46 -0000 1.13 +++ src/java/org/apache/commons/fileupload/FileUpload.java 5 Nov 2002 19:12:29 -0000 @@ -101,6 +101,28 @@ public class FileUpload { + // ----------------------------------------------------- Class methods + + /** + * Utility method that determines whether the request contains multipart content. + * + * @param req The servlet request to be evaluated. Must be non-null. + */ + public final static boolean isMultipartContent(HttpServletRequest req) + { + String contentType = req.getHeader(CONTENT_TYPE); + if ( null == contentType ) + { + return false; + } + if ( contentType.startsWith(MULTIPART) ) + { + return true; + } + return false; + } + + // ----------------------------------------------------- Manifest constants @@ -309,7 +331,6 @@ // --------------------------------------------------------- Public methods - /** * Processes an RFC 1867 --Apple-Mail-1-234477622 Content-Type: text/plain; charset=us-ascii -- To unsubscribe, e-mail: For additional commands, e-mail: --Apple-Mail-1-234477622--