Hi everybody,
I have a little problem with Upload fulcrum service.
It seems that the Commons.FileUpload component used by Upload service
has some problems with special characters in Filenames.
(http://issues.apache.org/bugzilla/show_bug.cgi?id=34436)
The solution for the problem is to use the setHeaderEncoding accordingly
to your configuration
http://jakarta.apache.org/commons/fileupload/apidocs/org/apache/commons/fileupload/FileUploadBase.html#setHeaderEncoding()
Unfortunately, the Upload fulcrum service doesn't expose such parameter
and that doesn't allow me to solve the problem.
I've prepared a little patch (I've attached it to this message) that
would expose such a parameter so that it can be configured.
Can you tell me if you find this patch is good for you?
Thanks in advance,
Fabio
P.S.: I know I'm supposed to add issues and patches in the Issue
Tracker, but the one linked in Fulcrum site seems to be Torque-centric.
Have I missed something?
Index: DefaultUploadService.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine-fulcrum/upload/src/java/org/apache/fulcrum/upload/DefaultUploadService.java,v
retrieving revision 1.4
diff -u -r1.4 DefaultUploadService.java
--- DefaultUploadService.java 8 Nov 2004 09:49:36 -0000 1.4
+++ DefaultUploadService.java 25 Jun 2005 17:25:10 -0000
@@ -65,6 +65,7 @@
private int sizeMax;
private String repositoryPath;
+ private String headerEncoding;
/**
* The application root
*/
@@ -180,7 +181,10 @@
UploadService.REPOSITORY_KEY,
UploadService.REPOSITORY_DEFAULT);
-
+ headerEncoding = conf.getAttribute(
+ UploadService.HEADER_ENCODING_KEY,
+ UploadService.HEADER_ENCODING_DEFAULT);
+
sizeMax = conf.getAttributeAsInteger(
UploadService.SIZE_MAX_KEY,
UploadService.SIZE_MAX_DEFAULT);
@@ -221,7 +225,8 @@
diskFileUpload.setSizeThreshold(sizeThreshold);
diskFileUpload.setRepositoryPath( repositoryPath);
-
+ diskFileUpload.setHeaderEncoding(headerEncoding);
+
fileUpload = diskFileUpload;
}
@@ -230,4 +235,16 @@
}
+ /**
+ * @return Returns the headerEncoding.
+ */
+ public String getHeaderEncoding() {
+ return headerEncoding;
+ }
+ /**
+ * @param headerEncoding The headerEncoding to set.
+ */
+ public void setHeaderEncoding(String headerEncoding) {
+ this.headerEncoding = headerEncoding;
+ }
}
Index: UploadService.java
===================================================================
RCS file:
/home/cvspublic/jakarta-turbine-fulcrum/upload/src/java/org/apache/fulcrum/upload/UploadService.java,v
retrieving revision 1.3
diff -u -r1.3 UploadService.java
--- UploadService.java 8 Nov 2004 09:49:36 -0000 1.3
+++ UploadService.java 25 Jun 2005 17:25:10 -0000
@@ -111,8 +111,21 @@
* TurbineResources.properties 'repository' property.
*/
public static final String REPOSITORY_KEY = "repository";
+
+ /**
+ * The key in UploadService properties in
+ * TurbineResources.properties 'headerEncoding' property.
+ */
+ public static final String HEADER_ENCODING_KEY = "headerEncoding";
/**
+ * <p> The default value of 'headerEncoding' property (.).
+ * The value has been decided by copying from DiskFileItem class
+ */
+ public static final String HEADER_ENCODING_DEFAULT = "ISO-8859-1";
+
+
+ /**
* <p> The default value of 'repository' property (.). This is
* the directory where uploaded fiels will get stored temporarily.
* Note that "." is whatever the servlet container chooses to be
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]