Package org.jboss.resteasy.spi

Examples of org.jboss.resteasy.spi.ResteasyProviderFactory


      return new ResourceMethodRegistry(someProviderFactory());
   }

   private ResteasyProviderFactory someProviderFactory()
   {
      return new ResteasyProviderFactory();
   }
View Full Code Here


        return new HalfpipeInjectorFactory();
    }

    @Bean(name = "resteasy.providerFactory")
    public ResteasyProviderFactory resteasyProviderFactory() {
        ResteasyProviderFactory providerFactory = resteasyDeployment.getProviderFactory();
        providerFactory.setInjectorFactory(halfpipeInjectorFactory());
        return providerFactory;
    }
View Full Code Here

      this.defaultFactory = defaultFactory;
   }

   public ResteasyProviderFactory getDelegate()
   {
      ResteasyProviderFactory factory = delegate.get();
      if (factory == null) return defaultFactory;
      return factory;
   }
View Full Code Here

      try
      {
         //logger.info("***PATH: " + request.getRequestURL());
         // classloader/deployment aware RestasyProviderFactory.  Used to have request specific
         // ResteasyProviderFactory.getInstance()
         ResteasyProviderFactory defaultInstance = ResteasyProviderFactory.getInstance();
         if (defaultInstance instanceof ThreadLocalResteasyProviderFactory)
         {
            ThreadLocalResteasyProviderFactory.push(providerFactory);
         }
         HttpHeaders headers = null;
         UriInfoImpl uriInfo = null;
         try
         {
            headers = ServletUtil.extractHttpHeaders(request);
            uriInfo = ServletUtil.extractUriInfo(request, servletMappingPrefix);
         }
         catch (Exception e)
         {
            response.sendError(HttpServletResponse.SC_BAD_REQUEST);
            // made it warn so that people can filter this.
            logger.warn("Failed to parse request.", e);
         }

         HttpResponse theResponse = createServletResponse(response);
         HttpRequest in = createHttpRequest(httpMethod, request, headers, uriInfo, theResponse);

         try
         {
            ResteasyProviderFactory.pushContext(HttpServletRequest.class, request);
            ResteasyProviderFactory.pushContext(HttpServletResponse.class, response);
/*
            try
            {
               // embedded TJWS and Jetty might not have these things initialized
               ServletConfig config1 = getServletConfig();
               ResteasyProviderFactory.pushContext(ServletConfig.class, config1);
            }
            catch (Exception ignored)
            {
            }
            try
            {
               // embedded TJWS and Jetty might not have these things initialized
               ServletContext servletContext = getServletContext();
               ResteasyProviderFactory.pushContext(ServletContext.class, servletContext);
            }
            catch (Exception ignored)
            {

            }
            */
            ResteasyProviderFactory.pushContext(SecurityContext.class, new ServletSecurityContext(request));
            dispatcher.invoke(in, theResponse);
         }
         finally
         {
            ResteasyProviderFactory.clearContextData();
         }
      }
      finally
      {
         ResteasyProviderFactory defaultInstance = ResteasyProviderFactory.getInstance();
         if (defaultInstance instanceof ThreadLocalResteasyProviderFactory)
         {
            ThreadLocalResteasyProviderFactory.pop();
         }

View Full Code Here

      this.defaultFactory = defaultFactory;
   }

   public ResteasyProviderFactory getDelegate()
   {
      ResteasyProviderFactory factory = delegate.get();
      if (factory == null) return defaultFactory;
      return factory;
   }
View Full Code Here

      try
      {
         //logger.info("***PATH: " + request.getRequestURL());
         // classloader/deployment aware RestasyProviderFactory.  Used to have request specific
         // ResteasyProviderFactory.getInstance()
         ResteasyProviderFactory defaultInstance = ResteasyProviderFactory.getInstance();
         if (defaultInstance instanceof ThreadLocalResteasyProviderFactory)
         {
            ThreadLocalResteasyProviderFactory.push(providerFactory);
         }
         HttpHeaders headers = null;
         UriInfoImpl uriInfo = null;
         try
         {
            headers = ServletUtil.extractHttpHeaders(request);
            uriInfo = ServletUtil.extractUriInfo(request, servletMappingPrefix);
         }
         catch (Exception e)
         {
            response.sendError(HttpServletResponse.SC_BAD_REQUEST);
            // made it warn so that people can filter this.
            logger.warn("Failed to parse request.", e);
         }

         HttpResponse theResponse = responseFactory.createResteasyHttpResponse(response);
         HttpRequest in = requestFactory.createResteasyHttpRequest(httpMethod, request, headers, uriInfo, theResponse);

         try
         {
            ResteasyProviderFactory.pushContext(HttpServletRequest.class, request);
            ResteasyProviderFactory.pushContext(HttpServletResponse.class, response);

            ResteasyProviderFactory.pushContext(SecurityContext.class, new ServletSecurityContext(request));
            if (handleNotFound)
            {
               dispatcher.invoke(in, theResponse);
            }
            else
            {
               ((SynchronousDispatcher) dispatcher).invokePropagateNotFound(in, theResponse);
            }
         }
         finally
         {
            ResteasyProviderFactory.clearContextData();
         }
      }
      finally
      {
         ResteasyProviderFactory defaultInstance = ResteasyProviderFactory.getInstance();
         if (defaultInstance instanceof ThreadLocalResteasyProviderFactory)
         {
            ThreadLocalResteasyProviderFactory.pop();
         }

View Full Code Here

    @BeforeMethod
    public void         setup() throws Exception
    {
        RestEasyApplication.singletonsRef.set(new RestEasySingletons());

        ResteasyProviderFactory.setInstance(new ResteasyProviderFactory());

        HttpServletDispatcher   dispatcher = new HttpServletDispatcher();

        server = new Server(8080);
        Context root = new Context(server, "/", Context.SESSIONS);
View Full Code Here

            Dictionary<String,String> initparams = new Hashtable<String,String>();
            initparams.put(KEY_SERVLET_MAPPING_PREFIX, alias);
            servletRegistry.registerRESTEasyServlet(alias, servlet, initparams, null);

            // A workaround for https://issues.jboss.org/browse/RESTEASY-640
            ResteasyProviderFactory repFactory = servlet.getDispatcher().getProviderFactory();
            for (Class<?> provider : RESTEasyProviders.PROVIDERS) {
                repFactory.registerProvider(provider);
            }
        }

        List<Class<?>> resourceClasses = servletRegistry.registerRESTEasyResources(alias, instances);
        return new OsgiRESTEasyResource()
View Full Code Here

public class OsgiMethodInvokerFactory implements MethodInvokerFactory {

    @Override
    public MethodInvoker createInvoker(String basePath, Class<?> resourceClass, Method method, RESTEasyBindingModel model) {
        ClientInvoker invoker = new ClientInvoker(basePath, resourceClass, method, model);
        ResteasyProviderFactory repFactory = invoker.getResteasyProviderFactory();
        for (Class<?> provider : RESTEasyProviders.PROVIDERS) {
            repFactory.registerProvider(provider);
        }
        return invoker;
    }
View Full Code Here

  @Override
  public void init(ServletConfig config) throws ServletException
  {
    super.init(config);

    final ResteasyProviderFactory providerFactory = (ResteasyProviderFactory) config.getServletContext().getAttribute(ResteasyProviderFactory.class.getName());
    providerFactory.registerProvider(JsonStringProvider.class);

    final Registry registry = (Registry) config.getServletContext().getAttribute(Registry.class.getName());
    // the prefix must be manually specified because the config's servlet context is does not properly specify it.
    registry.addPerRequestResource(PropertiesImpl.class, "/org.fusesource.restygwt.ObjectEncoderDecoder.JUnit");
  }
View Full Code Here

TOP

Related Classes of org.jboss.resteasy.spi.ResteasyProviderFactory

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.