Hi Luigi The jersey artifacts you are referring to work only with jersey. The message body of a mulipart request can be parsed with standard jax-rs means.
Clerezza has a MessageBodyReader to parse Multi-Part requests. Rather than using Non-Standard annotations you can use MultiPartBody. Simply let your method have an unnatoated argument of type MultiPartBody. http://clerezza.apache.org/apidocs/org/apache/clerezza/jaxrs/utils/form/MultiPartBody.html Cheers, Reto On Tue, Feb 4, 2014 at 4:32 PM, Luigi Selmi <[email protected]> wrote: > Hi all, > > I need to upload rdf files to a service to be stored in a graph. I use > Clerezza within Stanbol and tried to implement the service like in the > following code snippet > > @POST > @Path("multipartrdf") > @Consumes(MediaType.MULTIPART_FORM_DATA) > @Produces("text/plain") > public String uploadMultipartRdf(@Context final UriInfo uriInfo, > @HeaderParam("Content-Type") String mediaType, > @FormDataParam("data") InputStream stream, > @FormDataParam("dataset") String dataset) throws Exception { > > AccessController.checkPermission(new AllPermission()); > final MGraph graph = new SimpleMGraph(); > > if(mediaType.equals(SupportedFormat.RDF_XML)) { > parser.parse(graph, stream, SupportedFormat.RDF_XML); > } > > The problem here is that I need to add the following dependencies to my > project's pom file > > <dependency> > <groupId>com.sun.jersey</groupId> > <artifactId>jersey-server</artifactId> > <version>1.8</version> > </dependency> > <dependency> > <groupId>com.sun.jersey.contribs</groupId> > <artifactId>jersey-multipart</artifactId> > <version>1.8</version> > </dependency> > </dependencies> > > The project is compiled but is not activated when I try to install it > because I need to import the same bundles in the Felix framework and it > raises the following conflicts: > > Cannot start (org.osgi.framework. > BundleException: Uses constraint violation. Unable to resolve bundle > revision eu.fusepool.datalifecycle [182.1] because it is exposed to package > 'javax.ws.rs' from bundle revisions com.sun.jersey.core [274.0] and > javax.ws.rs-api [267.0] via two dependency chains. > > Chain 1: > eu.fusepool.datalifecycle [182.1] > import: (&(osgi.wiring.package=javax.ws.rs > )(version>=1.0.0)(!(version>=3.0.0))) > | > export: osgi.wiring.package=javax.ws.rs > com.sun.jersey.core [274.0] > > Chain 2: > eu.fusepool.datalifecycle [182.1] > import: (osgi.wiring.package=org.apache.clerezza.jaxrs.utils) > | > export: osgi.wiring.package=org.apache.clerezza.jaxrs.utils; uses:= > javax.ws.rs > org.apache.clerezza.jaxrs.utils [147.0] > import: (&(osgi.wiring.package=javax.ws.rs > )(version>=1.0.0)(!(version>=3.0.0))) > | > export: osgi.wiring.package=javax.ws.rs > javax.ws.rs-api [267.0]) org.osgi.framework.BundleException: Uses > constraint violation. Unable to resolve bundle revision > eu.fusepool.datalifecycle [182.1] because it is exposed to package ' > javax.ws.rs' from bundle revisions com.sun.jersey.core [274.0] and > javax.ws.rs-api [267.0] via two dependency chains. > > Looking at the Clarezza API it seems there are some utilities to handle > multipart messages so that I shouldn't have the issues above but I couldn't > find any code snippet or example on how to use those utilities, can anyone > point me to an example ? > > Thanks in advance > > Luigi >
