synchronized ContentHandler getContentHandler ( ) throws IOException { String contentType = stripOffParameters ( getContentType ( ) ) ; ContentHandler handler = null ; if ( contentType == null ) { if ( ( contentType = guessContentTypeFromName ( url . getFile ( ) ) ) == null ) { contentType = guessContentTypeFromStream ( getInputStream ( ) ) ; } } if ( contentType == null ) { return UnknownContentHandler . INSTANCE ; } try { handler = ( ContentHandler ) handlers . get ( contentType ) ; if ( handler != null ) return handler ; } catch ( Exception e ) { } if ( factory != null ) handler = factory . createContentHandler ( contentType ) ; if ( handler == null ) { try { handler = lookupContentHandlerClassFor ( contentType ) ; } catch ( Exception e ) { e . printStackTrace ( ) ; handler = UnknownContentHandler . INSTANCE ; } handlers . put ( contentType , handler ) ; } return handler ; }
Gets the Content Handler appropriate for this connection .