clerezza-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From r...@apache.org
Subject svn commit: r1455188 - /clerezza/trunk/jaxrs.utils/src/main/java/org/apache/clerezza/jaxrs/utils/form/MultiPartFormMessageBodyReader.java
Date Mon, 11 Mar 2013 15:37:48 GMT
Author: reto
Date: Mon Mar 11 15:37:48 2013
New Revision: 1455188

URL: http://svn.apache.org/r1455188
Log:
CLEREZZA-738: checking for compatibility of the class type

Modified:
    clerezza/trunk/jaxrs.utils/src/main/java/org/apache/clerezza/jaxrs/utils/form/MultiPartFormMessageBodyReader.java

Modified: clerezza/trunk/jaxrs.utils/src/main/java/org/apache/clerezza/jaxrs/utils/form/MultiPartFormMessageBodyReader.java
URL: http://svn.apache.org/viewvc/clerezza/trunk/jaxrs.utils/src/main/java/org/apache/clerezza/jaxrs/utils/form/MultiPartFormMessageBodyReader.java?rev=1455188&r1=1455187&r2=1455188&view=diff
==============================================================================
--- clerezza/trunk/jaxrs.utils/src/main/java/org/apache/clerezza/jaxrs/utils/form/MultiPartFormMessageBodyReader.java
(original)
+++ clerezza/trunk/jaxrs.utils/src/main/java/org/apache/clerezza/jaxrs/utils/form/MultiPartFormMessageBodyReader.java
Mon Mar 11 15:37:48 2013
@@ -28,18 +28,19 @@ import javax.ws.rs.core.MediaType;
 import javax.ws.rs.core.MultivaluedMap;
 import javax.ws.rs.ext.MessageBodyReader;
 import javax.ws.rs.ext.Provider;
+import org.apache.felix.scr.annotations.Component;
+import org.apache.felix.scr.annotations.Property;
+import org.apache.felix.scr.annotations.Service;
 
 /**
  * This JAX-RS provider converts a request body of the content type
  * "multipart/form-data" (format according RFC 2388) into a
  * <code>MultiPartBody</code> object.
  * 
- * @scr.component
- * @scr.service interface="java.lang.Object"
- * @scr.property name="javax.ws.rs" type="Boolean" value="true"
- * 
- * @author rbn
  */
+@Component
+@Service(Object.class)
+@Property(name="javax.ws.rs", boolValue=true)
 @Provider
 @Consumes("multipart/form-data")
 public class MultiPartFormMessageBodyReader implements
@@ -48,8 +49,9 @@ public class MultiPartFormMessageBodyRea
 	@Override
 	public boolean isReadable(Class<?> type, Type genericType,
 			Annotation[] annotations, MediaType mediaType) {
-		return (mediaType.getType().equals("multipart") && mediaType
-				.getSubtype().equals("form-data"));
+		return type.isAssignableFrom(MultiPartBody.class) 
+                && mediaType.getType().equals("multipart") 
+                && mediaType.getSubtype().equals("form-data");
 	}
 
 	@Override



Mime
View raw message