How do I set the mime type for an attachment to "application/zip"

I'm sending out an email with a zip file as an attachment. The following code works fine, but the Mimetype for the attachment is set to "application/octet-stream"
FileDataSource fds = new FileDataSource(zipname);
DataHandler dh = new DataHandler(fds);
MimeBodyPart mbp2 = new MimeBodyPart();
mbp2.setDataHandler(dh);
mbp2.setFileName(fds.getName());
I would like the mime type to be application/x-zip. Unfortunately I seem to need a data content handler for this mime type as I get this exception.
javax.activation.UnsupportedDataTypeException: no object DCH for MIME type application/x-zip
Building a date content handler in the activation framework seems like a lot of work to do a very simple thing. Am I missing something obvious? Is there a simple way to do this?

I found the solution after much chasing around. The default mimetypes file that comes with the activation framework does not list zip.

Similar Messages

  • How do I set the content type ?

    Hi
    I have to upload a file from my Java Application to a remote servlet.
    I have used the HTTPConnection class to connect to the remote servlet and made it call the POST method explicitly.
    How do I set the content type of the file I am uploading from my Java apllication?
    I tried to change the content type in the doPost method. by giving
    req.setContentType("multipart/form-data"); in the doPost.
    It still doesnt work..
    Is there any way to set the content type in the Java application?
    Thanks in advance

    What class is your req variable? If your using a HttpServletRequest, then there is no method req.setContentType("");
    In the HttpServletResponse this is for telling the web browser or receving medium what kind of mime type to expect.
    And what package is the HttpConnection class from?
    I think more precise info is required before this question can be answered.

  • How can i set the alternating colors for a table rows

    Dear All,
    Please any one help me how can i set the Alternating colors for Table Rows.
    i created a theam there i set the background alternating color to brown and i set the table design properity to alternating. but it is not reflecting.

    Hi,
    The design property in Table properties should work for your requirement. Select "alternating" value for design.
    Please see the API below:
    design
    Determines the appearance of the table. The property design can take the following values and is represented by enumeration type WDTableDesign.
    alternating - The table rows are displayed alternately in a different color.
    standard - The table background has one color. The individual table rows are displayed with grid net lines.
    transparent - The table background is transparent. The individual table rows are displayed without grid net lines.
    Check whether you have changed the right property or not? Also table should contain more than one rows to test this scenario.
    Regards,
    Jaya.
    Edited by: VJR on Jun 17, 2009 6:43 PM

  • How can we change the valuation type for a material created.

    How can we change the valuation type for a material created.
    Note : All open orders are closed for this material.3
    Please guide

    Hi,
    You can change valuation class, or you can set valuation category for your material master. If valuation category is set you can extend your material master and in this way creating records for different valuation types.
    Please try to set the desired changes in your mmr (MM02) > save > SAP will give you error message > push 'Display error' button and you will see what conditions must be eliminated to carry out the change.
    - you are not allowed to have open transactional data
    - no stock in the current and previous period (using proper posting date in MB1A + 201 you can reduce your stock level to 0, and after that you can set it back by MB1A + 202)
    - in case of valuation category setting batch archiving may be necessary
    BR
    Csaba

  • How do I set the aspect ration for 4:3  or for 16:9?

    How do I set the aspect ration for 4:3  or for 16:9 in Adobe PE12?

    PulcinellaNM
    What computer operating system is your Premiere Elements 12 running on? Have you updated from 12 to 12.1 Update via a project's Help Menu/Update? If not, please do so. That is all background information for now.
    As for the question that you are posting....
    I think we need to go a lot deeper into what you are doing. Here are some considerations
    The aspect ratio setting is in the import settings. In Premiere Elements 12 Expert workspace, the project automatically sets the project preset based on the properties of the first video file that you drag to the Expert workspace Timeline. If your video's properties include a 16:9 flag, then the project settings will have a 16:9 flag (aspect ratio). If you do not want the project to set the project settings automatically, you can set the project settings yourself manually with File Menu/New/Project and then import your source video.
    If a problem exists where imported 16:9 video is presenting in Premiere Elements as 4:3 instead of 16:9 (typical of the JVC .mod file issue), then you can set the pixel aspect ratio under Interpret Footage feature inside the project workspace.
    At this point, I think it best for you to give more details and background behind your question so that we can be sure that we are giving you the information that you need to succeed in your projects.
    If you need clarification on anything written, please do not hesitate to ask for clarification.
    Thank you.
    ATR

  • How do you set the font color for a specific entire row inside a JTable?

    How do you set the font color for a specific entire row inside a JTable?
    I want to change the font color for only a couple of rows inside a JTable.
    I've seen some ways to possibly do this with an individual cell.
    Clarification on changing the font color in an individual cell would be helpful too if
    there is no easy way to do this for a row.

    hai,
    Try out with this piece of code.Create your table and assign the renderer to each column in the table.
    CellColorRenderer m_CellColorRenderer = new CellColorRenderer();
    for(int i=0;i<your_JTable.getColumnCount();i++)
    your_JTable.getColumnModel().getColumn(i).setCellRenderer(m_CellColorRenderer);
    class CellColorRenderer extends JLabel implements TableCellRenderer
    CellColorRenderer()     
    setOpaque(true);     
    setHorizontalAlignment(LEFT);
    setVerticalAlignment(CENTER);
    setBackground(Color.white);
    setForeground(Color.black);
    protected void setValue(Object value)
         setText((value == null) ? "" : value.toString());
    public Component getTableCellRendererComponent(JTable table,Object value,boolean isSelected, boolean hasFocus, int row,int column)
         if(isSelected == true)
              setForeground(Color.red);
         else
              setForeground(Color.black);
         setValue(value);
         return this;
    regards,
    bala

  • How do you set the default magnification for Acrobat.  All documents that I open enlarge to 174% and are too big.

    How do you set the default magnification for Acrobat.  All documents that I open enlarge to 174% and are too big.  I see how to change the size after the document is open by going to File/properties/initial view and saving this setting.  I want all documents to open at 100% when they are first opened.  Can I set this as a default view?

    Hey Kris,
    You might go to Edit> Preferences> Zoom
    Do this without opening any particular PDF so that it applies to the program itself and not just one document.
    Try this and then let me know.
    Regards,
    Anubha

  • How do I set the default folder for file - open file... ?

    When I save a file, photo, etc., the default folder for OPENING a file becomes the last folder I SAVED to - even after closing and reopening Firefox. Is there a way to maintain the same default folder for opening files?
    Thanks.

    Originally posted by: kwarner.uneedspeed.net
    Well... I found over 200 bugs none of which seemed to talk about setting
    the default folder. I probably missed the relevant bug in the spew.
    I ask a question here as a last resort -- after I've done what I think
    is an appropriate search for answers.
    But thanks for your help in any case.
    Daniel Megert wrote:
    > DemonDuck wrote:
    >
    >> When I need to open a file not in the workspace, I use File -> Open File.
    >>
    >> But the default folder it opens is in C:\Documents and
    >> Setting\Administrator
    >>
    >> I would like File -> Open File to first open in someplace more
    >> reasonable -- like the workspace.
    >>
    >> How do I set the default folder for File -> Open File ????
    >
    >
    > Is your '?' key broken? Check bugzilla there's a feature request
    > regarding your question.
    >
    > Dani

  • How I can get the Billing Type for the sales order and its items

    How I can get the Billing Type for the sales order and its items. I mean from which SAP tables and how?

    Hi,
    You need to use two tables.
    First use VBFA. Enter the sales order number in the field Predecessar and the value M in SubCt field. This will give all the billing document number for the sales order items.
    Then use the billing document numbers in table VBRK, where in you can get the billing document type.
    Regards,

  • The MIME type for xslx file is different in Mozilla 13.0.1

    The MIME type for a xslx file is coming as "application/vnd.ms-excel.12" in Mozilla 13.0.1 instead of the "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" which comes in other browsers when using fileUpload.PostedFile.ContentType

    Firefox usually gets the MIME type from the MIME database registry key.
    * HKEY_CLASSES_ROOT\.xslx
    * HKEY_CLASSES_ROOT\MIME\Database\Content Type

  • How can I set the desktop image for client computers?

    How can I set the desktop image for client computers using ARD or terminal?

    How can I set the desktop image for client computers using ARD or terminal?

  • Cfhttp and setting the content-type for a request

    Hi,
    I am trying to set the content-type for a cfhttp request like this (on coldfusion 9):
    <cfhttp redirect="no" method="get" timeout="120" url="http://10.0.0.1/test2.cfm">
        <cfhttpparam type="HEADER" name="Content-Type" value="application/json; charset=utf-8">
    </cfhttp>
    // coding on test2.cfm:
    <cfset x = GetHttpRequestData()>
    <cfdump var=#x#>
    // Output on test2.cfm
    content
    [empty string]
    headers
    struct
    Accept-Encoding
    deflate, gzip, x-gzip, compress, x-compress
    Connection
    TE
    Host
    10.0.0.1:80
    Proxy-Connection
    close
    TE
    trailers, deflate, gzip, compress
    User-Agent
    ColdFusion
    X-REWRITE-URL
    http://10.0.0.1:80/test2.cfm
    method
    GET
    protocol
    HTTP/1.1
    As you can see no content-type is send through. I also tried the sniffer.exe:
    GET http://10.0.0.1:80/test2.cfm HTTP/1.1
    Host: 127.0.0.1
    Proxy-Connection: close
    Connection: TE
    TE: trailers, deflate, gzip, compress
    User-Agent: ColdFusion
    Accept-Encoding: deflate, gzip, x-gzip, compress, x-compress
    Here you can also see that no content-type was passed through. The sniffer should report back
    GET http://10.0.0.1:80/test2.cfm HTTP/1.1
    Host: 127.0.0.1
    Proxy-Connection: close
    Connection: TE
    TE: trailers, deflate, gzip, compress
    User-Agent: ColdFusion
    Accept-Encoding: deflate, gzip, x-gzip, compress, x-compress
    Content-Type: application/json; charset=utf-8
    But is does not, what do i need todo to set the content-type in a cfhttp request.
    Kind regards,
    Nebu

    12Robots - are you sure about your statement that GET method requests cannot have Content-Type headers?  I don't think that that is correct.  I've always thought that it was valid (maybe unusual, but ...) and this W3C link weems to agree, especially in the context of its comment about what Content-Type means in a HEAD method request: http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html
    The big problem with trying to get around the CFHTTP limitation by using the CGI scope is that the dash is illegal in a CF varname.
    There is a custom tag called CFHTTP5 that getsaround a lot of the CFHTTP limitations, including cookie preservation across multiple requests.  I haven't used it for a long time (CF5), but it is still actively developed.  Costs $50 - http://www.cftagstore.com/tags/cfxhttp5.cfm
    -reed

  • How do I set the home page for a new tab?

    How do I set the web page for when I open a new tab? Whenever I open a new tab it goes to an error site which freezes my firefox browser for a while. How do I change that? I want to open new tabs with google being the home page. I need to set up the homepage for a new tab NOT a new window. Please help! !

    If Google is set as your Homepage in Firefox you can middle-click ''(push down on the mouse wheel)'' to open Google in a new Tab.
    Or, you can add the feature to Firefox where clicking the New Tab button on the Tab Bar opens your Homepage in a new Tab. <br />
    https://addons.mozilla.org/en-US/firefox/addon/new-tab-homepage/
    And if you have a different Homepage set, this extension allows for any page you set in the extension's options to open when you use the new Tab button. <br />
    https://addons.mozilla.org/en-US/firefox/addon/newtaburl/

  • How could I set the proxy settings for just some URLs and not for all?

    Hello,
    I am using HttpURLConnection to establish a HTTP connection . The connection pass through a proxy, and it requires security.
    I know that I can set the proxy settings in the system properties, and this works perfect.
    But I don't want to set the proxy settings in the system properties, because this proxy settings will be for ALL the URLs, and I just want for a few URLs.
    How could I set the proxy settings for just some URLs and not for all?
    Thanks

    java.net.URL.openConnection(java.net.Proxy proxy)
    @since 1.5

  • How do I set the default time for calendar alerts?

    How do I set the default time for calendar alerts? I always want to have an alert 15 minutes before my appointments. I don't want to have to manually set it each time I make an appointment (I just moved to iphone from a windows mobile where this was basic stuff so I apologise if this is a noob question).

    I have the same issue. I've searched these forums and found lots of people who have asked this same question, but nobody who has received an answer.
    About a year ago, I migrated from a Windows PC and a Blackberry (both of which had very simple default alert options) to a MacBook Pro and an iPhone and have yet to find a solution on this forum or from any of my Apple-savvy friends. Very discouraging.

Maybe you are looking for

  • Can't drag files in iMovie

    Someone I have interviewed recorded his video in imovie. I wanted him to export the files but he was unable to drag the clips to the project window. They just kept bouncing back. Any idea what we need to do to be able to export these files?

  • LMS 3.2 DFM error "URN_NOT_FOUND : urn "ogs_server_urn" : Not found !!"

    Hi Joseph, one of our client is using lms 3.2 and getting the following error in DFM -> device import -> Auto Allocation mode configuration. Error in getting instance of TreeGenerator class com.cisco.nm.trx.kdm.utils.DcrGroupSelectorTreeGenerator Roo

  • Show preview/filial JPEG file

    one more :-) I know, I can import images with the JPEGs handled as seperate images. But this is not what I usually want. I would however like, to see the original image produced by the camera. At least a command to add the JPEG file into the stack an

  • H323 Redundancy

    Hello, I have on my network 2 different h323 (non cisco) gateway in two different route groups, also I have a route list with the two route groups, when I make calls that point to that route list the callmanager does not search in the second route gr

  • SAP to third party software and Back to SAP

    hi expects,      i have to take the data from SAP system(4.7) to SAP sytem (5.0) to update third party software and back to SAP (ecc 5.0) again update it.