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 Anyone know an answer to this or what forum to put it in??? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Java » Servlets
Bookmark "Anyone know an answer to this or what forum to put it in???" Watch "Anyone know an answer to this or what forum to put it in???" New topic
Author

Anyone know an answer to this or what forum to put it in???

Declan Conlon
Ranch Hand

Joined: Jul 03, 2001
Posts: 34
Hi there people,
Here's the problem. I've written a client-server application that uploads files. It works using raw sockets however this leaves me with a problem, I can't get the Mime Type of the file without using a HTTP method; somthing I don't want to do. Here's another catch, the solution to the problem must work on both a pc and a mac running IE(forgot to mention that the client side applet resides in a browser).
If anyone can help here it would be great, and if you could provide a bit of sample code it would be even better.
Dec
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 16019
    
  20

You may have outclevered yourself. Raw sockets are precisely that: Raw. The MIME type is one of the things that gets sent in the headers of an http transaction - part of that "overhead" you're trying to avoid. To do that with raw sockets, your're just going to have to set aside part of the data stream to hold the content type (MIME type) information.
Unless you're running in a well-controlled environment, an http URL connection is more preferable. It isn't as likely to get blocked by firewalls and is more likely to survive crossing hardware and OS lines.
A lot of people don't realize it, but MIME and http were designed to be codeset-independent. Originally, internet clients could be running EBCDIC and/or character sets with more or fewer than 8 bits per character. They still can if the server's well-behaved.


Customer surveys are for companies who didn't pay proper attention to begin with.
Declan Conlon
Ranch Hand

Joined: Jul 03, 2001
Posts: 34
Is it possible to get the Mime type of file on client side so that I can send it myself. The thing to note is that http is not responsive enough for the sort of real-time information I need ; However I require the mime type so I can send the information back by a standard http method at a later time. It's complicated but this is the way I need to do it. All I need is to get the Mime type of the file I upload client side. It must be possible as the browser gets the information from somewhere, can it be done in Java in a signed applet running on the client browser, or can javascript do it which I can access from my applet, or is there any other way?
Does this make my problem/question any clearer. Hope this will give you some more info so you can help me.
Dec
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Anyone know an answer to this or what forum to put it in???