public String getContentType ( ) { if ( contentType == null ) contentType = getHeaderField ( "content-type" ) ; if ( contentType == null ) { String ct = null ; try { ct = guessContentTypeFromStream ( getInputStream ( ) ) ; } catch ( java . io . IOException e ) { } String ce = properties . findValue ( "content-encoding" ) ; if ( ct == null ) { ct = properties . findValue ( "content-type" ) ; if ( ct == null ) if ( url . getFile ( ) . endsWith ( "/" ) ) ct = "text/html" ; else ct = guessContentTypeFromName ( url . getFile ( ) ) ; } /* * If the Mime header had a Content-encoding field and its value * was not one of the values that essentially indicate no * encoding, we force the content type to be unknown. This will * cause a save dialog to be presented to the user. It is not * ideal but is better than what we were previously doing, namely * bringing up an image tool for compressed tar files. */ if ( ct == null || ce != null && ! ( ce . equalsIgnoreCase ( "7bit" ) || ce . equalsIgnoreCase ( "8bit" ) || ce . equalsIgnoreCase ( "binary" ) ) ) ct = "content/unknown" ; setContentType ( ct ) ; } return contentType ; }
Call this routine to get the content - type associated with this object .