Results 1 to 2 of 2
  1. #1
    Gatsu is offline Member
    Join Date
    Dec 2012
    Posts
    42
    Rep Power
    0

    Default getting correct mimetypes with MimetypesFileTypeMap

    SOLVED!

    hello, if I try to find my filesnames mimetype like this:

    Java Code:
    mimeTypesMap = new MimetypesFileTypeMap();
    mimeTypesMap.addMimeTypes("text/html html htm HTML");
    
    String fileString = "index.html";
    And then make the header something like this:

    Java Code:
    "Content-Type: " + mimeTypesMap.getContentType(fileString) + "\r\n"
    I get this mimetype:
    Java Code:
    application/octet-stream
    This is in a socketserver so it makes my browser download the file instead of showing the website, any thoughts?
    Last edited by Gatsu; 02-27-2013 at 06:16 AM.

  2. #2
    Gatsu is offline Member
    Join Date
    Dec 2012
    Posts
    42
    Rep Power
    0

    Default Re: getting correct mimetypes with MimetypesFileTypeMap

    ok nvm, i just did something wrong with my system.out.printline :S sorry
    Last edited by Gatsu; 02-27-2013 at 05:38 AM.

Similar Threads

  1. can u tell me w/c one is correct?
    By akocnivek in forum New To Java
    Replies: 4
    Last Post: 10-21-2012, 10:03 AM
  2. Please correct this JSP code
    By rajesh4851 in forum New To Java
    Replies: 5
    Last Post: 06-13-2011, 12:12 PM
  3. Please help - can't seem to correct this...
    By jmjbreezin in forum New To Java
    Replies: 7
    Last Post: 05-09-2011, 01:39 PM
  4. keyTyped is it correct
    By aizen92 in forum New To Java
    Replies: 18
    Last Post: 04-03-2011, 01:47 PM
  5. Syntax correct?
    By dbashby in forum New To Java
    Replies: 5
    Last Post: 09-22-2009, 06:44 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •