users@jersey.java.net

[Jersey] Building jersey-multipart responses

From: Larry Touve <larry.touve_at_baesystems.com>
Date: Mon, 22 Dec 2008 16:02:52 -0800 (PST)

I'm using Jersey for building OGC compliant Web Services. I'm currently
working on a Web Coverage Service, and discovered the jersey-multipart code
that is just what I need. However, I have been unable to figure out how to
set specific items in the header. Is it possible to set the Content-ID and
the Content-Description for the BodyParts?

Thanks,
 Larry

Here's my code:

@Path("/Coverage/{arg1}")
public class CoverageProvider
{
   :

    @GET
    @Produces("multipart/mixed")
    public Response getCoverage()
    {
        MultivaluedMap<String, String> map = uri.getPathParameters();
        String arg1 = map.getFirst("arg1");
        FileDataSource image = ... (gets the image file)
        String coverageInfo = ... (gets the xml structured coverage
information)
        
        MultiPart multiPart = new MultiPart().
                bodyPart(new BodyPart(coverageInfo,
MediaType.APPLICATION_XML_TYPE)).
                bodyPart(new BodyPart(image, new MediaType("image",
"nitf")));
        
        return Response.ok(multiPart,
MultiPartMediaTypes.MULTIPART_MIXED_TYPE).build();
    }
 :
}
-- 
View this message in context: http://n2.nabble.com/Building-jersey-multipart-responses-tp1692151p1692151.html
Sent from the Jersey mailing list archive at Nabble.com.