class MultipartFormDataEntityProvider implements EntityProvider<Iterator<FileItem>> {

    @Override
    @SuppressWarnings("unchecked")
    public Iterator<FileItem> readFrom(Class<Iterator<FileItem>> type,
                                       Type genericType,
                                       Annotation[] annotations,
                                       MediaType mediaType,
                                       MultivaluedMap<String, String> httpHeaders,
                                       InputStream entityStream) throws IOException {
        try {
            ApplicationContext context = ApplicationContext.getCurrent();
            int bufferSize = context.getEverrestConfiguration().getMaxBufferSize();
            DefaultFileItemFactory factory = new DefaultFileItemFactory(bufferSize, FileCollector.getInstance().getStore());
            FileUpload upload = new FileUpload(factory);
            return upload.parseRequest(httpRequest).iterator();
        } catch (FileUploadException e) {
            throw new IOException(String.format("Can't process multipart data item, %s", e));
        }
    }

    public  MultipartFormDataEntityProvider(@Context HttpServletRequest httpRequest);

}