From ee00c132dd186c2ab74a4981ad8148c2f6d4e887 Mon Sep 17 00:00:00 2001 From: "Donald J. Brown" Date: Sat, 25 Mar 2006 03:01:50 +0000 Subject: [PATCH] Removing the fileupload-cos dependency. This fileupload implementation used code from servlets.com, which is under an unfriendly license - http://servlets.com/cos/license.html - unless you happen to _really_ like the book Java Servlet Programming. git-svn-id: https://svn.apache.org/repos/asf/incubator/webwork2@388692 13f79535-47bb-0310-9956-ffa450edef68 --- ivy.xml | 4 - .../multipart/CosMultiPartRequest.java | 108 ------------------ 2 files changed, 112 deletions(-) delete mode 100644 src/java/org/apache/struts/action2/dispatcher/multipart/CosMultiPartRequest.java diff --git a/ivy.xml b/ivy.xml index 881890d66..26e22783f 100644 --- a/ivy.xml +++ b/ivy.xml @@ -28,7 +28,6 @@ - @@ -89,9 +88,6 @@ - - - diff --git a/src/java/org/apache/struts/action2/dispatcher/multipart/CosMultiPartRequest.java b/src/java/org/apache/struts/action2/dispatcher/multipart/CosMultiPartRequest.java deleted file mode 100644 index 90e39789f..000000000 --- a/src/java/org/apache/struts/action2/dispatcher/multipart/CosMultiPartRequest.java +++ /dev/null @@ -1,108 +0,0 @@ -/* - * Copyright (c) 2002-2003 by OpenSymphony - * All rights reserved. - */ -package org.apache.struts.action2.dispatcher.multipart; - -import com.oreilly.servlet.MultipartRequest; - -import javax.servlet.http.HttpServletRequest; -import java.io.File; -import java.io.IOException; -import java.util.Collections; -import java.util.Enumeration; -import java.util.List; - - -/** - * Multipart form data request adapter for Jason Hunter's - * multipart utils - * (COS == com.oreilly.servlet). - * - * @author Matt Baldree (modified for WW's use) - * @author Scott Farquhar (added i18n handling (WW-109)) - */ -public class CosMultiPartRequest extends MultiPartRequest { - - private MultipartRequest multi; - - - /** - * Creates a new request wrapper to handle multi-part data using methods adapted from the COS - * multipart classes (see class description). - * - * @param maxSize maximum size post allowed - * @param saveDir the directory to save off the file - * @param servletRequest the request containing the multipart - */ - public CosMultiPartRequest(HttpServletRequest servletRequest, String saveDir, int maxSize) throws IOException { - String encoding = getEncoding(); - - if (encoding != null) { - multi = new MultipartRequest(servletRequest, saveDir, maxSize, encoding); - } else { - multi = new MultipartRequest(servletRequest, saveDir, maxSize); - } - } - - - public Enumeration getFileParameterNames() { - return multi.getFileNames(); - } - - public String[] getContentType(String fieldName) { - return new String[]{multi.getContentType(fieldName)}; - } - - public File[] getFile(String fieldName) { - return new File[]{multi.getFile(fieldName)}; - } - - public String[] getFileNames(String fieldName) { - return new String[]{multi.getFile(fieldName).getName()}; - } - - public String[] getFilesystemName(String name) { - return new String[]{multi.getFilesystemName(name)}; - } - - public String getParameter(String name) { - return multi.getParameter(name); - } - - public Enumeration getParameterNames() { - return multi.getParameterNames(); - } - - public String[] getParameterValues(String name) { - return multi.getParameterValues(name); - } - - public List getErrors() { - return Collections.EMPTY_LIST; - } - - /** - * Set the encoding for the uploaded parameters. This needs to be set if you are using character sets - * other than ASCII.

- *

- * The encoding is looked up from the configuration setting 'webwork.i18n.encoding'. This is usually set in - * default.properties and webwork.properties. - */ - private static String getEncoding() { - return "utf-8"; - - //todo: configuration in xwork needs to support non-action level config - - /* - String encoding = null; - try { - - //encoding = Configuration.getString("webwork.i18n.encoding"); - } catch (IllegalArgumentException e) { - LogFactory.getLog(PellMultiPartRequest.class).info("Could not get encoding property 'webwork.i18n.encoding' for file upload. Using system default"); - } - return encoding; - */ - } -}