users@jersey.java.net

RE: [Jersey] Question: Best practices related to Eclipse project structure

From: Andrew R Feller <afelle1_at_lsu.edu>
Date: Fri, 6 Feb 2009 05:33:17 -0600

Good morning Paul,

Thank you for your response; I appreciate the help!

My initial work with Jersey and file transmissions was based on multipart, however we had some concern of whether Lotus Domino 7+ could issue the necessary requests from a Domino LotusScript or Java agent. Since Lotus Domino 7+ introduced Web Services in the form of SOAP, we knew we could build XML. However now that I think of it, we would still need some type of HTTP client to issue the GET/POST/PUT/DELETE operations. If the client included a form submission API, then we could do multipart mixed.

Let me see about brainstorming with my colleague on exactly what we can get Domino to do.

Thanks again Paul,
Andrew
-- 
Andrew Feller, Analyst
LSU University Information Services
200 Frey Computing Services Center
Baton Rouge, LA 70803
Office: 225.578.3737
Fax: 225.578.6400
-----Original Message-----
From: Paul Sandoz [mailto:Paul.Sandoz_at_Sun.COM]
Sent: Fri 2/6/2009 2:56 AM
To: users_at_jersey.dev.java.net
Subject: Re: [Jersey] Question: Best practices related to Eclipse project structure
 
Hi Andrew,
It does seem like using multipart/mixed with Jersey MultiPart support  
would be a better fit than using XML and base64 encoding (which is  
grotesquely inefficient for large documents, although you could use  
MTOM).
If you use multipart/mixed then clients are sort of "obligated" to  
provide a Content-Type that declares the media type. Which leaves you  
to deal with an edge case of when no Content-Type is present.
I am wondering if there is a simple utility in the JDK or JavaMail to  
determine the media type from a sequence of bytes.
Paul.
On Feb 5, 2009, at 10:09 PM, Andrew Feller wrote:
> Craig,
>
> I read one of your earlier posts where you recommended using Java  
> Mail API for MIME discovery, however I was looking for a way to  
> determine MIME types from a java.io.File or java.io.InputStream.  I  
> am working on a Jersey REST resource that consumes XML that  
> contains multiple Base64 encoded documents (PDFs, images, MS Office  
> documents) and transforms them into PDFs.  As you can guess, I need  
> to determine whether a file is a PDF or not.  I noticed the  
> multipart project could do this with MultiPart objects, but didn't  
> know if there was a way to do it natively in Sun provided libraries.
>
> I also realized there could be some use for MultiPart utilities  
> that could easily glean file attachment information such as file  
> name instead of doing something like:
>
> MultiPart.getBodyParts().get(#).getParameterizedHeaders().get 
> ("Content-Disposition").get(0).getParameters().get("filename"));
>
> Thanks and keep up the good work,
> Andrew
>
> On 2/5/09 1:37 PM, "Craig McClanahan" <Craig.McClanahan_at_Sun.COM>  
> wrote:
>
>> Andrew Feller wrote:
>>> Re: [Jersey] Question: Best practices related to Eclipse project  
>>> structure Craig,
>>>
>>> Very neat!
>>>
>>> Are you still working on the jersey-multipart project?
>> I am.
>>>  If so, have you considered any type of utility classes for  
>>> working with multipart attachments?  Aside from the Java Mail API  
>>> library, is there any library you recommend for determining MIME  
>>> types from input streams?
>>>
>>>
>> Well, jersey-multipart already figures out the MIME types of each  
>> body part for you -- see BodyPart.getMediaType() -- in fact, it  
>> uses JavaMail under the covers to parse the incoming multipart  
>> message bodies.  Is there some particular functionality that you  
>> think is missing?
>>> Thanks again Craig,
>>> Andrew
>>>
>>>
>> Craig
>>
>>
>
> -- 
> Andrew Feller, Analyst
> LSU University Information Services
> 200 Frey Computing Services Center
> Baton Rouge, LA 70803
> Office: 225.578.3737
> Fax: 225.578.6400