On which JSP/Servlet server can I use MimeParser?
Basically, MimeParser can be used on all JSP/Servlet servers, because MimeParser fully complies with JSP/Servlet Spec. And, in fact, we confirmed that MimeParser runs well on:
I'm using IBM WebSphere behind Microsoft IIS. When I upload the file larger than 60 KB, I got:
java.io.IOException: Max Content-Length exceeded |
And, as for the file larger than 150 KB, WebSphere sends no response.
This is the bug of the WebSphere plugin for IIS, i.e. the plugin has the difficulties in the communication between WebSphere and IIS. To fix this bug, please apply the WebSphere eFix:
When I try the trial version of MimeParser, I got the following exception:
java.io.IOException: Server returned HTTP response code: 400 for URL: http://voyager.oop-reserch.com/esd21/UserVerify? app=mimetry&id=Your Serial ID |
To set the trial period, the trial version sends your serial ID to our server over the net. The serial ID must be specified in:
The default value of the serial ID is "Your Serial ID", i.e. this property file has the line below as default:
Please edit this line and specify your serial ID in it.
I'm trying the trial version of MimeParser. Why does it take somewhat long time to finish:
To set the trial period, the trial version sends your serial ID to our server over the net. This is why it takes a few seconds to finish this method. But, this is true only for the first call of this method. Moreover, the product version never sends your serial ID over the net. If you need, we will send you another trial version which does not send your serial ID. Please feel free to contact us.
The property files of MimeParser lists a series of mime-types (Content-Type) for the typical image files and PDF/PostScript. But I'd like to upload the files of MicroSoft Word and Excel. Is this possible?
Yes, you can. MimeParser checks the file format by the 2 steps. In the first step, only the Content-Type header in the request can be checked. But, in the second step, the binary contents of the uploaded file can also be checked.
You can write the list of the acceptable Content-Type in:
When you call:
this method returns a Set object including the list of the acceptable Content-Type. The returned Set object can be passed to parseAndSave(...) or parseOnly(...) method. Or, you can pass the Set object created by yourself. At the very early stage, these methods check if Content-Type (mime-type) of the uploaded file is found in the Set object. If not found, these methods will throw the exception, and your Servlet can refuse the upload request. You can add as many Content-Types as you like into:
For example, you may want to add the lines below:
# Text file text/plain=yes # MicroSoft PowerPoint application/vnd.ms-powerpoint=yes # MicroSoft Word application/msword=yes # MicroSoft Excel application/vnd.ms-excel=yes # Lotus Freelance application/vnd.lotus-freelance=yes # Lotus WordPro application/vnd.lotus-wordpro=yes # Lotus 1-2-3 application/vnd.lotus-1-2-3=yes |
So, there is no limit for the acceptable Content-Type, as for the first step.
Please imagine some bad case...
Assuming that you'd like to accept only "image/png", but the bad user may try to upload the text file whose file name is "photo.png".
Even in this case, the Content-Type of this fake file will be "image/png", because the Content-Type is resovled from the file extension (in this case, it is ".png").
The first step cannot detect this problem, and your Servlet will accept the request.
To avoid this problem, MimeParser can check the binary contents of the uploaded file, i.e. if the binary contents do not match with the expected pattern for the Content-Type, MimeParser will throw the exception.
This step is optional, and you can enable/disable this feature just by editing:
In the real world, there are so many file formats. And it is impossible for MimeParser to check the binary contents of all file format. But, you can add your own implementation of:
interface. For example, you may want to check the binary contents of MS Word files. Please define the class like:
which implements:
interface. Then, please add the line like:
into: