Date: 2005-03-10T23:27:15
Editor: DakotaJack
Wiki: Apache Struts Wiki
Page: StrutsUpload
URL: http://wiki.apache.org/struts/StrutsUpload
no comment
Change Log:
------------------------------------------------------------------------------
@@ -55,13 +55,13 @@
1. !MultipartFile
2. !MultipartData
3. !MultipartHandler
- 4. !MultipartUtil
=== Framework Code Sample Implementation ===
1. !UploadMultipartFile (implements !MultipartFile)
2. !UploadMultipartData (implements !MultipartData)
3. !UploadMultipartHandler (implements !MultipartHandler)
+ 4. !MultipartUtil
=== Sample Application Code Pieces (without interfaces to Action class*) ===
@@ -116,31 +116,6 @@
}
}}}
-==== MultipartUtil ====
-
-{{{
-public class MultipartUtil {
- public static final String MULTIPART_FORM_DATA = "multipart/form-data";
- public static final String CONTENT_TYPE = "Content-Type";
-
- public static boolean isMultipartFormData(HttpServletRequest req) {
- String contentType = null;
- String headerContentType = req.getHeader(CONTENT_TYPE);
- String requestContentType = req.getContentType();
-
- if(headerContentType == null && requestContentType != null) {
- contentType = requestContentType;
- } else if(requestContentType == null && headerContentType != null) {
- contentType = headerContentType;
- } else if(headerContentType != null && requestContentType != null) {
- contentType = headerContentType.length() <= requestContentType.length()
? requestContentType : headerContentType;
- }
-
- return contentType != null &&
contentType.toLowerCase().startsWith(MULTIPART_FORM_DATA);
- }
-}
-}}}
-
=== Framework Code Sample Implementation ===
==== UploadMultipartFile ====
@@ -424,6 +399,31 @@
public void setMapping(ActionMapping mapping) {
this.mapping = mapping;
+ }
+}
+}}}
+
+==== MultipartUtil ====
+
+{{{
+public class MultipartUtil {
+ public static final String MULTIPART_FORM_DATA = "multipart/form-data";
+ public static final String CONTENT_TYPE = "Content-Type";
+
+ public static boolean isMultipartFormData(HttpServletRequest req) {
+ String contentType = null;
+ String headerContentType = req.getHeader(CONTENT_TYPE);
+ String requestContentType = req.getContentType();
+
+ if(headerContentType == null && requestContentType != null) {
+ contentType = requestContentType;
+ } else if(requestContentType == null && headerContentType != null) {
+ contentType = headerContentType;
+ } else if(headerContentType != null && requestContentType != null) {
+ contentType = headerContentType.length() <= requestContentType.length()
? requestContentType : headerContentType;
+ }
+
+ return contentType != null &&
contentType.toLowerCase().startsWith(MULTIPART_FORM_DATA);
}
}
}}}
---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]