Class JaxRsProviders

  • All Implemented Interfaces:
    javax.ws.rs.ext.Providers, MessageBodyReaderSet

    @Deprecated
    public class JaxRsProviders
    extends java.lang.Object
    implements javax.ws.rs.ext.Providers, MessageBodyReaderSet
    Deprecated.
    Will be removed in next minor release.
    Contains the entity providers and has some methods to pick the wished out.
    • Method Summary

      All Methods Static Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      private void add​(ProviderWrapper provider, boolean defaultProvider)
      Deprecated.
      Adds the given provider to this JaxRsProviders.
      boolean addClass​(java.lang.Class<?> jaxRsProviderClass)
      Deprecated.
       
      private void addExcMapper​(ProviderWrapper excMapperWrapper)
      Deprecated.
      Adds the given ExceptionMapper to this ExceptionMappers.
      boolean addSingleton​(java.lang.Object jaxRsProviderObject, boolean defaultProvider)
      Deprecated.
       
      javax.ws.rs.core.Response convert​(java.lang.Throwable cause)
      Deprecated.
      converts the cause of the given InvocationTargetException to a Response, if an ExceptionMapper could be found.
      Otherwise this method returns an Response with an internal server error.
      MessageBodyReader getBestReader​(java.lang.Class<?> paramType, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, MediaType mediaType)
      Deprecated.
      Returns the MessageBodyReader, that best matches the given criteria.
      <T> javax.ws.rs.ext.ContextResolver<T> getContextResolver​(java.lang.Class<T> contextType, javax.ws.rs.core.MediaType mediaType)
      Deprecated.
      Get a context resolver for a particular type of context and media type.
      private static java.lang.Class<?> getCtxResGenClass​(java.lang.Class<?> crClaz)
      Deprecated.
      Returns the generic class of the given ContextResolver class.
      <T extends java.lang.Throwable>
      javax.ws.rs.ext.ExceptionMapper<T>
      getExceptionMapper​(java.lang.Class<T> causeClass)
      Deprecated.
       
      <T> javax.ws.rs.ext.MessageBodyReader<T> getMessageBodyReader​(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
      Deprecated.
       
      <T> javax.ws.rs.ext.MessageBodyWriter<T> getMessageBodyWriter​(java.lang.Class<T> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
      Deprecated.
       
      void initAll()
      Deprecated.
      Init all providers.
      private void remove​(ProviderWrapper provider)
      Deprecated.
       
      void setObjectFactory​(ObjectFactory objectFactory)
      Deprecated.
      Sets the ObjectFactory
      MessageBodyWriterSubSet writerSubSet​(java.lang.Class<?> entityClass, java.lang.reflect.Type genericType)
      Deprecated.
      Returns a Collection of MessageBodyWriters, which generic type supports the given entityClass.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • localLogger

        private static final java.util.logging.Logger localLogger
        Deprecated.
      • contextResolvers

        private final java.util.Collection<ProviderWrapper> contextResolvers
        Deprecated.
        This Set contains all available ContextResolvers.
        This field is final, because it is shared with other objects.
      • excMappers

        private final java.util.Map<java.lang.Class<? extends java.lang.Throwable>,​ProviderWrapper> excMappers
        Deprecated.
      • logger

        private final java.util.logging.Logger logger
        Deprecated.
      • messageBodyReaderWrappers

        private final java.util.List<ProviderWrapper> messageBodyReaderWrappers
        Deprecated.
      • messageBodyWriterWrappers

        private final java.util.List<ProviderWrapper> messageBodyWriterWrappers
        Deprecated.
      • objectFactory

        private volatile ObjectFactory objectFactory
        Deprecated.
    • Constructor Detail

      • JaxRsProviders

        public JaxRsProviders​(ObjectFactory objectFactory,
                              ThreadLocalizedContext tlContext,
                              ExtensionBackwardMapping extensionBackwardMapping,
                              java.util.logging.Logger logger)
        Deprecated.
        Creates a new JaxRsProviders.
        Parameters:
        objectFactory -
        tlContext -
        extensionBackwardMapping -
        logger -
    • Method Detail

      • getCtxResGenClass

        private static java.lang.Class<?> getCtxResGenClass​(java.lang.Class<?> crClaz)
        Deprecated.
        Returns the generic class of the given ContextResolver class.
      • add

        private void add​(ProviderWrapper provider,
                         boolean defaultProvider)
        Deprecated.
        Adds the given provider to this JaxRsProviders. If the Provider is not an entity provider, it doesn't matter.
        Parameters:
        provider -
        defaultProvider -
      • addClass

        public boolean addClass​(java.lang.Class<?> jaxRsProviderClass)
        Deprecated.
        Parameters:
        jaxRsProviderClass -
        Returns:
        true if the provider was added, or false if not
      • addExcMapper

        private void addExcMapper​(ProviderWrapper excMapperWrapper)
        Deprecated.
        Adds the given ExceptionMapper to this ExceptionMappers.
        Parameters:
        excMapper -
        Throws:
        java.lang.NullPointerException - if null is given
      • addSingleton

        public boolean addSingleton​(java.lang.Object jaxRsProviderObject,
                                    boolean defaultProvider)
                             throws javax.ws.rs.WebApplicationException
        Deprecated.
        Parameters:
        jaxRsProviderObject -
        defaultProvider -
        Returns:
        true if the object was added, false if not.
        Throws:
        javax.ws.rs.WebApplicationException
      • convert

        public javax.ws.rs.core.Response convert​(java.lang.Throwable cause)
        Deprecated.
        converts the cause of the given InvocationTargetException to a Response, if an ExceptionMapper could be found.
        Otherwise this method returns an Response with an internal server error.
        Parameters:
        cause - the thrown exception (was wrapped by an InvocationTargetException)
        Returns:
        the created Response
        Throws:
        java.lang.NullPointerException - if null is given
        See Also:
        ExceptionMapper#toResponse(Object)
      • getContextResolver

        public <T> javax.ws.rs.ext.ContextResolver<T> getContextResolver​(java.lang.Class<T> contextType,
                                                                         javax.ws.rs.core.MediaType mediaType)
        Deprecated.
        Get a context resolver for a particular type of context and media type. The set of resolvers is first filtered by comparing the supplied value of mediaType with the value of each resolver's Produces, ensuring the generic type of the context resolver is assignable to the supplied value of contextType, and eliminating those that do not match. If only one resolver matches the criteria then it is returned. If more than one resolver matches then the list of matching resolvers is ordered with those with the best matching values of Produces (x/y > x/* > */*) sorted first. A proxy is returned that delegates calls to ContextResolver.getContext(java.lang.Class) to each matching context resolver in order and returns the first non-null value it obtains or null if all matching context resolvers return null.
        Specified by:
        getContextResolver in interface javax.ws.rs.ext.Providers
        Parameters:
        contextType - the class of context desired
        mediaType - the media type of data for which a context is required.
        Returns:
        a matching context resolver instance or null if no matching context providers are found.
        See Also:
        Providers.getContextResolver(Class, javax.ws.rs.core.MediaType)
      • getExceptionMapper

        public <T extends java.lang.Throwable> javax.ws.rs.ext.ExceptionMapper<T> getExceptionMapper​(java.lang.Class<T> causeClass)
        Deprecated.
        Specified by:
        getExceptionMapper in interface javax.ws.rs.ext.Providers
        Parameters:
        causeClass -
        Returns:
        the ExceptionMapper for the given Throwable class, or null, if none was found.
      • getMessageBodyReader

        public <T> javax.ws.rs.ext.MessageBodyReader<T> getMessageBodyReader​(java.lang.Class<T> type,
                                                                             java.lang.reflect.Type genericType,
                                                                             java.lang.annotation.Annotation[] annotations,
                                                                             javax.ws.rs.core.MediaType mediaType)
        Deprecated.
        Specified by:
        getMessageBodyReader in interface javax.ws.rs.ext.Providers
        See Also:
        Providers.getMessageBodyReader(Class, Type, Annotation[], javax.ws.rs.core.MediaType)
      • getMessageBodyWriter

        public <T> javax.ws.rs.ext.MessageBodyWriter<T> getMessageBodyWriter​(java.lang.Class<T> type,
                                                                             java.lang.reflect.Type genericType,
                                                                             java.lang.annotation.Annotation[] annotations,
                                                                             javax.ws.rs.core.MediaType mediaType)
        Deprecated.
        Specified by:
        getMessageBodyWriter in interface javax.ws.rs.ext.Providers
        See Also:
        Providers.getMessageBodyWriter(Class, Type, Annotation[], javax.ws.rs.core.MediaType)
      • initAll

        public void initAll()
        Deprecated.
        Init all providers. If an error for one provider occurs, this provider is ignored and the next provider initialized.
        Parameters:
        tlContext -
        extensionBackwardMapping -
      • remove

        private void remove​(ProviderWrapper provider)
        Deprecated.
        Parameters:
        provider -
      • setObjectFactory

        public void setObjectFactory​(ObjectFactory objectFactory)
        Deprecated.
        Sets the ObjectFactory
        Parameters:
        objectFactory -
      • writerSubSet

        public MessageBodyWriterSubSet writerSubSet​(java.lang.Class<?> entityClass,
                                                    java.lang.reflect.Type genericType)
        Deprecated.
        Returns a Collection of MessageBodyWriters, which generic type supports the given entityClass.
        Parameters:
        entityClass -
        genericType - may be null
        annotations -
        mediaType -
        Returns:
        a sub set of message body writers
        See Also:
        javax.ws.rs.ext.MessageBodyWriter#isWriteable(Class, Type, Annotation[])