org.codehaus.enunciate.modules.rest
Class MultipartFileDataSource

java.lang.Object
  extended by org.codehaus.enunciate.modules.rest.RESTRequestDataSource
      extended by org.codehaus.enunciate.modules.rest.MultipartFileDataSource
All Implemented Interfaces:
javax.activation.DataSource

public class MultipartFileDataSource
extends RESTRequestDataSource

Author:
Ryan Heaton

Constructor Summary
MultipartFileDataSource(MultipartFile multipartFile)
           
MultipartFileDataSource(MultipartFile multipartFile, ContentTypeSupport contentTypeSupport, javax.servlet.http.HttpServletRequest request)
           
 
Method Summary
 String getContentType()
           
 ContentTypeSupport getContentTypeSupport()
          The content type support.
 InputStream getInputStream()
           
 javax.servlet.http.HttpServletRequest getRequest()
          The request from which this file was parsed.
 long getSize()
           
 Object unmarshal()
          Unmarshal this data source based on its content type.
 Object unmarshalAs(String contentType)
          Unmarshal this data source as the specified content type.
 
Methods inherited from class org.codehaus.enunciate.modules.rest.RESTRequestDataSource
getName, getOutputStream
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

MultipartFileDataSource

public MultipartFileDataSource(MultipartFile multipartFile)

MultipartFileDataSource

public MultipartFileDataSource(MultipartFile multipartFile,
                               ContentTypeSupport contentTypeSupport,
                               javax.servlet.http.HttpServletRequest request)
Method Detail

getInputStream

public InputStream getInputStream()
                           throws IOException
Specified by:
getInputStream in interface javax.activation.DataSource
Overrides:
getInputStream in class RESTRequestDataSource
Throws:
IOException

getContentType

public String getContentType()
Specified by:
getContentType in interface javax.activation.DataSource
Overrides:
getContentType in class RESTRequestDataSource

getSize

public long getSize()
Overrides:
getSize in class RESTRequestDataSource

unmarshal

public Object unmarshal()
                 throws Exception
Unmarshal this data source based on its content type.

Returns:
The unmarshalled data source.
Throws:
Exception

unmarshalAs

public Object unmarshalAs(String contentType)
                   throws Exception
Unmarshal this data source as the specified content type.

Parameters:
contentType - The content type.
Returns:
The unmarshalled object.
Throws:
Exception

getContentTypeSupport

public ContentTypeSupport getContentTypeSupport()
The content type support.

Returns:
The content type support.

getRequest

public javax.servlet.http.HttpServletRequest getRequest()
The request from which this file was parsed.

Returns:
The request from which this file was parsed.