1 9 package org.eclipse.osgi.framework.internal.protocol; 10 11 import java.io.IOException ; 12 import java.net.ContentHandler ; 13 import java.net.URLConnection ; 14 15 public class MultiplexingContentHandler extends ContentHandler { 16 17 private String contentType; 18 private ContentHandlerFactory factory; 19 20 public MultiplexingContentHandler(String contentType, ContentHandlerFactory factory) { 21 this.contentType = contentType; 22 this.factory = factory; 23 } 24 25 public Object getContent(URLConnection uConn) throws IOException { 26 ContentHandler handler = factory.findAuthorizedContentHandler(contentType); 27 if (handler != null) 28 return handler.getContent(uConn); 29 30 return uConn.getInputStream(); 31 } 32 33 } 34 | Popular Tags |