org.jboss.resteasy.spi.Registry Java Examples

The following examples show how to use org.jboss.resteasy.spi.Registry. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: GuiceRsApplicationServlet.java    From digdag with Apache License 2.0 6 votes vote down vote up
@Override
public void init(ServletConfig servletConfig)
        throws ServletException
{
    super.init(servletConfig);
    Registry registry = servletContainerDispatcher.getDispatcher().getRegistry();
    ResteasyProviderFactory providerFactory = servletContainerDispatcher.getDispatcher().getProviderFactory();

    // add injected providers
    for (Key<Object> key : providers) {
        providerFactory.registerProviderInstance(injector.getInstance(key));
    }

    // add injected resources
    for (Map.Entry<Key<Object>, Class<?>> pair : resources.entrySet()) {
        GuiceRsResourceFactory resourceFactory = new GuiceRsResourceFactory(injector.getProvider(pair.getKey()), pair.getValue());
        registry.addResourceFactory(resourceFactory);
    }
}
 
Example #2
Source File: RestMessagingBootstrapListener.java    From activemq-artemis with Apache License 2.0 6 votes vote down vote up
@Override
public void contextInitialized(ServletContextEvent contextEvent) {
   ServletContext context = contextEvent.getServletContext();
   Registry registry = (Registry) context.getAttribute(Registry.class.getName());
   if (registry == null) {
      throw new RuntimeException("You must install RESTEasy as a Bootstrap Listener and it must be listed before this class");
   }
   String configfile = context.getInitParameter("rest.messaging.config.file");
   deserializationBlackList = context.getInitParameter(ObjectInputStreamWithClassLoader.BLACKLIST_PROPERTY);
   deserializationWhiteList = context.getInitParameter(ObjectInputStreamWithClassLoader.WHITELIST_PROPERTY);
   manager = new MessageServiceManager(this);

   if (configfile != null) {
      manager.setConfigResourcePath(configfile);
   }
   try {
      manager.start();
      registry.addSingletonResource(manager.getQueueManager().getDestination());
      registry.addSingletonResource(manager.getTopicManager().getDestination());
   } catch (Exception e) {
      throw new RuntimeException(e);
   }
}
 
Example #3
Source File: SofaSynchronousDispatcher.java    From sofa-rpc with Apache License 2.0 5 votes vote down vote up
public SofaSynchronousDispatcher(ResteasyProviderFactory providerFactory) {
    super(providerFactory);
    this.providerFactory = providerFactory;
    this.registry = new SofaResourceMethodRegistry(providerFactory); // CHANGE
    defaultContextObjects.put(Providers.class, providerFactory);
    defaultContextObjects.put(Registry.class, registry);
    defaultContextObjects.put(Dispatcher.class, this);
    defaultContextObjects.put(InternalDispatcher.class, InternalDispatcher.getInstance());
}
 
Example #4
Source File: ResourceLinksProvider.java    From quarkus with Apache License 2.0 4 votes vote down vote up
private ObjectLinksProvider getObjectLinksProvider() {
    UriInfo uriInfo = ResteasyContext.getContextData(UriInfo.class);
    ResourceMethodRegistry registry = (ResourceMethodRegistry) ResteasyContext.getContextData(Registry.class);
    return new ObjectLinksProvider(uriInfo, registry);
}
 
Example #5
Source File: ResourceLinksProvider.java    From quarkus with Apache License 2.0 4 votes vote down vote up
private ClassLinksProvider getClassLinksProvider() {
    UriInfo uriInfo = ResteasyContext.getContextData(UriInfo.class);
    ResourceMethodRegistry registry = (ResourceMethodRegistry) ResteasyContext.getContextData(Registry.class);
    return new ClassLinksProvider(uriInfo, registry);
}