Class SerializableProvider

  • All Implemented Interfaces:
    javax.ws.rs.ext.MessageBodyReader<java.io.Serializable>, javax.ws.rs.ext.MessageBodyWriter<java.io.Serializable>

    @Provider
    @Produces("application/x-java-serialized-object")
    @Consumes("application/x-java-serialized-object")
    @Deprecated
    public class SerializableProvider
    extends java.lang.Object
    implements javax.ws.rs.ext.MessageBodyReader<java.io.Serializable>, javax.ws.rs.ext.MessageBodyWriter<java.io.Serializable>
    Deprecated.
    MessageBodyReader+Writer for serialized java objects.

    This Provider has been disabled by default because deserializing java objects from untrusted sources is unsafe. (See http://foxglovesecurity.com/2015/11/06/what-do-weblogic-websphere-jboss-jenkins-opennms-and-your-application-have-in-common-this-vulnerability/ or https://access.redhat.com/security/cve/cve-2015-7501). In case your application uses serialized objects and you trust your remote REST partners, then you may enable this provider:

    • Either by providing a file "META-INF/services/javax.ws.rs.ext.Providers" with the fully qualified classname in classpath (See src/main/resources/ for an example. Multiple files in different jars are additive.)
    • Or register() this Provider at ResteasyProviderFactory or at the jax-rs client.
    Version:
    $Revision: 1.1 $ Created Mar 23, 2012
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      long getSize​(java.io.Serializable t, java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
      Deprecated.
       
      boolean isReadable​(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
      Deprecated.
       
      boolean isWriteable​(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType)
      Deprecated.
       
      java.io.Serializable readFrom​(java.lang.Class<java.io.Serializable> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> httpHeaders, java.io.InputStream entityStream)
      Deprecated.
       
      void writeTo​(java.io.Serializable t, java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, javax.ws.rs.core.MediaType mediaType, javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> httpHeaders, java.io.OutputStream entityStream)
      Deprecated.
       
      • Methods inherited from class java.lang.Object

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

      • APPLICATION_SERIALIZABLE_TYPE

        public static final javax.ws.rs.core.MediaType APPLICATION_SERIALIZABLE_TYPE
        Deprecated.
      • APPLICATION_SERIALIZABLE

        public static final java.lang.String APPLICATION_SERIALIZABLE
        Deprecated.
    • Constructor Detail

      • SerializableProvider

        public SerializableProvider()
        Deprecated.
    • Method Detail

      • isWriteable

        public boolean isWriteable​(java.lang.Class<?> type,
                                   java.lang.reflect.Type genericType,
                                   java.lang.annotation.Annotation[] annotations,
                                   javax.ws.rs.core.MediaType mediaType)
        Deprecated.
        Specified by:
        isWriteable in interface javax.ws.rs.ext.MessageBodyWriter<java.io.Serializable>
      • getSize

        public long getSize​(java.io.Serializable t,
                            java.lang.Class<?> type,
                            java.lang.reflect.Type genericType,
                            java.lang.annotation.Annotation[] annotations,
                            javax.ws.rs.core.MediaType mediaType)
        Deprecated.
        Specified by:
        getSize in interface javax.ws.rs.ext.MessageBodyWriter<java.io.Serializable>
      • writeTo

        public void writeTo​(java.io.Serializable t,
                            java.lang.Class<?> type,
                            java.lang.reflect.Type genericType,
                            java.lang.annotation.Annotation[] annotations,
                            javax.ws.rs.core.MediaType mediaType,
                            javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.Object> httpHeaders,
                            java.io.OutputStream entityStream)
                     throws java.io.IOException,
                            javax.ws.rs.WebApplicationException
        Deprecated.
        Specified by:
        writeTo in interface javax.ws.rs.ext.MessageBodyWriter<java.io.Serializable>
        Throws:
        java.io.IOException
        javax.ws.rs.WebApplicationException
      • isReadable

        public boolean isReadable​(java.lang.Class<?> type,
                                  java.lang.reflect.Type genericType,
                                  java.lang.annotation.Annotation[] annotations,
                                  javax.ws.rs.core.MediaType mediaType)
        Deprecated.
        Specified by:
        isReadable in interface javax.ws.rs.ext.MessageBodyReader<java.io.Serializable>
      • readFrom

        public java.io.Serializable readFrom​(java.lang.Class<java.io.Serializable> type,
                                             java.lang.reflect.Type genericType,
                                             java.lang.annotation.Annotation[] annotations,
                                             javax.ws.rs.core.MediaType mediaType,
                                             javax.ws.rs.core.MultivaluedMap<java.lang.String,​java.lang.String> httpHeaders,
                                             java.io.InputStream entityStream)
                                      throws java.io.IOException,
                                             javax.ws.rs.WebApplicationException
        Deprecated.
        Specified by:
        readFrom in interface javax.ws.rs.ext.MessageBodyReader<java.io.Serializable>
        Throws:
        java.io.IOException
        javax.ws.rs.WebApplicationException