1

I Wants to replace sun.net.www.MimeTable and sun.net.www.MimeEntry from code since getting warning "MimeTable is internal proprietary API and may be removed in a future release". Please help me with which new API replaced it and which one I should use. Below is my code for which mimeDescription is input as a string.

sun.net.www.MimeTable mimeTable = sun.net.www.MimeTable.getDefaultTable();
sun.net.www.MimeEntry mimeEntry = mimeTable.find(mimeDescription);

if (mimeEntry == null) {
        // try findByDescription()
        mimeEntry = mimeTable.findByDescription(mimeDescription);
        if (mimeEntry == null) {
            LOG.info ( "Couldn't find mimeDescription=" + mimeDescription);
            return null;
        }
    }
    return mimeEntry.getExtensions();
ashrafi iqbal
  • 69
  • 1
  • 1
  • 9
  • Since you tagged this question [java-ee] for an unclear reason, may we assume that you can easily grab a `ServletContext` instance and in turn use its `getMimeType()` method whose results are configurable via `` entries in `web.xml`? See also a.o. http://stackoverflow.com/q/5096862 – BalusC Apr 05 '16 at 10:12

1 Answers1

0

You should instead be using HttpURLConnection or the one from Apache - HttpClient for more functionalities. Read this.

Community
  • 1
  • 1
Prashant
  • 4,775
  • 3
  • 28
  • 47