本文整理汇总了Java中org.glassfish.jersey.internal.inject.InjectionManager.getInstance方法的典型用法代码示例。如果您正苦于以下问题:Java InjectionManager.getInstance方法的具体用法?Java InjectionManager.getInstance怎么用?Java InjectionManager.getInstance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.glassfish.jersey.internal.inject.InjectionManager
的用法示例。
在下文中一共展示了InjectionManager.getInstance方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: checkQuery
import org.glassfish.jersey.internal.inject.InjectionManager; //导入方法依赖的package包/类
/**
* <p>checkQuery.</p>
*
* @param query a {@link io.ebean.Query} object.
* @param whitelist a {@link java.util.Set} object.
* @param blacklist a {@link java.util.Set} object.
* @param manager a {@link InjectionManager} object.
*/
public static void checkQuery(Query<?> query, Set<String> whitelist,
Set<String> blacklist, InjectionManager manager) {
ResourceInfo resource = manager.getInstance(ResourceInfo.class);
Class<?> rc = resource.getResourceClass();
Set<String> wl = null, bl = null;
if (rc != null) {
Filter filter = rc.getAnnotation(Filter.class);
if (filter != null) {
if (filter.whitelist().length > 0) {
wl = Sets.newLinkedHashSet();
Collections.addAll(wl, filter.whitelist());
}
if (filter.blacklist().length > 0) {
bl = Sets.newLinkedHashSet();
Collections.addAll(bl, filter.blacklist());
}
}
}
if (whitelist != null) {
if (wl == null) {
wl = Sets.newLinkedHashSet();
}
wl.addAll(whitelist);
}
if (blacklist != null) {
if (bl == null) {
bl = Sets.newLinkedHashSet();
}
bl.addAll(blacklist);
}
checkQuery((SpiQuery) query, wl, bl, manager.getInstance(Application.Mode.class).isProd());
}
示例2: DefaultServerEndpointConfig
import org.glassfish.jersey.internal.inject.InjectionManager; //导入方法依赖的package包/类
/**
* <p>Constructor for DefaultServerEndpointConfig.</p>
*
* @param manager a manager
* @param endpointClass a {@link java.lang.Class} endpoint class.
* @param webSocketConf a {@link ameba.websocket.WebSocket} object.
*/
public DefaultServerEndpointConfig(final InjectionManager manager,
Class endpointClass,
final WebSocket webSocketConf) {
path = webSocketConf.path();
subprotocols = Arrays.asList(webSocketConf.subprotocols());
encoders = Lists.newArrayList(webSocketConf.encoders());
decoders = Lists.newArrayList(webSocketConf.decoders());
for (Class<? extends Extension> extensionClass : webSocketConf.extensions()) {
extensions.add(Injections.getOrCreate(manager, extensionClass));
}
final WebSocketEndpointProvider provider = manager.getInstance(WebSocketEndpointProvider.class);
final EndpointMeta endpointMeta = provider.parseMeta(endpointClass, webSocketConf);
final ServerEndpointConfig.Configurator cfgr =
Injections.getOrCreate(manager, webSocketConf.configurator());
serverEndpointConfigurator = new ServerEndpointConfig.Configurator() {
@Override
public String getNegotiatedSubprotocol(List<String> supported, List<String> requested) {
return cfgr.getNegotiatedSubprotocol(supported, requested);
}
@Override
public List<Extension> getNegotiatedExtensions(List<Extension> installed, List<Extension> requested) {
return cfgr.getNegotiatedExtensions(installed, requested);
}
@Override
public boolean checkOrigin(String originHeaderValue) {
return cfgr.checkOrigin(originHeaderValue);
}
@Override
public void modifyHandshake(ServerEndpointConfig sec,
HandshakeRequest request, HandshakeResponse response) {
cfgr.modifyHandshake(sec, request, response);
}
@Override
public <T> T getEndpointInstance(Class<T> eClass) throws InstantiationException {
if (EndpointDelegate.class.equals(eClass)) {
return eClass.cast(new EndpointDelegate(endpointMeta));
}
return cfgr.getEndpointInstance(eClass);
}
};
}