File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Servlets and the fly likes What Is The Accepted Content-type for JAR Files? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "What Is The Accepted Content-type for JAR Files?" Watch "What Is The Accepted Content-type for JAR Files?" New topic
Author

What Is The Accepted Content-type for JAR Files?

Tony Alicea
Desperado
Sheriff

Joined: Jan 30, 2000
Posts: 3222
    
    5
I can't believe it.
mycgiserver.com, a JAVA server (free) service is serving the JAR (Java Archive) files with Content-Type: text/plain !!!
This is what the program that I wrote returns for a JAR file in said server:

Is anyone here a Java server admin that can tell me what is the convention to use (before I go to Sun's site and look for a JAR file!) I will then report the bug to mycgiserver.com.
Needles to say, some browsers will try to display the JAR file as text on the screen, producing garbage as expected. I want the File/Save dialog box to appear instead, as it does with ZIP files, which is how I have been getting around the problem. I am just tired of having to rename *.JAR to *.ZIP as workarounds.
I expect that ignorance from say, GeoCities.com but not from a JAVA service!
Thanks!
PS: The Content-Type: for a ZIP file from that server is application/zip.
[ May 18, 2002: Message edited by: Tony Alicea ]


Tony Alicea
Senior Java Web Application Developer, SCPJ2, SCWCD
Ming Chen
Greenhorn

Joined: Mar 14, 2002
Posts: 13
There is nothing to do with mycgiserver.com.
It's your own program which could not tell what the MIME type of .jar bolongs to.
David G Risner
Ranch Hand

Joined: May 02, 2002
Posts: 30
I think that Ming Chen is probably right about it not being a problem with the server unless your program is actually getting the Content-Type header.
The place to look for Mime-Types is: ftp://ftp.isi.edu/in-notes/iana/assignments/media-types/media-types
Looking there, I don't see an entry for jar files, so I would use the same one as for zip.


David G. Risner<br />Software Engineer<br />California State University, Los Angeles
Gagan Indus
Ranch Hand

Joined: Feb 28, 2001
Posts: 346
application/octet-stream or application/java-archive or something similar would have been more appropriate
And i agree with Tony . Mycgiserver guys are expected to map content-type for jar-files in their web-server's conf ( do they use apache? )
[ At least the default for jar should have been a binary type instead of text/plain ]
And i do NOT think that Tony's program is the actual culprit , as Ming or David opined.


Gagan (/^_^\) SCJP2 SCWCD IBM486 <br />Die-hard JavaMonk -- little Java a day, keeps you going.<br /><a href="http://www.objectfirst.com/blog" target="_blank" rel="nofollow">My Blog</a>
 
jQuery in Action, 2nd edition
 
subject: What Is The Accepted Content-type for JAR Files?
 
Similar Threads
New MasterCard Ad
Message to Osama from Boeing
HF EJB Code Examples JAR Has Wrong MIME Type
Photo of the Century
Content-type for JAR Files?