Package org.jboss.resteasy.spi

Examples of org.jboss.resteasy.spi.ResteasyProviderFactory


      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);
         }


         try
         {
            ResteasyProviderFactory.pushContext(HttpExchange.class, httpExchange);
            ResteasyProviderFactory.pushContext(HttpContext.class, httpExchange.getHttpContext());
            dispatcher.invoke(request, response);
            if (!response.isCommitted())
            {
               response.commitHeaders();
            }
         }
         catch (Exception ex)
         {
            logger.error("WTF!", ex);
            if (!response.isCommitted())
            {
               httpExchange.sendResponseHeaders(500, -1);
            }
         }
         finally
         {
            ResteasyProviderFactory.clearContextData();
            httpExchange.getResponseBody().close();
         }
      }
      finally
      {
         ResteasyProviderFactory defaultInstance = ResteasyProviderFactory.getInstance();
         if (defaultInstance instanceof ThreadLocalResteasyProviderFactory)
         {
            ThreadLocalResteasyProviderFactory.pop();
         }

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

   public void service(ChannelHandlerContext ctx, HttpRequest request, HttpResponse response, boolean handleNotFound) throws IOException
   {

      try
      {
         ResteasyProviderFactory defaultInstance = ResteasyProviderFactory.getInstance();
         if (defaultInstance instanceof ThreadLocalResteasyProviderFactory)
         {
            ThreadLocalResteasyProviderFactory.push(providerFactory);
         }

         SecurityContext securityContext;
         if (domain != null)
         {
            securityContext = basicAuthentication(request, response);
            if (securityContext == null) // not authenticated
            {
               return;
            }
         } else {
            securityContext = new NettySecurityContext();
         }
         try
         {

            ResteasyProviderFactory.pushContext(SecurityContext.class, securityContext);
            ResteasyProviderFactory.pushContext(ChannelHandlerContext.class, ctx);
            if (handleNotFound)
            {
               dispatcher.invoke(request, response);
            }
            else
            {
               dispatcher.invokePropagateNotFound(request, response);
            }
         }
         finally
         {
            ResteasyProviderFactory.clearContextData();
         }
      }
      finally
      {
         ResteasyProviderFactory defaultInstance = ResteasyProviderFactory.getInstance();
         if (defaultInstance instanceof ThreadLocalResteasyProviderFactory)
         {
            ThreadLocalResteasyProviderFactory.pop();
         }
View Full Code Here

   public void service(ChannelHandlerContext ctx, HttpRequest request, HttpResponse response, boolean handleNotFound) throws IOException
   {

      try
      {
         ResteasyProviderFactory defaultInstance = ResteasyProviderFactory.getInstance();
         if (defaultInstance instanceof ThreadLocalResteasyProviderFactory)
         {
            ThreadLocalResteasyProviderFactory.push(providerFactory);
         }

         SecurityContext securityContext;
         if (domain != null)
         {
            securityContext = basicAuthentication(request, response);
            if (securityContext == null) // not authenticated
            {
               return;
            }
         } else {
            securityContext = new NettySecurityContext();
         }
         try
         {

            ResteasyProviderFactory.pushContext(SecurityContext.class, securityContext);
            ResteasyProviderFactory.pushContext(ChannelHandlerContext.class, ctx);
             if (handleNotFound)
            {
               dispatcher.invoke(request, response);
            }
            else
            {
               dispatcher.invokePropagateNotFound(request, response);
            }
         }
         finally
         {
            ResteasyProviderFactory.clearContextData();
         }
      }
      finally
      {
         ResteasyProviderFactory defaultInstance = ResteasyProviderFactory.getInstance();
         if (defaultInstance instanceof ThreadLocalResteasyProviderFactory)
         {
            ThreadLocalResteasyProviderFactory.pop();
         }
View Full Code Here

            throw new RuntimeException(e);
         }
         realmPublicKeyPem = sw.toString();
         realmPublicKeyPem = PemUtils.removeBeginEnd(realmPublicKeyPem);
      }
      providers = new ResteasyProviderFactory();
      ClassLoader old = Thread.currentThread().getContextClassLoader();
      Thread.currentThread().setContextClassLoader(OAuthAuthenticationServerValve.class.getClassLoader());
      try
      {
         ResteasyProviderFactory.getInstance(); // initialize builtins
View Full Code Here

*/
public class JsonSerialization
{
   public static byte[] toByteArray(Object token, boolean indent) throws Exception
   {
      ResteasyProviderFactory factory = new ResteasyProviderFactory();
      factory.register(new JWTContextResolver(indent));
      factory.register(ResteasyJacksonProvider.class);

      return toByteArray(token, factory);

   }
View Full Code Here

   }


   public static <T> T fromBytes(Class<T> type, byte[] bytes) throws IOException
   {
      ResteasyProviderFactory factory = new ResteasyProviderFactory();
      factory.register(ResteasyJacksonProvider.class);
      factory.register(JWTContextResolver.class);

      return fromBytes(type, bytes, factory);
   }
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

public class ProductDatabaseClient
{
   public static List<String> getProducts(HttpServletRequest request)
   {
      SkeletonKeySession session = (SkeletonKeySession)request.getAttribute(SkeletonKeySession.class.getName());
      ResteasyProviderFactory factory = new ResteasyProviderFactory();
      RegisterBuiltin.register(factory);
      ResteasyClient client = new ResteasyClientBuilder()
//                 .providerFactory(factory)
                 .trustStore(session.getMetadata().getTruststore())
                 .hostnameVerification(ResteasyClientBuilder.HostnameVerificationPolicy.ANY).build();
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.