[resteasy: 2/2] Added multipart module
Juan Hernandez
jhernand at fedoraproject.org
Tue Apr 24 12:00:04 UTC 2012
commit 55f003d2ce526fcc4757f78afb0d63d0dc707934
Author: Juan Hernandez <juan.hernandez at redhat.com>
Date: Tue Apr 24 13:41:10 2012 +0200
Added multipart module
resteasy-2.3.2.Final-mime4j-0.7.2.patch | 113 ++++++++++++++++++++
....2.Final-remove-currently-unbuilt-modules.patch | 8 +-
resteasy-2.3.2.Final-remove-dependenciesA.patch | 28 +++++-
resteasy.spec | 14 ++-
4 files changed, 152 insertions(+), 11 deletions(-)
---
diff --git a/resteasy-2.3.2.Final-mime4j-0.7.2.patch b/resteasy-2.3.2.Final-mime4j-0.7.2.patch
new file mode 100644
index 0000000..8486809
--- /dev/null
+++ b/resteasy-2.3.2.Final-mime4j-0.7.2.patch
@@ -0,0 +1,113 @@
+diff --git a/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartFormDataInputImpl.java b/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartFormDataInputImpl.java
+index 6763d4e..cc41e2f 100644
+--- a/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartFormDataInputImpl.java
++++ b/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartFormDataInputImpl.java
+@@ -10,10 +10,10 @@ import java.util.Map;
+ import javax.ws.rs.core.MediaType;
+ import javax.ws.rs.ext.Providers;
+
+-import org.apache.james.mime4j.field.ContentDispositionField;
+-import org.apache.james.mime4j.field.FieldName;
++import org.apache.james.mime4j.dom.field.ContentDispositionField;
++import org.apache.james.mime4j.dom.field.FieldName;
+ import org.apache.james.mime4j.message.BodyPart;
+-import org.apache.james.mime4j.parser.Field;
++import org.apache.james.mime4j.stream.Field;
+ import org.jboss.resteasy.util.GenericType;
+
+ /**
+diff --git a/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartInputImpl.java b/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartInputImpl.java
+index 2865174..d5a1e0c 100644
+--- a/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartInputImpl.java
++++ b/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartInputImpl.java
+@@ -1,14 +1,18 @@
+ package org.jboss.resteasy.plugins.providers.multipart;
+
+-import org.apache.james.mime4j.field.ContentTypeField;
+-import org.apache.james.mime4j.message.BinaryBody;
+-import org.apache.james.mime4j.message.Body;
++import org.apache.james.mime4j.dom.MessageBuilder;
++import org.apache.james.mime4j.dom.MessageServiceFactory;
++import org.apache.james.mime4j.dom.field.ContentTypeField;
++import org.apache.james.mime4j.dom.BinaryBody;
++import org.apache.james.mime4j.dom.Body;
++import org.apache.james.mime4j.dom.Entity;
+ import org.apache.james.mime4j.message.BodyPart;
+-import org.apache.james.mime4j.message.Message;
+-import org.apache.james.mime4j.message.Multipart;
+-import org.apache.james.mime4j.message.TextBody;
+-import org.apache.james.mime4j.parser.Field;
++import org.apache.james.mime4j.dom.Message;
++import org.apache.james.mime4j.dom.Multipart;
++import org.apache.james.mime4j.dom.TextBody;
++import org.apache.james.mime4j.stream.Field;
+ import org.apache.james.mime4j.util.CharsetUtil;
++import org.apache.james.mime4j.MimeException;
+ import org.jboss.resteasy.spi.HttpRequest;
+ import org.jboss.resteasy.spi.ResteasyProviderFactory;
+ import org.jboss.resteasy.util.CaseInsensitiveMap;
+@@ -29,6 +33,7 @@ import java.io.StringWriter;
+ import java.io.UnsupportedEncodingException;
+ import java.lang.annotation.Annotation;
+ import java.lang.reflect.Type;
++import java.nio.charset.Charset;
+ import java.util.ArrayList;
+ import java.util.HashMap;
+ import java.util.List;
+@@ -73,8 +78,14 @@ public class MultipartInputImpl implements MultipartInput
+
+ public void parse(InputStream is) throws IOException
+ {
+- mimeMessage = new Message(addHeaderToHeadlessStream(is));
+- extractParts();
++ try {
++ MessageServiceFactory factory = MessageServiceFactory.newInstance();
++ MessageBuilder builder = factory.newMessageBuilder();
++ mimeMessage = builder.parseMessage(addHeaderToHeadlessStream(is));
++ extractParts();
++ } catch (MimeException e) {
++ throw new IOException("Couldn't parse message", e);
++ }
+ }
+
+ protected InputStream addHeaderToHeadlessStream(InputStream is)
+@@ -104,8 +115,8 @@ public class MultipartInputImpl implements MultipartInput
+ protected void extractParts() throws IOException
+ {
+ Multipart multipart = (Multipart) mimeMessage.getBody();
+- for (BodyPart bodyPart : multipart.getBodyParts())
+- parts.add(extractPart(bodyPart));
++ for (Entity bodyPart : multipart.getBodyParts())
++ parts.add(extractPart((BodyPart) bodyPart));
+ }
+
+ protected InputPart extractPart(BodyPart bodyPart) throws IOException
+@@ -197,8 +208,11 @@ public class MultipartInputImpl implements MultipartInput
+ try
+ {
+ String charset = contentType.getParameters().get("charset");
+- if (charset != null)
+- charset = CharsetUtil.toJavaCharset(charset);
++ if (charset != null) {
++ Charset c = CharsetUtil.lookup(charset);
++ if (c != null)
++ charset = c.name();
++ }
+ inputStreamReader = charset == null ? new InputStreamReader(
+ inputStream)
+ : new InputStreamReader(inputStream, charset);
+diff --git a/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartRelatedInputImpl.java b/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartRelatedInputImpl.java
+index da7f0b7..2063a76 100644
+--- a/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartRelatedInputImpl.java
++++ b/providers/multipart/src/main/java/org/jboss/resteasy/plugins/providers/multipart/MultipartRelatedInputImpl.java
+@@ -8,8 +8,8 @@ import java.util.Map;
+ import javax.ws.rs.core.MediaType;
+ import javax.ws.rs.ext.Providers;
+
+-import org.apache.james.mime4j.field.ContentTypeField;
+-import org.apache.james.mime4j.field.FieldName;
++import org.apache.james.mime4j.dom.field.ContentTypeField;
++import org.apache.james.mime4j.dom.field.FieldName;
+ import org.apache.james.mime4j.message.BodyPart;
+
+ /**
diff --git a/resteasy-2.3.2.Final-remove-currently-unbuilt-modules.patch b/resteasy-2.3.2.Final-remove-currently-unbuilt-modules.patch
index ee26922..1cd021b 100644
--- a/resteasy-2.3.2.Final-remove-currently-unbuilt-modules.patch
+++ b/resteasy-2.3.2.Final-remove-currently-unbuilt-modules.patch
@@ -26,14 +26,10 @@ index 455d6ee..2ce1d2d 100644
<dependencyManagement>
diff --git a/providers/pom.xml b/providers/pom.xml
-index b4b5518..ce04a5d 100644
+index b4b5518..eb9826b 100644
--- a/providers/pom.xml
+++ b/providers/pom.xml
-@@ -21,10 +21,8 @@
- <module>jackson</module>
- <module>test-jackson-jaxb-coexistence</module>
- <module>resteasy-atom</module>
-- <module>multipart</module>
+@@ -25,6 +25,5 @@
<module>yaml</module>
<module>resteasy-html</module>
<module>test-resteasy-html</module>
diff --git a/resteasy-2.3.2.Final-remove-dependenciesA.patch b/resteasy-2.3.2.Final-remove-dependenciesA.patch
index 5496f8b..fbbf116 100644
--- a/resteasy-2.3.2.Final-remove-dependenciesA.patch
+++ b/resteasy-2.3.2.Final-remove-dependenciesA.patch
@@ -1,3 +1,5 @@
+diff --git a/async-http-jbossweb/async-http-jbossweb-jar/pom.xml b/async-http-jbossweb/async-http-jbossweb-jar/pom.xml
+index 4a31c8b..80b5a58 100644
--- a/async-http-jbossweb/async-http-jbossweb-jar/pom.xml
+++ b/async-http-jbossweb/async-http-jbossweb-jar/pom.xml
@@ -14,9 +14,8 @@
@@ -40,6 +42,21 @@ index deca25f..1c27e72 100644
-</project>
\ No newline at end of file
+</project>
+diff --git a/pom.xml b/pom.xml
+index 455d6ee..5250f81 100644
+--- a/pom.xml
++++ b/pom.xml
+@@ -255,8 +255,8 @@
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
+- <artifactId>apache-mime4j</artifactId>
+- <version>0.6</version>
++ <artifactId>apache-mime4j-core</artifactId>
++ <version>0.7.2</version>
+ <exclusions>
+ <exclusion>
+ <artifactId>commons-logging</artifactId>
diff --git a/providers/fastinfoset/pom.xml b/providers/fastinfoset/pom.xml
index 7d4de0f..b6dbd53 100644
--- a/providers/fastinfoset/pom.xml
@@ -107,7 +124,7 @@ index dfce204..6269fb8 100644
diff --git a/providers/multipart/pom.xml b/providers/multipart/pom.xml
-index 9acdfb4..a230d04 100644
+index 9acdfb4..c4cef26 100644
--- a/providers/multipart/pom.xml
+++ b/providers/multipart/pom.xml
@@ -34,7 +34,11 @@
@@ -119,10 +136,17 @@ index 9acdfb4..a230d04 100644
+ </dependency>
+ <dependency>
+ <groupId>org.apache.james</groupId>
-+ <artifactId>apache-mime4j-project</artifactId>
++ <artifactId>apache-mime4j-dom</artifactId>
</dependency>
<dependency>
<groupId>javax.servlet</groupId>
+@@ -70,4 +74,4 @@
+ </plugins>
+ </build>
+
+-</project>
+\ No newline at end of file
++</project>
diff --git a/providers/resteasy-atom/pom.xml b/providers/resteasy-atom/pom.xml
index 732c0c4..54a230e 100644
--- a/providers/resteasy-atom/pom.xml
diff --git a/resteasy.spec b/resteasy.spec
index 5330405..e6165a7 100644
--- a/resteasy.spec
+++ b/resteasy.spec
@@ -3,7 +3,7 @@
Name: resteasy
Version: 2.3.2
-Release: 5%{?dist}
+Release: 6%{?dist}
Summary: Framework for RESTful Web services and Java applications
Group: Development/Libraries
License: ASL 2.0 and CDDL
@@ -18,6 +18,8 @@ Patch0: %{name}-%{namedversion}-remove-dependenciesA.patch
Patch1: %{name}-%{namedversion}-fix-tests.patch
Patch2: %{name}-%{namedversion}-remove-currently-unbuilt-modules.patch
Patch3: %{name}-%{namedversion}-fix-javadoc.patch
+# Support for mime4j 0.7.2
+Patch4: %{name}-%{namedversion}-mime4j-0.7.2.patch
BuildArch: noarch
@@ -26,7 +28,8 @@ BuildRequires: apache-commons-cli
BuildRequires: apache-commons-codec
BuildRequires: apache-commons-logging
BuildRequires: apache-commons-collections
-# BuildRequires: apache-mime4j
+BuildRequires: apache-mime4j >= 0:0.7.2-2
+BuildRequires: apache-james-project
BuildRequires: bea-stax
BuildRequires: bouncycastle
@@ -104,6 +107,7 @@ Requires: apache-commons-codec
Requires: apache-commons-collections
Requires: apache-commons-lang
Requires: apache-commons-logging
+Requires: apache-mime4j >= 0:0.7.2-2
# B:
Requires: bea-stax
@@ -172,6 +176,7 @@ This package contains the API documentation for %{name}.
%patch1 -p1 -b .p1
%patch2 -p1 -b .p2
%patch3 -p1
+%patch4 -p1
%build
mvn-rpmbuild -Dmaven.test.skip=true -e install javadoc:aggregate
@@ -214,6 +219,7 @@ providers/jaxb resteasy-jaxb-provider
providers/jettison resteasy-jettison-provider
providers/resteasy-atom resteasy-atom-provider
providers/resteasy-html resteasy-html
+providers/multipart resteasy-multipart-provider
providers/yaml resteasy-yaml-provider
resteasy-bom resteasy-bom
resteasy-guice resteasy-guice
@@ -229,7 +235,6 @@ tjws tjws
# async-http-jbossweb/async-http-jbossweb-jar async-http-jbossweb
# async-http-tomcat/asynch-http-tomcat-jar async-http-tomcat6
# eagledns eagledns-fork
-# providers/multipart resteasy-multipart-provider
# providers/resteasy-hibernatevalidator-provider resteasy-hibernatevalidator-provider
# resteasy-cache/resteasy-cache-core resteasy-cache-core
# resteasy-links resteasy-links
@@ -252,6 +257,9 @@ cp -rp target/site/apidocs/* %{buildroot}%{_javadocdir}/%{name}
%doc License.html
%changelog
+* Tue Apr 24 2012 Marek Goldmann <mgoldman at redhat.com> 2.3.2-6
+- Added resteasy-multipart-provider module
+
* Mon Apr 23 2012 Juan Hernandez <juan.hernandez at redhat.com> 2.3.2-5
- Fix the async HTTP Servlet 3.0 artifact id
More information about the scm-commits
mailing list