本文整理汇总了Java中org.osgi.service.url.AbstractURLStreamHandlerService类的典型用法代码示例。如果您正苦于以下问题:Java AbstractURLStreamHandlerService类的具体用法?Java AbstractURLStreamHandlerService怎么用?Java AbstractURLStreamHandlerService使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
AbstractURLStreamHandlerService类属于org.osgi.service.url包,在下文中一共展示了AbstractURLStreamHandlerService类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: registerTomcatJNDIUrlService
import org.osgi.service.url.AbstractURLStreamHandlerService; //导入依赖的package包/类
private ServiceRegistration registerTomcatJNDIUrlService() {
Properties properties = new Properties();
properties.put(URLConstants.URL_HANDLER_PROTOCOL, "jndi");
final URLStreamHandler handler = new DirContextURLStreamHandler();
return bundleContext.registerService(URLStreamHandlerService.class.getName(),
new AbstractURLStreamHandlerService() {
private final static String EMPTY_STRING = "";
public URLConnection openConnection(URL u) throws IOException {
return new URL(u, EMPTY_STRING, handler).openConnection();
}
}, properties);
}