Package org.jboss.resteasy.spi

Examples of org.jboss.resteasy.spi.ResteasyProviderFactory


      this.useThreadLocalFactory = useThreadLocalFactory;
   }

   public void start()
   {
      ResteasyProviderFactory instance = ResteasyProviderFactory.getInstance();
      if (useThreadLocalFactory)
      {
         ThreadLocalResteasyProviderFactory factory = new ThreadLocalResteasyProviderFactory(instance);
         ResteasyProviderFactory.setInstance(factory);
      }
View Full Code Here


               if (uri == null)
                  return null;

               ClientRequest request = context.getRequest();
               EntityExtractorFactory extractor = context.getExtractorFactory();
               ResteasyProviderFactory provider = request.getProviderFactory();
               ClientExecutor executor = request.getExecutor();
               return ProxyFactory.createClientInvoker(method.getClass(), method, uri,
                       executor, provider, extractor).invoke(args);
            }
         };
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);
            return;
         }

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

         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

   public void contextInitialized(final ServletContextEvent event)
   {
      super.contextInitialized(event);
      final ServletContext context = event.getServletContext();
      final Registry registry = (Registry) context.getAttribute(Registry.class.getName());
      final ResteasyProviderFactory providerFactory = (ResteasyProviderFactory) context.getAttribute(ResteasyProviderFactory.class.getName());
      final ModuleProcessor processor = new ModuleProcessor(registry, providerFactory);
      final List<Module> modules = getModules(context);
      final Stage stage = getStage(context);
      if (stage == null)
      {
View Full Code Here

    private final static Logger logger = Logger
            .getLogger(FlickrClient.class);

    public static void main(String args[]) throws Exception
    {
        ResteasyProviderFactory instance = ResteasyProviderFactory
                .getInstance();
        RegisterBuiltin.register(instance);
        instance.registerProvider(ImageIconMessageBodyReader.class);
        FlickrSearchService flickrSearchService = new FlickrSearchService(
                args[0]);

        try
        {
View Full Code Here

        frame.setVisible(true);
    }

    private static ClientRequestFactory initializeRequests()
    {
        ResteasyProviderFactory instance = ResteasyProviderFactory.getInstance();
        RegisterBuiltin.register(instance);
        instance.registerProvider(ImageIconMessageBodyReader.class);

        ClientRequestFactory client = new ClientRequestFactory();
        client.getPrefixInterceptors().registerInterceptor(new LoggingExecutionInterceptor());
        return client;
    }
View Full Code Here

   }

   @Test
   public void test() throws IOException
   {
      ResteasyProviderFactory providerFactory = ResteasyProviderFactory.getInstance();
      ResourceMethodRegistry rmr = new ResourceMethodRegistry(providerFactory);
      rmr.addPerRequestResource(FooResource.class);
      ServiceRegistry service = new ServiceRegistry(null, rmr, providerFactory, null);
      PrintWriter printWriter = new PrintWriter(System.out);
      new JSAPIWriter("/base").writeJavaScript("", printWriter, service);
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

   private final static Logger logger = Logger
      .getLogger(SpringContextLoader.class);

   public void customizeContext(ServletContext servletContext, ConfigurableWebApplicationContext configurableWebApplicationContext)
   {
      final ResteasyProviderFactory providerFactory = (ResteasyProviderFactory) servletContext.getAttribute(ResteasyProviderFactory.class.getName());
      if (providerFactory == null)
         throw new RuntimeException("RESTeasy Provider Factory is null, do you have the ResteasyBootstrap listener configured?");


      final Registry registry = (Registry) servletContext.getAttribute(Registry.class.getName());
View Full Code Here

    ServletConfig config = getServletConfig();
    ServletContext servletContext = config .getServletContext();
    ResourceMethodRegistry registry = (ResourceMethodRegistry) servletContext
    .getAttribute(Registry.class.getName());
    ResteasyProviderFactory providerFactory =
      (ResteasyProviderFactory) servletContext.getAttribute(ResteasyProviderFactory.class.getName());

    String restPath = servletContext
    .getInitParameter("resteasy.servlet.mapping.prefix");
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.