resteasy-core/src/main/java/org/jboss/resteasy/core/ResteasyProviderFactoryImpl.java
private void addMessageBodyWriter(MessageBodyWriter provider, Class<?> providerClass, int priority,
         boolean isBuiltin)
   {
      injectProperties(providerClass, provider);
      Produces consumeMime = provider.getClass().getAnnotation(Produces.class);
      SortedKey<MessageBodyWriter> key = new SortedKey<MessageBodyWriter>(MessageBodyWriter.class, provider,
            providerClass, priority, isBuiltin);
      RuntimeType type = null;
      ConstrainedTo constrainedTo = providerClass.getAnnotation(ConstrainedTo.class);
      if (constrainedTo != null)
         type = constrainedTo.value();

      if ((type == null || type == RuntimeType.CLIENT) && clientMessageBodyWriters == null)
      {
         clientMessageBodyWriters = parent.getClientMessageBodyWriters().clone();
      }
      if ((type == null || type == RuntimeType.SERVER) && serverMessageBodyWriters == null)
      {
         serverMessageBodyWriters = parent.getServerMessageBodyWriters().clone();
      }
      if (consumeMime != null)
      {
         for (String consume : consumeMime.value())
         {
            //logger.info(">>> Adding provider: " + provider.getClass().getName() + " with mime type of: " + mime);
            if (type == null)
            {
               clientMessageBodyWriters.add(MediaType.valueOf(consume), key);
               serverMessageBodyWriters.add(MediaType.valueOf(consume), key);
            }
            else if (type == RuntimeType.CLIENT)
            {
               clientMessageBodyWriters.add(MediaType.valueOf(consume), key);
            }
            else
            {
               serverMessageBodyWriters.add(MediaType.valueOf(consume), key);
            }
         }
      }
      else
      {
         //logger.info(">>> Adding provider: " + provider.getClass().getName() + " with mime type of: default */*");
         if (type == null)
         {
            clientMessageBodyWriters.add(new MediaType("*", "*"), key);
            serverMessageBodyWriters.add(new MediaType("*", "*"), key);
         }
         else if (type == RuntimeType.CLIENT)
         {
            clientMessageBodyWriters.add(new MediaType("*", "*"), key);
         }
         else
         {
            serverMessageBodyWriters.add(new MediaType("*", "*"), key);
         }
      }
   }
/**
    * Specify the provider class.  This is there jsut in case the provider instance is a proxy.  Proxies tend
    * to lose generic type information
    *
    * @param provider message reader
    * @param providerClass provider class
    * @param priority priority
    * @param isBuiltin built-in
    */
Specify the provider class.  This is there jsut in case the provider instance is a proxy.  Proxies tend
to lose generic type information

@param provider message reader
@param providerClass provider class
@param priority priority
@param isBuiltin built-in
Specify the provider class . This is there jsut in case the provider instance is a proxy . Proxies tend to lose generic type information @param provider message reader @param providerClass provider class @param priority priority @param isBuiltin built - in
private void addMessageBodyWriter(MessageBodyWriter provider, Class<?> providerClass, int priority,
         boolean isBuiltin)
   {
      injectProperties(providerClass, provider);
      Produces consumeMime = provider.getClass().getAnnotation(Produces.class);
      SortedKey<MessageBodyWriter> key = new SortedKey<MessageBodyWriter>(MessageBodyWriter.class, provider,
            providerClass, priority, isBuiltin);
      RuntimeType type = null;
      ConstrainedTo constrainedTo = providerClass.getAnnotation(ConstrainedTo.class);
      if (constrainedTo != null)
         type = constrainedTo.value();
      if ((type == null || type == RuntimeType.CLIENT) && clientMessageBodyWriters == null)
      {
         clientMessageBodyWriters = parent.getClientMessageBodyWriters().clone();
      }
      if ((type == null || type == RuntimeType.SERVER) && serverMessageBodyWriters == null)
      {
         serverMessageBodyWriters = parent.getServerMessageBodyWriters().clone();
      }
      if (consumeMime != null)
      {
         for (String consume : consumeMime.value())
         {
            if (type == null)
            {
               clientMessageBodyWriters.add(MediaType.valueOf(consume), key);
               serverMessageBodyWriters.add(MediaType.valueOf(consume), key);
            }
            else if (type == RuntimeType.CLIENT)
            {
               clientMessageBodyWriters.add(MediaType.valueOf(consume), key);
            }
            else
            {
               serverMessageBodyWriters.add(MediaType.valueOf(consume), key);
            }
         }
      }
      else
      {
         if (type == null)
         {
            clientMessageBodyWriters.add(new MediaType("*", "*"), key);
            serverMessageBodyWriters.add(new MediaType("*", "*"), key);
         }
         else if (type == RuntimeType.CLIENT)
         {
            clientMessageBodyWriters.add(new MediaType("*", "*"), key);
         }
         else
         {
            serverMessageBodyWriters.add(new MediaType("*", "*"), key);
         }
      }
   }
private void addMessageBodyWriter ( MessageBodyWriter provider , Class < ? > providerClass , int priority , boolean isBuiltin ) { injectProperties ( providerClass , provider ) ; Produces consumeMime = provider . getClass ( ) . getAnnotation ( Produces . class ) ; SortedKey < MessageBodyWriter > key = new SortedKey < MessageBodyWriter > ( MessageBodyWriter . class , provider , providerClass , priority , isBuiltin ) ; RuntimeType type = null ; ConstrainedTo constrainedTo = providerClass . getAnnotation ( ConstrainedTo . class ) ; if ( constrainedTo != null ) type = constrainedTo . value ( ) ; if ( ( type == null || type == RuntimeType . CLIENT ) && clientMessageBodyWriters == null ) { clientMessageBodyWriters = parent . getClientMessageBodyWriters ( ) . clone ( ) ; } if ( ( type == null || type == RuntimeType . SERVER ) && serverMessageBodyWriters == null ) { serverMessageBodyWriters = parent . getServerMessageBodyWriters ( ) . clone ( ) ; } if ( consumeMime != null ) { for ( String consume : consumeMime . value ( ) ) { if ( type == null ) { clientMessageBodyWriters . add ( MediaType . valueOf ( consume ) , key ) ; serverMessageBodyWriters . add ( MediaType . valueOf ( consume ) , key ) ; } else if ( type == RuntimeType . CLIENT ) { clientMessageBodyWriters . add ( MediaType . valueOf ( consume ) , key ) ; } else { serverMessageBodyWriters . add ( MediaType . valueOf ( consume ) , key ) ; } } } else { if ( type == null ) { clientMessageBodyWriters . add ( new MediaType ( "*" , "*" ) , key ) ; serverMessageBodyWriters . add ( new MediaType ( "*" , "*" ) , key ) ; } else if ( type == RuntimeType . CLIENT ) { clientMessageBodyWriters . add ( new MediaType ( "*" , "*" ) , key ) ; } else { serverMessageBodyWriters . add ( new MediaType ( "*" , "*" ) , key ) ; } } }
Specify the provider class.
Specify the provider class .
//logger.info(">>> Adding provider: " + provider.getClass().getName() + " with mime type of: " + mime);
 //logger.info(">>> Adding provider: " + provider.getClass().getName() + " with mime type of: default */*");
