• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Providers类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.glassfish.jersey.internal.inject.Providers的典型用法代码示例。如果您正苦于以下问题:Java Providers类的具体用法?Java Providers怎么用?Java Providers使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Providers类属于org.glassfish.jersey.internal.inject包,在下文中一共展示了Providers类的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: activate

import org.glassfish.jersey.internal.inject.Providers; //导入依赖的package包/类
/**
 * Finds all Jersey components that provide a specific contract, and invokes a callback with each discovered component to activate it.
 *
 * @param contract
 *     The contract that components must implement
 * @param consumer
 *     Callback to provide for each discovered component
 * @param <T>
 *     Type of the component to find and activate
 */
protected <T> void activate(@NonNull Class<T> contract, @NonNull ComponentConsumer<T> consumer) {
    Providers.getAllServiceHandles(locator, contract).forEach(handle -> {
        String name    = handle.getActiveDescriptor().getName();
        T      service = handle.getService();
        if (name == null) {
            name = getName(service.getClass());
        }
        consumer.accept(name, service);
    });
}
 
开发者ID:baharclerode,项目名称:dropwizard-hk2,代码行数:21,代码来源:ComponentActivator.java


示例2: configure

import org.glassfish.jersey.internal.inject.Providers; //导入依赖的package包/类
/**
 * {@inheritDoc}
 */
@Override
@SuppressWarnings("unchecked")
public boolean configure(FeatureContext context) {
    context.register(new WebSocketBinder());
    if (serverContainer == null) {
        logger.warn(Messages.get("web.socket.server.unsupported"));
    }

    for (Class endpointClass : endpointClasses) {
        WebSocket webSocket = getAnnotation(WebSocket.class, endpointClass);
        if (webSocket == null) continue;
        Class<? extends Annotation> scope = getScope(endpointClass);
        final Binding binding = Bindings.service(endpointClass).to(endpointClass).in(scope);
        Providers.getProviderContracts(endpointClass).forEach(binding::to);
        injectionManager.register(binding);
        DefaultServerEndpointConfig endpointConfig = new DefaultServerEndpointConfig(
                injectionManager,
                endpointClass,
                webSocket
        );
        if (serverContainer != null) {
            try {
                serverContainer.addEndpoint(endpointConfig);
            } catch (DeploymentException e) {
                throw new WebSocketException(e);
            }
        }
        if (webSocket.withSockJS()) {
            // create resource use modelProcessor
        }
    }

    return true;
}
 
开发者ID:icode,项目名称:ameba,代码行数:38,代码来源:WebSocketAddon.java


示例3: getTemplateProcessors

import org.glassfish.jersey.internal.inject.Providers; //导入依赖的package包/类
/**
 * Get a {@link java.util.LinkedHashSet collection} of available template processors.
 *
 * @return set of template processors.
 */
private Set<TemplateProcessor> getTemplateProcessors() {
    final Set<TemplateProcessor> templateProcessors = Sets.newLinkedHashSet();

    templateProcessors.addAll(Providers.getCustomProviders(injectionManager, TemplateProcessor.class));
    templateProcessors.addAll(Providers.getProviders(injectionManager, TemplateProcessor.class));

    return templateProcessors;
}
 
开发者ID:icode,项目名称:ameba,代码行数:14,代码来源:ViewableMessageBodyWriter.java


示例4: getViewableContext

import org.glassfish.jersey.internal.inject.Providers; //导入依赖的package包/类
/**
 * Get {@link org.glassfish.jersey.server.mvc.spi.ViewableContext viewable context}.
 * User defined (custom) contexts have higher priority than the default ones
 * (i.e. {@link ResolvingViewableContext}).
 *
 * @return {@code non-null} viewable context.
 */
private ViewableContext getViewableContext() {
    final Set<ViewableContext> customProviders =
            Providers.getCustomProviders(injectionManager, ViewableContext.class);
    if (!customProviders.isEmpty()) {
        return customProviders.iterator().next();
    }
    return Providers.getProviders(injectionManager, ViewableContext.class).iterator().next();
}
 
开发者ID:icode,项目名称:ameba,代码行数:16,代码来源:ViewableMessageBodyWriter.java


示例5: getTemplateProcessors

import org.glassfish.jersey.internal.inject.Providers; //导入依赖的package包/类
private Set<TemplateProcessor> getTemplateProcessors() {
    Set<TemplateProcessor> templateProcessors = Sets.newLinkedHashSet();

    templateProcessors.addAll(Providers.getCustomProviders(injectionManager, TemplateProcessor.class));
    templateProcessors.addAll(Providers.getProviders(injectionManager, TemplateProcessor.class));
    return templateProcessors;
}
 
开发者ID:icode,项目名称:ameba,代码行数:8,代码来源:NotFoundForward.java


示例6: OptionsMethodProcessor

import org.glassfish.jersey.internal.inject.Providers; //导入依赖的package包/类
/**
 * Creates new instance.
 *
 * @param manager a {@link InjectionManager} object.
 */
@Inject
public OptionsMethodProcessor(InjectionManager manager) {
    methodList = Lists.newArrayList();

    methodList.add(new ModelProcessorUtil.Method(HttpMethod.OPTIONS, WILDCARD_TYPE, WILDCARD_TYPE,
            GenericOptionsInflector.class));

    generators = Providers.getAllRankedSortedProviders(manager, OptionsResponseGenerator.class);
}
 
开发者ID:icode,项目名称:ameba,代码行数:15,代码来源:OptionsMethodProcessor.java


示例7: getStreamingProcesses

import org.glassfish.jersey.internal.inject.Providers; //导入依赖的package包/类
/**
 * <p>getStreamingProcesses.</p>
 *
 * @param manager InjectionManager.
 * @return a {@link java.lang.Iterable} object.
 */
public static Iterable<StreamingProcess> getStreamingProcesses(InjectionManager manager) {
    return Providers.getAllProviders(manager, StreamingProcess.class);
}
 
开发者ID:icode,项目名称:ameba,代码行数:10,代码来源:MessageHelper.java


示例8: getTransformer

import org.glassfish.jersey.internal.inject.Providers; //导入依赖的package包/类
/**
 * <p>getTransformer.</p>
 *
 * @param transformerClass a {@link java.lang.Class} object.
 * @param <R>              Result.
 * @param <T>              Transformer.
 * @return a {@link java.lang.Iterable} object.
 */
protected <R, T extends Transformer<Transformed<R>>> Iterable<T> getTransformer(Class<T> transformerClass) {
    return Providers.getAllRankedSortedProviders(manager, transformerClass);
}
 
开发者ID:icode,项目名称:ameba,代码行数:12,代码来源:EbeanExprInvoker.java



注:本文中的org.glassfish.jersey.internal.inject.Providers类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java LetterNotFoundException类代码示例发布时间:2022-05-23
下一篇:
Java ConnectionProxy类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap