org.jboss.resteasy.core.Dispatcher.getDefaultContextObjects()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(11.7k)|赞(0)|评价(0)|浏览(125)

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

Dispatcher.getDefaultContextObjects介绍

暂无

代码示例

代码示例来源:origin: atomix/atomix

deployment.start();
deployment.getDispatcher().getDefaultContextObjects()
  .put(ClusterMembershipService.class, atomix.getMembershipService());
deployment.getDispatcher().getDefaultContextObjects()
  .put(ClusterCommunicationService.class, atomix.getCommunicationService());
deployment.getDispatcher().getDefaultContextObjects()
  .put(ClusterEventService.class, atomix.getEventService());
deployment.getDispatcher().getDefaultContextObjects()
  .put(PrimitiveFactory.class, atomix.getPrimitivesService());
deployment.getDispatcher().getDefaultContextObjects()
  .put(PrimitivesService.class, atomix.getPrimitivesService());
deployment.getDispatcher().getDefaultContextObjects()
  .put(EventManager.class, new EventManager());
deployment.getDispatcher().getDefaultContextObjects()
  .put(AtomixRegistry.class, atomix.getRegistry());

代码示例来源:origin: alipay/sofa-rpc

dispatcher.getDefaultContextObjects().putAll(defaultContextObjects);
dispatcher.getDefaultContextObjects().put(Configurable.class, providerFactory);
dispatcher.getDefaultContextObjects().put(Providers.class, providerFactory);
dispatcher.getDefaultContextObjects().put(Registry.class, registry);
dispatcher.getDefaultContextObjects().put(Dispatcher.class, dispatcher);
dispatcher.getDefaultContextObjects().put(InternalDispatcher.class, InternalDispatcher.getInstance());
contextDataMap.putAll(dispatcher.getDefaultContextObjects());
      dispatcher.getDefaultContextObjects().put(key, obj);
      contextDataMap.put(key, obj);

代码示例来源:origin: alipay/sofa-rpc

dispatcher.getDefaultContextObjects().putAll(defaultContextObjects);
dispatcher.getDefaultContextObjects().put(Configurable.class, providerFactory);
dispatcher.getDefaultContextObjects().put(Providers.class, providerFactory);
dispatcher.getDefaultContextObjects().put(Registry.class, registry);
dispatcher.getDefaultContextObjects().put(Dispatcher.class, dispatcher);
dispatcher.getDefaultContextObjects().put(InternalDispatcher.class, InternalDispatcher.getInstance());
contextDataMap.putAll(dispatcher.getDefaultContextObjects());
      dispatcher.getDefaultContextObjects().put(key, obj);
      contextDataMap.put(key, obj);

代码示例来源:origin: stackoverflow.com

public class MyApplication extends Application {
 public MyApplication(@Context Dispatcher dispatcher) {
   MyClass myInstance = new MyClass();
   dispatcher.getDefaultContextObjects().put(MyClass.class, myInstance);
 }
}

代码示例来源:origin: stackoverflow.com

// Constructor of your JAX-RS Application
public RestApplication(@Context Dispatcher dispatcher) {
  dispatcher.getDefaultContextObjects().put(UserProvider.class, new UserProvider());
}

// a resource
public Response getById(@Context UserProvider userProvider) {
  User user = userProvider.get();
}

代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20

public void init(ServletConfig servletConfig) throws ServletException
{
 super.init(servletConfig);
 servletContainerDispatcher = new ServletContainerDispatcher();
 ServletBootstrap bootstrap = new ServletBootstrap(servletConfig);
 servletContainerDispatcher.init(servletConfig.getServletContext(), bootstrap, this, this);
 servletContainerDispatcher.getDispatcher().getDefaultContextObjects().put(ServletConfig.class, servletConfig);
}

代码示例来源:origin: org.jboss.resteasy/resteasy-test-tjws

public void init(ServletConfig servletConfig) throws ServletException
{
 super.init(servletConfig);
 servletContainerDispatcher = new ServletContainerDispatcher();
 ServletBootstrap bootstrap = new ServletBootstrap(servletConfig);
 servletContainerDispatcher.init(servletConfig.getServletContext(), bootstrap, this, this);
 servletContainerDispatcher.getDispatcher().getDefaultContextObjects().put(ServletConfig.class, servletConfig);
}

代码示例来源:origin: org.jboss.resteasy/resteasy-test-tjws

public void init(FilterConfig servletConfig) throws ServletException
{
 servletContainerDispatcher = new ServletContainerDispatcher();
 FilterBootstrap bootstrap = new FilterBootstrap(servletConfig);
 servletContainerDispatcher.init(servletConfig.getServletContext(), bootstrap, this, this);
 servletContainerDispatcher.getDispatcher().getDefaultContextObjects().put(FilterConfig.class, servletConfig);
}

代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20

public void init(FilterConfig servletConfig) throws ServletException
{
 servletContainerDispatcher = new ServletContainerDispatcher();
 FilterBootstrap bootstrap = new FilterBootstrap(servletConfig);
 servletContext = servletConfig.getServletContext();
 servletContainerDispatcher.init(servletContext, bootstrap, this, this);
 servletContainerDispatcher.getDispatcher().getDefaultContextObjects().put(FilterConfig.class, servletConfig);
}

代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20

public static Application createApplication(String applicationClass, Dispatcher dispatcher, ResteasyProviderFactory providerFactory)
{
 Class<?> clazz = null;
 try
 {
   clazz = Thread.currentThread().getContextClassLoader().loadClass(applicationClass);
 }
 catch (ClassNotFoundException e)
 {
   throw new RuntimeException(e);
 }
 Application app = (Application)providerFactory.createProviderInstance(clazz);
 dispatcher.getDefaultContextObjects().put(Application.class, app);
 ResteasyProviderFactory.pushContext(Application.class, app);
 PropertyInjector propertyInjector = providerFactory.getInjectorFactory().createPropertyInjector(clazz, providerFactory);
 propertyInjector.inject(app);
 return app;
}

代码示例来源:origin: org.jboss.resteasy/resteasy-test-tjws

dispatcher.getDefaultContextObjects().put(Application.class, app);
contextDataMap.putAll(dispatcher.getDefaultContextObjects());
processApplication(app);

代码示例来源:origin: org.jboss.seam/jboss-seam-resteasy

@Create
public void init()
{
 log.info("bootstrapping JAX-RS application");
 // Custom ResteasyProviderFactory that understands Seam component lookup at runtime
 SeamResteasyProviderFactory providerFactory = createProviderFactory();
 dispatcher = createDispatcher(providerFactory);
 initDispatcher();
 // Always use the "deployment sensitive" factory - that means it is handled through ThreadLocal, not static
 // TODO: How does that actually work? It's never used because the dispatcher is created with the original one
 SeamResteasyProviderFactory.setInstance(new ThreadLocalResteasyProviderFactory(providerFactory));
 // Put Providers, Registry and Dispatcher into RESTEasy context.
 dispatcher.getDefaultContextObjects().put(Providers.class, providerFactory);
 dispatcher.getDefaultContextObjects().put(Registry.class, dispatcher.getRegistry());
 dispatcher.getDefaultContextObjects().put(Dispatcher.class, dispatcher);
 Map contextDataMap = SeamResteasyProviderFactory.getContextDataMap();
 contextDataMap.putAll(dispatcher.getDefaultContextObjects());
 
 // Seam can scan the classes for us, we just have to list them in META-INF/seam-deployment.properties
 DeploymentStrategy deployment = (DeploymentStrategy) Component.getInstance("deploymentStrategy");
 AnnotationDeploymentHandler handler =
    (AnnotationDeploymentHandler) deployment.getDeploymentHandlers().get(AnnotationDeploymentHandler.NAME);
 Collection<Class<?>> providers = findProviders(handler);
 Collection<Class<?>> resources = findResources(handler);
 Collection<Component> seamComponents = findSeamComponents();
 registerProviders(seamComponents, providers);
 registerResources(seamComponents, resources);
}

代码示例来源:origin: io.atomix/atomix-rest

deployment.start();
deployment.getDispatcher().getDefaultContextObjects()
  .put(ClusterMembershipService.class, atomix.getMembershipService());
deployment.getDispatcher().getDefaultContextObjects()
  .put(ClusterCommunicationService.class, atomix.getCommunicationService());
deployment.getDispatcher().getDefaultContextObjects()
  .put(ClusterEventService.class, atomix.getEventService());
deployment.getDispatcher().getDefaultContextObjects()
  .put(PrimitiveFactory.class, atomix.getPrimitivesService());
deployment.getDispatcher().getDefaultContextObjects()
  .put(PrimitivesService.class, atomix.getPrimitivesService());
deployment.getDispatcher().getDefaultContextObjects()
  .put(EventManager.class, new EventManager());
deployment.getDispatcher().getDefaultContextObjects()
  .put(AtomixRegistry.class, atomix.getRegistry());

代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20

dispatcher.getDefaultContextObjects().putAll(defaultContextObjects);
dispatcher.getDefaultContextObjects().put(Configurable.class, providerFactory);
dispatcher.getDefaultContextObjects().put(Configuration.class, providerFactory);
dispatcher.getDefaultContextObjects().put(Providers.class, providerFactory);
dispatcher.getDefaultContextObjects().put(Registry.class, registry);
dispatcher.getDefaultContextObjects().put(Dispatcher.class, dispatcher);
dispatcher.getDefaultContextObjects().put(InternalDispatcher.class, InternalDispatcher.getInstance());
dispatcher.getDefaultContextObjects().put(ResteasyDeployment.class, this);
contextDataMap.putAll(dispatcher.getDefaultContextObjects());
     LogMessages.LOGGER.creatingContextObject(entry.getKey(), entry.getValue());
     defaultContextObjects.put(key, obj);
     dispatcher.getDefaultContextObjects().put(key, obj);
     contextDataMap.put(key, obj);

代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20

contextDataMap.putAll(dispatcher.getDefaultContextObjects());
Application app = ResteasyDeployment.createApplication(application.trim(), dispatcher, providerFactory);

代码示例来源:origin: com.alipay.sofa/sofa-rpc-all

dispatcher.getDefaultContextObjects().putAll(defaultContextObjects);
dispatcher.getDefaultContextObjects().put(Configurable.class, providerFactory);
dispatcher.getDefaultContextObjects().put(Providers.class, providerFactory);
dispatcher.getDefaultContextObjects().put(Registry.class, registry);
dispatcher.getDefaultContextObjects().put(Dispatcher.class, dispatcher);
dispatcher.getDefaultContextObjects().put(InternalDispatcher.class, InternalDispatcher.getInstance());
contextDataMap.putAll(dispatcher.getDefaultContextObjects());
      dispatcher.getDefaultContextObjects().put(key, obj);
      contextDataMap.put(key, obj);

代码示例来源:origin: org.jboss.resteasy/resteasy-jaxrs-20

if (application != null)
  dispatcher.getDefaultContextObjects().put(Application.class, application);
  ResteasyProviderFactory.getContextDataMap().put(Application.class, application);
  if (processApplication(application))

代码示例来源:origin: info.magnolia.rest/magnolia-rest-integration

@Override
public void init(ServletConfig servletConfig) throws ServletException {
  this.servletConfig = servletConfig;
  // Initialise the ServletContainerDispatcher
  servletContainerDispatcher = new ServletContainerDispatcher();
  ConfigurationBootstrap bootstrap = createBootstrap(servletConfig);
  servletContainerDispatcher.init(servletConfig.getServletContext(), bootstrap, this, this);
  servletContainerDispatcher.getDispatcher().getDefaultContextObjects().put(ServletConfig.class, servletConfig);
  // Register additional providers that have been configured
  for (AdditionalProviderDefinition provider : restIntegrationModule.getAdditionalProviders()) {
    log.debug("Registering additional provider [{}]", provider.getProviderClass());
    super.getDispatcher().getProviderFactory().registerProvider(provider.getProviderClass());
  }
  // Register all currently registered endpoints
  for (DefinitionProvider<EndpointDefinition> provider : endpointRegistry.getAllProviders()) {
    try {
      registerEndpoint(provider);
    } catch (Exception e) {
      log.error("Failed to register endpoint [{}]", provider.getMetadata().getReferenceId(), e);
      // Others should continue to be registered.
    }
  }
  // Listen for changes to the registry to observe endpoints being added or removed
  registerHandler = systemEventBus.addHandler(EndpointDefinitionRegistryEvent.class, this);
}

代码示例来源:origin: com.peterphi.std.guice/stdlib-guice-webapp

dispatcher.getDispatcher().getDefaultContextObjects().put(FilterConfig.class, filterConfig);
if (servletConfig != null)
  dispatcher.getDispatcher().getDefaultContextObjects().put(ServletConfig.class, servletConfig);

相关文章