org.glassfish.jersey.media.multipart.internal
Class MultiPartReaderClientSide

java.lang.Object
  extended by org.glassfish.jersey.media.multipart.internal.MultiPartReaderClientSide
All Implemented Interfaces:
MessageBodyReader<MultiPart>
Direct Known Subclasses:
MultiPartReaderServerSide

@Singleton
public class MultiPartReaderClientSide
extends java.lang.Object
implements MessageBodyReader<MultiPart>

MessageBodyReader implementation for MultiPart entities.

Author:
Craig McClanahan, Paul Sandoz (paul.sandoz at oracle.com), Michal Gajdos (michal.gajdos at oracle.com)

Constructor Summary
MultiPartReaderClientSide(MultiPartProperties config)
          Accepts constructor injection of the configuration parameters for this application.
 
Method Summary
 boolean isReadable(java.lang.Class<?> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, MediaType mediaType)
           
 MultiPart readFrom(java.lang.Class<MultiPart> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, MediaType mediaType, MultivaluedMap<java.lang.String,java.lang.String> headers, java.io.InputStream stream)
          Reads the entire list of body parts from the Input stream, using the appropriate provider implementation to deserialize each body part's entity.
protected  MultiPart readMultiPart(java.lang.Class<MultiPart> type, java.lang.reflect.Type genericType, java.lang.annotation.Annotation[] annotations, MediaType mediaType, MultivaluedMap<java.lang.String,java.lang.String> headers, java.io.InputStream stream)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultiPartReaderClientSide

public MultiPartReaderClientSide(@Context
                                 MultiPartProperties config)
Accepts constructor injection of the configuration parameters for this application.

Method Detail

isReadable

public boolean isReadable(java.lang.Class<?> type,
                          java.lang.reflect.Type genericType,
                          java.lang.annotation.Annotation[] annotations,
                          MediaType mediaType)
Specified by:
isReadable in interface MessageBodyReader<MultiPart>

readFrom

public MultiPart readFrom(java.lang.Class<MultiPart> type,
                          java.lang.reflect.Type genericType,
                          java.lang.annotation.Annotation[] annotations,
                          MediaType mediaType,
                          MultivaluedMap<java.lang.String,java.lang.String> headers,
                          java.io.InputStream stream)
                   throws java.io.IOException,
                          WebApplicationException
Reads the entire list of body parts from the Input stream, using the appropriate provider implementation to deserialize each body part's entity.

Specified by:
readFrom in interface MessageBodyReader<MultiPart>
Parameters:
type - the class of the object to be read (i.e. MultiPart.class).
genericType - the type of object to be written.
annotations - annotations on the resource method that returned this object.
mediaType - media type (multipart/*) of this entity.
headers - mutable map of HTTP headers for the entire response.
stream - output stream to which the entity should be written.
Throws:
java.io.IOException - if an I/O error occurs.
WebApplicationException - if an HTTP error response needs to be produced (only effective if the response is not committed yet).
WebApplicationException - if the Content-Disposition header of a multipart/form-data body part cannot be parsed.

readMultiPart

protected MultiPart readMultiPart(java.lang.Class<MultiPart> type,
                                  java.lang.reflect.Type genericType,
                                  java.lang.annotation.Annotation[] annotations,
                                  MediaType mediaType,
                                  MultivaluedMap<java.lang.String,java.lang.String> headers,
                                  java.io.InputStream stream)
                           throws java.io.IOException,
                                  org.jvnet.mimepull.MIMEParsingException
Throws:
java.io.IOException
org.jvnet.mimepull.MIMEParsingException


Copyright © 2007-2012 Oracle Corporation. All Rights Reserved. Use is subject to license terms.