cvs commit: jakarta-struts/src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java
husted 2004/03/21 16:41:34 Modified:src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java Log: Apply #27702 MultipartPost values cannot contain latin1 characters when server is running on linux reported by Raimo Ihle. Revision ChangesPath 1.16 +9 -5 jakarta-struts/src/share/org/apache/struts/upload/CommonsMultipartRequestHandler.java Index: CommonsMultipartRequestHandler.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/CommonsMultipartRequestHandler.java,v retrieving revision 1.15 retrieving revision 1.16 diff -u -r1.15 -r1.16 --- CommonsMultipartRequestHandler.java 14 Mar 2004 06:23:48 - 1.15 +++ CommonsMultipartRequestHandler.java 22 Mar 2004 00:41:34 - 1.16 @@ -409,7 +409,11 @@ try { value = item.getString(request.getCharacterEncoding()); } catch (Exception e) { -value = item.getString(); +try { + value = item.getString(ISO-8859-1); +} catch (java.io.UnsupportedEncodingException uee) { + value = item.getString(); +} } if (request instanceof MultipartRequestWrapper) { - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-struts/src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java
martinc 2004/01/24 15:39:18 Modified:src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java Log: Don't cast max size to an int, since the method wants a long anyway. PR: 26305 Submitted by: Charles Chen Revision ChangesPath 1.14 +5 -5 jakarta-struts/src/share/org/apache/struts/upload/CommonsMultipartRequestHandler.java Index: CommonsMultipartRequestHandler.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/CommonsMultipartRequestHandler.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -r1.13 -r1.14 --- CommonsMultipartRequestHandler.java 21 Jan 2004 03:53:49 - 1.13 +++ CommonsMultipartRequestHandler.java 24 Jan 2004 23:39:18 - 1.14 @@ -218,7 +218,7 @@ // see http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23255 upload.setHeaderEncoding(request.getCharacterEncoding()); // Set the maximum size before a FileUploadException will be thrown. -upload.setSizeMax((int) getSizeMax(ac)); +upload.setSizeMax(getSizeMax(ac)); // Set the maximum size that will be stored in memory. upload.setSizeThreshold((int) getSizeThreshold(ac)); // Set the the location for saving data on disk. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-struts/src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java
husted 2004/01/20 19:53:49 Modified:src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java Log: Apply #23255 FormFile.getFileName() problem in multibyte character file name submitted by YOKOTA Takehiko. Revision ChangesPath 1.13 +7 -4 jakarta-struts/src/share/org/apache/struts/upload/CommonsMultipartRequestHandler.java Index: CommonsMultipartRequestHandler.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/CommonsMultipartRequestHandler.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- CommonsMultipartRequestHandler.java 13 Jan 2004 12:48:52 - 1.12 +++ CommonsMultipartRequestHandler.java 21 Jan 2004 03:53:49 - 1.13 @@ -214,6 +214,9 @@ // Create and configure a DIskFileUpload instance. DiskFileUpload upload = new DiskFileUpload(); +// The following line is to support an EncodingFilter +// see http://nagoya.apache.org/bugzilla/show_bug.cgi?id=23255 +upload.setHeaderEncoding(request.getCharacterEncoding()); // Set the maximum size before a FileUploadException will be thrown. upload.setSizeMax((int) getSizeMax(ac)); // Set the maximum size that will be stored in memory. - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-struts/src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java
husted 2003/02/15 04:39:23 Modified:src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java Log: + Add toString method to provide for server-side validation. [#17031, Mohan Kishore] Revision ChangesPath 1.8 +13 -4 jakarta-struts/src/share/org/apache/struts/upload/CommonsMultipartRequestHandler.java Index: CommonsMultipartRequestHandler.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/CommonsMultipartRequestHandler.java,v retrieving revision 1.7 retrieving revision 1.8 diff -u -r1.7 -r1.8 --- CommonsMultipartRequestHandler.java 7 Feb 2003 07:00:49 - 1.7 +++ CommonsMultipartRequestHandler.java 15 Feb 2003 12:39:23 - 1.8 @@ -657,5 +657,14 @@ return fileName; } + +/** + * Returns the (client-side) file name for this file. + * + * @return The client-size file name. + */ +public String toString() { +return getFileName(); +} } } - To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
cvs commit: jakarta-struts/src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java
martinc 2003/02/06 23:00:49 Modified:conf/share struts-config_1_1.dtd src/share/org/apache/struts/config ControllerConfig.java src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java Log: Allow configuration of the size threshold below which uploads will be saved in memory, and above which they will be saved to some alternate storage medium, typically disk. Revision ChangesPath 1.36 +10 -1 jakarta-struts/conf/share/struts-config_1_1.dtd Index: struts-config_1_1.dtd === RCS file: /home/cvs/jakarta-struts/conf/share/struts-config_1_1.dtd,v retrieving revision 1.35 retrieving revision 1.36 diff -u -r1.35 -r1.36 --- struts-config_1_1.dtd 28 Jan 2003 19:30:23 - 1.35 +++ struts-config_1_1.dtd 7 Feb 2003 07:00:49 - 1.36 @@ -515,6 +515,14 @@ megabytes, or gigabytes, respectively. [250M] + memFileSize The maximum size (in bytes) of a file whose contents will + be retained in memory after uploading. Files larger than + this threshold will be written to some alternative storage + medium, typically a hard disk. Can be expressed as a number + followed by a K, M, or G, which are interpreted to + mean kilobytes, megabytes, or gigabytes, respectively. + [256K] + multipartClass The fully qualified Java class name of the multipart request handler class to be used with this module. [org.apache.struts.upload.CommonsMultipartRequestHandler] @@ -555,6 +563,7 @@ !ATTLIST controller inputForward %Boolean; #IMPLIED !ATTLIST controller locale %Boolean; #IMPLIED !ATTLIST controller maxFileSizeCDATA #IMPLIED +!ATTLIST controller memFileSizeCDATA #IMPLIED !ATTLIST controller multipartClass %ClassName; #IMPLIED !ATTLIST controller nocache%Boolean; #IMPLIED !ATTLIST controller pagePatternCDATA #IMPLIED 1.13 +26 -5 jakarta-struts/src/share/org/apache/struts/config/ControllerConfig.java Index: ControllerConfig.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/config/ControllerConfig.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -r1.12 -r1.13 --- ControllerConfig.java 28 Jan 2003 19:30:24 - 1.12 +++ ControllerConfig.java 7 Feb 2003 07:00:49 - 1.13 @@ -231,6 +231,23 @@ /** + * The maximum file size to retain in memory. + */ +protected String memFileSize = 256K; + +public String getMemFileSize() { +return (this.memFileSize); +} + +public void setMemFileSize(String memFileSize) { +if (configured) { +throw new IllegalStateException(Configuration is frozen); +} +this.memFileSize = memFileSize; +} + + +/** * The fully qualified Java class name of the MultipartRequestHandler * class to be used. */ @@ -369,8 +386,12 @@ sb.append(,locale=); sb.append(this.locale); if (this.maxFileSize != null) { -sb.append(,maxFileSzie=); +sb.append(,maxFileSize=); sb.append(this.maxFileSize); +} +if (this.memFileSize != null) { +sb.append(,memFileSize=); +sb.append(this.memFileSize); } sb.append(,multipartClass=); sb.append(this.multipartClass); 1.7 +42 -23 jakarta-struts/src/share/org/apache/struts/upload/CommonsMultipartRequestHandler.java Index: CommonsMultipartRequestHandler.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/CommonsMultipartRequestHandler.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -r1.6 -r1.7 --- CommonsMultipartRequestHandler.java 9 Nov 2002 04:04:11 - 1.6 +++ CommonsMultipartRequestHandler.java 7 Feb 2003 07:00:49 - 1.7 @@ -218,7 +218,7 @@ // Set the maximum size before a FileUploadException will be thrown. upload.setSizeMax((int) getSizeMax(ac)); // Set the maximum size that will be stored in memory. -upload.setSizeThreshold(getSizeThreshold(ac)); +upload.setSizeThreshold((int) getSizeThreshold(ac)); // Set the the location for saving data on disk. upload.setRepositoryPath(getRepositoryPath(ac)); @@ -324,8
cvs commit: jakarta-struts/src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java DiskMultipartRequestHandler.java
rleland 2002/11/06 21:18:27 Modified:src/share/org/apache/struts Globals.java src/share/org/apache/struts/action Action.java src/share/org/apache/struts/config ApplicationConfig.java ConfigRuleSet.java src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java DiskMultipartRequestHandler.java Log: Bug 14054 Checked in More ApplicationConfig-ModuleConfig Tested using struts-example, struts-validator,struts-upload This will require users to recompile, since some public fields were added. Revision ChangesPath 1.3 +28 -10jakarta-struts/src/share/org/apache/struts/Globals.java Index: Globals.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/Globals.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- Globals.java 24 Jul 2002 05:31:29 - 1.2 +++ Globals.java 7 Nov 2002 05:18:26 - 1.3 -97,19 +97,37 /** * pThe base of the context attributes key under which our - * codeApplicationConfig/code data structure will be stored. This + * codeModuleConfig/code data structure will be stored. This * will be suffixed with the actual module prefix (including the * leading / character) to form the actual attributes key./p * * pFor each request processed by the controller servlet, the - * codeApplicationConfig/code object for the module selected by + * codeModuleConfig/code object for the module selected by * the request URI currently being processed will also be exposed under * this key as a request attribute./p * * since Struts 1.1 + * deprecated Use MODULE_KEY */ public static final String APPLICATION_KEY = -org.apache.struts.action.APPLICATION; +org.apache.struts.action.MODULE; + + +/** + * pThe base of the context attributes key under which our + * codeModuleConfig/code data structure will be stored. This + * will be suffixed with the actual module prefix (including the + * leading / character) to form the actual attributes key./p + * + * pFor each request processed by the controller servlet, the + * codeModuleConfig/code object for the module selected by + * the request URI currently being processed will also be exposed under + * this key as a request attribute./p + * + * since Struts 1.1 + */ +public static final String MODULE_KEY = +org.apache.struts.action.MODULE; /** -147,7 +165,7 * is normally stored, unless overridden when initializing our * ActionServlet. * - * deprecated Replaced by collection in ApplicationConfig + * deprecated Replaced by collection in ModuleConfig */ public static final String FORM_BEANS_KEY = org.apache.struts.action.FORM_BEANS; -159,7 +177,7 * is normally stored, unless overridden when initializing our * ActionServlet. * - * deprecated Replaced by collection in ApplicationConfig. + * deprecated Replaced by collection in ModuleConfig. */ public static final String FORWARDS_KEY = org.apache.struts.action.FORWARDS; -191,7 +209,7 * is normally stored, unless overridden when initializing our * ActionServlet. * - * deprecated Replaced by collection in ApplicationConfig + * deprecated Replaced by collection in ModuleConfig */ public static final String MAPPINGS_KEY = org.apache.struts.action.MAPPINGS; 1.51 +30 -25jakarta-struts/src/share/org/apache/struts/action/Action.java Index: Action.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/action/Action.java,v retrieving revision 1.50 retrieving revision 1.51 diff -u -r1.50 -r1.51 --- Action.java 30 Oct 2002 02:30:31 - 1.50 +++ Action.java 7 Nov 2002 05:18:26 - 1.51 -76,7 +76,7 import javax.servlet.http.HttpSession; import javax.sql.DataSource; import org.apache.struts.Globals; -import org.apache.struts.config.ApplicationConfig; +import org.apache.struts.config.ModuleConfig; import org.apache.struts.taglib.html.Constants; import org.apache.struts.util.MessageResources; import org.apache.struts.util.RequestUtils; -139,16 +139,17 /** * pThe base of the context attributes key under which our - * codeApplicationConfig/code data structure will be stored. This + * codeModuleConfig/code data structure will be stored. This * will be suffixed with the
cvs commit: jakarta-struts/src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java
jholmes 2002/10/16 17:49:25 Modified:src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java Log: make addTextParameter() aware of character encoding in request PR: Bugzilla #12732 Revision ChangesPath 1.3 +11 -5 jakarta-struts/src/share/org/apache/struts/upload/CommonsMultipartRequestHandler.java Index: CommonsMultipartRequestHandler.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/CommonsMultipartRequestHandler.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -r1.2 -r1.3 --- CommonsMultipartRequestHandler.java 31 Jul 2002 06:43:18 - 1.2 +++ CommonsMultipartRequestHandler.java 17 Oct 2002 00:49:25 - 1.3 @@ -427,7 +427,13 @@ */ protected void addTextParameter(HttpServletRequest request, FileItem item) { String name = item.getFieldName(); -String value = item.getString(); +String value = null; + +try { +value = item.getString(request.getCharacterEncoding()); +} catch (Exception e) { +value = item.getString(); +} if (request instanceof MultipartRequestWrapper) { MultipartRequestWrapper wrapper = (MultipartRequestWrapper) request; -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]
cvs commit: jakarta-struts/src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java
martinc 2002/07/30 23:43:18 Modified:src/share/org/apache/struts/upload CommonsMultipartRequestHandler.java Log: Fix a compatibility issue with DiskMultipartRequestHandler, so that FormFile.getFileName() returns the base file name, instead of the full (client-relative, and therefore not useful) path to the uploaded file. Submitted by: Erich Meier Revision ChangesPath 1.2 +38 -5 jakarta-struts/src/share/org/apache/struts/upload/CommonsMultipartRequestHandler.java Index: CommonsMultipartRequestHandler.java === RCS file: /home/cvs/jakarta-struts/src/share/org/apache/struts/upload/CommonsMultipartRequestHandler.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -r1.1 -r1.2 --- CommonsMultipartRequestHandler.java 27 Jul 2002 21:53:13 - 1.1 +++ CommonsMultipartRequestHandler.java 31 Jul 2002 06:43:18 - 1.2 @@ -545,7 +545,7 @@ * @return The client-size file name. */ public String getFileName() { -return fileItem.getName(); +return getBaseFileName(fileItem.getName()); } @@ -599,6 +599,39 @@ */ public void destroy() { fileItem.delete(); +} + + +/** + * Returns the base file name from the supplied file path. On the surface, + * this would appear to be a trivial task. Apparently, however, some Linux + * JDKs do not implement codeFile.getName()/code correctly for Windows + * paths, so we attempt to take care of that here. + * + * @param filePath The full path to the file. + * + * @return The base file name, from the end of the path. + */ +protected String getBaseFileName(String filePath) { + +// First, ask the JDK for the base file name. +String fileName = new File(filePath).getName(); + +// Now check for a Windows file name parsed incorrectly. +int colonIndex = fileName.indexOf(:); +if (colonIndex == -1) { +// Check for a Windows SMB file path. +colonIndex = fileName.indexOf(); +} +int backslashIndex = fileName.lastIndexOf(\\); + +if (colonIndex -1 backslashIndex -1) { +// Consider this filename to be a full Windows path, and parse it +// accordingly to retrieve just the base file name. +fileName = fileName.substring(backslashIndex + 1); +} + +return fileName; } } } -- To unsubscribe, e-mail: mailto:[EMAIL PROTECTED] For additional commands, e-mail: mailto:[EMAIL PROTECTED]