Re: How to get file extention from Content-type.



Thanks Thomas...

Sorry for confusion caused..

My problem is I want to handle mail attachments. and some mail client
like Lotus notes sends attachments without file names.
So my issue is I want to create temporary file for handling attachment
without file name. So for that I want to have correct file extension.
And for that I need to get File extesion from Content Type(Mime Type)

So how to get file extesion from file name.

Thanks
Shilpa


Thomas Weidenfeller wrote:
> shilpa wrote:
> > I want to get file extention from file's content-type.
> > I wanted to handle file with blank name in my mail client.
> > For handling this I need to create temporary file. For that I need to
> > decide file extention based on content-type.
> >
> > getFileNameMap(..) function of UrlConnection constructs FileNameMap but
> > FileNameMap has method just to fetch content type from file extetion. I
> > want exactly opposite of this i.e File extention from Content-Type.
>
> Sorry, but this doesn't make much sense. You talk about e-mail (which
> would be POP3, IMAP, SMTP or similar), then you talk about a file, but
> then you also talk about URLConnection (which would mean HTTP). So what
> is it from what you want to get some content type information? And what
> content type? I would guess we are talking MIME types here, aren't we?
>
> If it is e-mail, then JavaMail has the means to extract MIME parts from
> a mail and provide you with the MIME types of the parts. If it is a file
> you probably want the JavaBeans Activation Framework (JAF) alone. If it
> is HTTP and URLConnection is not enough, you might want to look into
> Apache/Jakarta/Commons.
>
> /Thomas
>
> --
> The comp.lang.java.gui FAQ:
> ftp://ftp.cs.uu.nl/pub/NEWS.ANSWERS/computer-lang/java/gui/faq
> http://www.uni-giessen.de/faq/archiv/computer-lang.java.gui.faq/

.



Relevant Pages

  • Re: How to get file extention from Content-type.
    ... I wanted to handle file with blank name in my mail client. ... then you also talk about URLConnection (which would mean HTTP). ... I would guess we are talking MIME types here, ...
    (comp.lang.java.programmer)
  • Re: How to get file extention from Content-type.
    ... > like Lotus notes sends attachments without file names. ... So for that I want to have correct file extension. ... >>> I wanted to handle file with blank name in my mail client. ... I would guess we are talking MIME types here, ...
    (comp.lang.java.programmer)
  • Re: Limiting Attachments in mails to selected receipients
    ... Hope to see inputs from other users on desirebility of this feature. ... Mail may require any respondant to send attachments as reply which typically ... Currenltly Outlook does not offer the feature to select recipients of ... A mail client would have to create and send two completely separate messages, ...
    (microsoft.public.outlook.general)
  • Re: Limiting Attachments in mails to selected receipients
    ... Many a times mail thread have managers etc on cc to aprise them ... Mail may require any respondant to send attachments as reply which typically ... When a mail client talks to a server, it says, "here's who I am", "this is who is sending the message", "here are those who should receive it", and "here is the message body". ... Mail protocols do not have distinctions among the recipients. ...
    (microsoft.public.outlook.general)
  • Re: [PATCH] Patches for tiny 386 kernels, again. Linux kernel 2.6.22.7
    ... attachments, and given that attachments can be saved easily without ... capable mail agent, if only for patches, instead of trying to teach many ... Ehm, so you want people to save the patch, then when replying they ... should load the patch into their mail client where they ...
    (Linux-Kernel)