org.apache.cxf.resource.ResourceManager类的使用及代码示例

x33g5p2x  于2022-01-29 转载在 其他  
字(7.6k)|赞(0)|评价(0)|浏览(133)

本文整理了Java中org.apache.cxf.resource.ResourceManager类的一些代码示例,展示了ResourceManager类的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。ResourceManager类的具体详情如下:
包路径:org.apache.cxf.resource.ResourceManager
类名称:ResourceManager

ResourceManager介绍

[英]Locates resources that are used at runtime. The ResourceManager queries registered ResourceResolver to find resources.
[中]查找运行时使用的资源。ResourceManager查询注册ResourceResolver以查找资源。

代码示例

代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws

@Resource
public final void setBus(Bus b) {
  bus = b;
  if (bus != null
    && bus.getExtension(ResourceManager.class) != null) {
    bus.getExtension(ResourceManager.class).addResourceResolver(this);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http

protected InputStream getResourceAsStream(String path) {
  InputStream is = ClassLoaderUtils.getResourceAsStream(path, AbstractHTTPServlet.class);
  if (is == null && getBus() != null) {
    ResourceManager rm = getBus().getExtension(ResourceManager.class);
    if (rm != null) {
      is = rm.resolveResource(path, InputStream.class);
    }
  }
  return is;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws

/**
 * @param instance
 */
protected void injectResources(Object instance) {
  if (instance != null && !blockInjection) {
    ResourceManager resourceManager = getBus().getExtension(ResourceManager.class);
    List<ResourceResolver> resolvers = resourceManager.getResourceResolvers();
    resourceManager = new DefaultResourceManager(resolvers);
    resourceManager.addResourceResolver(new WebServiceContextResourceResolver());
    ResourceInjector injector = new ResourceInjector(resourceManager);
    if (Proxy.isProxyClass(instance.getClass()) && getServiceClass() != null) {
      injector.inject(instance, getServiceClass());
      if (!blockPostConstruct) {
        injector.construct(instance, getServiceClass());
      }
    } else {
      injector.inject(instance);
      if (!blockPostConstruct) {
        injector.construct(instance);
      }
    }
  }
}

代码示例来源:origin: apache/cxf

public InputSource getInputSource(String parentLocation, String importLocation) {
  InputStream ins = bus.getExtension(ResourceManager.class).getResourceAsStream(importLocation);
  InputSource is = new InputSource(ins);
  is.setSystemId(importLocation);
  is.setPublicId(importLocation);
  URL url = bus.getExtension(ResourceManager.class).resolveResource(importLocation, URL.class);
  if (url != null) {
    is.setSystemId(url.toString());
    is.setPublicId(url.toString());
  }
  return is;
}

代码示例来源:origin: org.apache.cxf/cxf-core

private static InputStream getResourceAsStream(String resource) {
  InputStream is = ClassLoaderUtils.getResourceAsStream(resource, SSLUtils.class);
  if (is == null) {
    Bus bus = BusFactory.getThreadDefaultBus(true);
    ResourceManager rm = bus.getExtension(ResourceManager.class);
    if (rm != null) {
      is = rm.getResourceAsStream(resource);
    }
  }
  return is;
}

代码示例来源:origin: org.apache.cxf/cxf-rt-core

try {
    if (!StringUtils.isEmpty(db.ref())) {
      return getBus().getExtension(ResourceManager.class).resolveResource(db.ref(),
                                        db.value());
obj = getBus().getProperty(DataBinding.class.getName());

代码示例来源:origin: org.apache.cxf/cxf-rt-frontend-jaxws

private void initializeViaInjection(Handler<?> handler, final Map<String, String> params) {
  if (bus != null) {
    ResourceManager resMgr = bus.getExtension(ResourceManager.class);
    List<ResourceResolver> resolvers = resMgr.getResourceResolvers();
    resolvers.add(new InitParamResourceResolver(params));
    ResourceInjector resInj = new ResourceInjector(resMgr, resolvers);
    resInj.inject(handler);
    resInj.construct(handler);
  }
}

代码示例来源:origin: apache/cxf

public ExtensionManagerImpl(String[] resources,
              ClassLoader cl,
              Map<Class<?>, Object> initialExtensions,
              ResourceManager rm,
              Bus b) {
  loader = cl;
  bus = b;
  activated = initialExtensions;
  resourceManager = rm;
  ResourceResolver extensionManagerResolver =
    new SinglePropertyResolver(EXTENSIONMANAGER_PROPERTY_NAME, this);
  resourceManager.addResourceResolver(extensionManagerResolver);
  resourceManager.addResourceResolver(new ObjectTypeResolver(this));
  load(resources);
  for (Map.Entry<String, Extension> ext : ExtensionRegistry.getRegisteredExtensions().entrySet()) {
    if (!all.containsKey(ext.getKey())) {
      all.put(ext.getKey(), ext.getValue());
      ordered.add(ext.getValue());
    }
  }
}

代码示例来源:origin: apache/cxf

namespacesResolver = new SinglePropertyResolver(ACTIVATION_NAMESPACES_PROPERTY_NAME,
                          e.getNamespaces());
  resourceManager.addResourceResolver(namespacesResolver);
} finally {
  if (null != namespacesResolver) {
    resourceManager.removeResourceResolver(namespacesResolver);

代码示例来源:origin: org.apache.cxf/cxf-api

private Object resolveResource(String resourceName, Class<?> type) {
  if (resourceManager == null) {
    return null;
  }
  return resourceManager.resolveResource(resourceName, type, resourceResolvers);
}

代码示例来源:origin: apache/cxf

public ResourceInjector(ResourceManager resMgr) {
  this(resMgr, resMgr == null ? null : resMgr.getResourceResolvers());
}

代码示例来源:origin: apache/cxf

private static InputStream getResourceAsStream(String resource) {
  InputStream is = ClassLoaderUtils.getResourceAsStream(resource, SSLUtils.class);
  if (is == null) {
    Bus bus = BusFactory.getThreadDefaultBus(true);
    ResourceManager rm = bus.getExtension(ResourceManager.class);
    if (rm != null) {
      is = rm.getResourceAsStream(resource);
    }
  }
  return is;
}

代码示例来源:origin: org.apache.cxf/cxf-bundle-jaxrs

try {
    if (!StringUtils.isEmpty(db.ref())) {
      return getBus().getExtension(ResourceManager.class).resolveResource(db.ref(),
                                        db.value());
obj = getBus().getProperty(DataBinding.class.getName());

代码示例来源:origin: org.apache.cxf/cxf-rt-core

public InputSource getInputSource(String parentLocation, String importLocation) {
  InputStream ins = bus.getExtension(ResourceManager.class).getResourceAsStream(importLocation);
  InputSource is = new InputSource(ins);
  is.setSystemId(importLocation);
  is.setPublicId(importLocation);
  URL url = bus.getExtension(ResourceManager.class).resolveResource(importLocation, URL.class);
  if (url != null) {
    is.setSystemId(url.toString());
    is.setPublicId(url.toString());
  }
  return is;
}

代码示例来源:origin: apache/cxf

private void initializeViaInjection(Handler<?> handler, final Map<String, String> params) {
  if (bus != null) {
    ResourceManager resMgr = bus.getExtension(ResourceManager.class);
    List<ResourceResolver> resolvers = resMgr.getResourceResolvers();
    resolvers.add(new InitParamResourceResolver(params));
    ResourceInjector resInj = new ResourceInjector(resMgr, resolvers);
    resInj.inject(handler);
    resInj.construct(handler);
  }
}

代码示例来源:origin: org.apache.cxf/cxf-rt-core

public ExtensionManagerImpl(String resources[], 
              ClassLoader cl, 
              Map<Class<?>, Object> initialExtensions, 
              ResourceManager rm,
              Bus b) {
  loader = cl;
  bus = b;
  activated = initialExtensions;
  resourceManager = rm;
  ResourceResolver extensionManagerResolver =
    new SinglePropertyResolver(EXTENSIONMANAGER_PROPERTY_NAME, this);
  resourceManager.addResourceResolver(extensionManagerResolver);
  resourceManager.addResourceResolver(new ObjectTypeResolver(this));
  load(resources);
  for (Map.Entry<String, Extension> ext : ExtensionRegistry.getRegisteredExtensions().entrySet()) {
    if (!all.containsKey(ext.getKey())) {
      all.put(ext.getKey(), ext.getValue());
    }
  }
}

代码示例来源:origin: org.apache.cxf/cxf-core

namespacesResolver = new SinglePropertyResolver(ACTIVATION_NAMESPACES_PROPERTY_NAME,
                          e.getNamespaces());
  resourceManager.addResourceResolver(namespacesResolver);
} finally {
  if (null != namespacesResolver) {
    resourceManager.removeResourceResolver(namespacesResolver);

代码示例来源:origin: apache/cxf

private Object resolveResource(String resourceName, Class<?> type) {
  if (resourceManager == null) {
    return null;
  }
  return resourceManager.resolveResource(resourceName, type, resourceResolvers);
}

代码示例来源:origin: org.apache.cxf/cxf-api

public ResourceInjector(ResourceManager resMgr) {
  this(resMgr, resMgr == null ? null : resMgr.getResourceResolvers());
}

代码示例来源:origin: org.apache.cxf/cxf-rt-transports-http

try {
  if (bus != null) {
    ClassLoader loader = bus.getExtension(ClassLoader.class);
    if (loader == null) {
      ResourceManager manager = bus.getExtension(ResourceManager.class);
      if (manager != null) {
        loader = manager.resolveResource("", ClassLoader.class);

相关文章