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

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

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

Dispatcher.getRegistry介绍

暂无

代码示例

代码示例来源:origin: HotswapProjects/HotswapAgent

Registry registry = (Registry) context.getAttribute(Registry.class.getName());
if (registry == null) {
  registry = servletContainerDispatcher.getDispatcher().getRegistry();

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

dispatcher = dis;
registry = dispatcher.getRegistry();
if (widerRequestMatching)

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

dispatcher = dis;
registry = dispatcher.getRegistry();
if (widerRequestMatching)

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

Dispatcher dispatcher = MockDispatcherFactory.createDispatcher();
dispatcher.getRegistry().addSingletonResource(new Service());

ResteasyProviderFactory
    .getContextDataMap()
    .put(HttpServletRequest.class, new MockHttpServletRequest());

MockHttpResponse response = new MockHttpResponse();

dispatcher.invoke(
  MockHttpRequest.get("/"),
  response
);

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

public void test() throws Exception {
  Dispatcher dispatcher = MockDispatcherFactory.createDispatcher();
  dispatcher.getRegistry().addSingletonResource(new Service());

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

public Registry getRegistry()
{
 return this.dispatcher.getRegistry();
}

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

public Registry getRegistry()
{
 return this.dispatcher.getRegistry();
}

代码示例来源:origin: zhuzhengquan/pc5s

@Override
public void init(ServletConfig servletConfig) throws ServletException {
  super.init(servletConfig);
  
  Map<String,Object> restMap = applicationContext.getBeansWithAnnotation(javax.ws.rs.Path.class);
  Iterator<String> iterator = restMap.keySet().iterator();
  while(iterator.hasNext()){
    String key = iterator.next();
    this.servletContainerDispatcher.getDispatcher().getRegistry().addSingletonResource(restMap.get(key));
  }
  
}

代码示例来源:origin: org.switchyard.components/switchyard-component-resteasy

/**
 * Unregisters a RESTEasy servlet.
 * @param alias alias
 */
public void unregisterRESTEasyServlet(String alias) {
  OsgiRESTEasyServletWrapper servlet = getRegisteredRESTEasyServlet(alias);
  if (servlet == null) {
    throw new IllegalArgumentException("No RESTEasy servlet is registered for the alias '" + alias + "'");
  }
  if (servlet.getDispatcher().getRegistry().getSize() != 0) {
    throw new IllegalStateException("Cannot remove RESTEasy Servlet '" + alias + "' - registry is not empty");
  }
  _httpService.unregister(alias);
  _servlets.remove(alias);
}

代码示例来源:origin: jboss-switchyard/components

/**
 * Unregisters a RESTEasy servlet.
 * @param alias alias
 */
public void unregisterRESTEasyServlet(String alias) {
  OsgiRESTEasyServletWrapper servlet = getRegisteredRESTEasyServlet(alias);
  if (servlet == null) {
    throw new IllegalArgumentException("No RESTEasy servlet is registered for the alias '" + alias + "'");
  }
  if (servlet.getDispatcher().getRegistry().getSize() != 0) {
    throw new IllegalStateException("Cannot remove RESTEasy Servlet '" + alias + "' - registry is not empty");
  }
  _httpService.unregister(alias);
  _servlets.remove(alias);
}

代码示例来源:origin: jboss-switchyard/components

/**
   * Unregisters RESTEasy resources from the servlet.
   * @param alias alias
   * @param resourceClasses resource classes
   */
  public void unregisterRESTEasyResources(String alias, List<Class<?>> resourceClasses) {
    OsgiRESTEasyServletWrapper servlet = getRegisteredRESTEasyServlet(alias);
    if (servlet == null) {
      throw new IllegalArgumentException("No servlet is registered for the alias '" + alias + "'");
    }

    Registry registry = servlet.getDispatcher().getRegistry();
    for (Class<?> clazz : resourceClasses) {
      registry.removeRegistrations(clazz);
    }
  }
}

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

protected void unregisterEndpoint(String endpointReferenceId) {
  Object endpoint = endpoints.remove(endpointReferenceId);
  if (endpoint != null) {
    Class<?> endpointClass = endpoint.getClass();
    if (supportDynamicPath(endpointClass) && endpoint instanceof AbstractEndpoint) {
      String configuredPath = ((AbstractEndpoint) endpoint).getEndpointDefinition().getEndpointPath();
      String path = StringUtils.isEmpty(configuredPath) ? getBasePath(endpointReferenceId) : truncatePath(configuredPath);
      super.getDispatcher().getRegistry().removeRegistrations(endpointClass, path);
      log.debug("Unregister endpoint {} with base path {} from registry.", endpointReferenceId, path);
    } else {
      super.getDispatcher().getRegistry().removeRegistrations(endpointClass);
      log.debug("Unregister endpoint which has reference id: {} from registry.", endpointReferenceId);
    }
  }
}

代码示例来源:origin: org.switchyard.components/switchyard-component-resteasy

/**
   * Unregisters RESTEasy resources from the servlet.
   * @param alias alias
   * @param resourceClasses resource classes
   */
  public void unregisterRESTEasyResources(String alias, List<Class<?>> resourceClasses) {
    OsgiRESTEasyServletWrapper servlet = getRegisteredRESTEasyServlet(alias);
    if (servlet == null) {
      throw new IllegalArgumentException("No servlet is registered for the alias '" + alias + "'");
    }

    Registry registry = servlet.getDispatcher().getRegistry();
    for (Class<?> clazz : resourceClasses) {
      registry.removeRegistrations(clazz);
    }
  }
}

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

protected void registerStatelessEJBResource(Class ejbImplementationClass)
{
 String jndiName = getJndiName(ejbImplementationClass);
 log.debug(
    "registering resource, stateless EJB implementation {1}, as RESTEasy JNDI resource name: {0}",
    jndiName,
    ejbImplementationClass.getName()
 );
 getDispatcher().getRegistry().addJndiResource(jndiName);
}

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

protected void registerPlainResource(Class plainResourceClass)
{
 log.debug("registering resource, event-scoped JAX-RS lifecycle: {0}", plainResourceClass.getName());
 getDispatcher().getRegistry().addResourceFactory(new POJOResourceFactory(plainResourceClass));
}

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

/**
 * Allows an endpoint to be registered for the servlet without actually being in the registry.
 * This is used for REST Tools in particular; otherwise {@link #registerEndpoint(DefinitionProvider)} should be preferred.
 */
protected Object registerEndpoint(EndpointDefinition endpointDefinition) {
  if (!endpointDefinition.isEnabled()) {
    return null;
  }
  Object endpoint = instantiateEndpoint(endpointDefinition);
  endpoints.put(endpointDefinition.getName(), endpoint);
  super.getDispatcher().getRegistry().addSingletonResource(endpoint);
  return endpoint;
}

代码示例来源:origin: org.switchyard.components/switchyard-component-resteasy

@Override
public void stop() {
  _registry.unregisterRESTEasyResources(_alias, _classes);
  OsgiRESTEasyServletWrapper servlet = _registry.getRegisteredRESTEasyServlet(_alias);
  if (servlet != null && servlet.getDispatcher().getRegistry().getSize() == 0) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("Unregistering RESTEasy servlet with an alias '" + _alias + "'");
    }
    _registry.unregisterRESTEasyServlet(_alias);
  }
}

代码示例来源:origin: jboss-switchyard/components

@Override
public void stop() {
  _registry.unregisterRESTEasyResources(_alias, _classes);
  OsgiRESTEasyServletWrapper servlet = _registry.getRegisteredRESTEasyServlet(_alias);
  if (servlet != null && servlet.getDispatcher().getRegistry().getSize() == 0) {
    if (LOGGER.isDebugEnabled()) {
      LOGGER.debug("Unregistering RESTEasy servlet with an alias '" + _alias + "'");
    }
    _registry.unregisterRESTEasyServlet(_alias);
  }
}

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

protected void registerInterfaceSeamComponentResource(Component seamComponent, Class resourceInterface)
{
 log.debug(
    "registering resource, annotated interface {1}, as Seam component: {0}",
    seamComponent.getName(),
    resourceInterface.getName()
 );
 ResourceFactory factory = new SeamResteasyResourceFactory(
    resourceInterface,
    seamComponent,
    getDispatcher().getProviderFactory()
 );
 getDispatcher().getRegistry().addResourceFactory(factory);
}

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

protected void registerSeamComponentResource(Component seamComponent)
{
 log.debug("registering resource as Seam component: {0}", seamComponent.getName());
 ResourceFactory factory = new SeamResteasyResourceFactory(
    seamComponent.getBeanClass(),
    seamComponent,
    getDispatcher().getProviderFactory()
 );
 getDispatcher().getRegistry().addResourceFactory(factory);
}

相关文章