Examples of InputStreamDataSource


Examples of org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource

        }
        return new MessageBodyWriterDataHandler(r, obj, cls, genericType, anns, mt);
    }
   
    private DataHandler createInputStreamDH(InputStream is, String mimeType) {
        return new DataHandler(new InputStreamDataSource(is, mimeType));
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource

    }

    public Object readFrom(Class cls, Type genericType, Annotation[] annotations,
                               MediaType type, MultivaluedMap headers, InputStream is)
        throws IOException {
        DataSource ds = new InputStreamDataSource(is, type.toString());
        return DataSource.class.isAssignableFrom(cls) ? ds : new DataHandler(ds);
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource

    }
   
    @Test
    public void testWriteDataHandler() throws Exception {
        DataSourceProvider p = new DataSourceProvider();
        DataHandler ds = new DataHandler(new InputStreamDataSource(
                             new ByteArrayInputStream("image".getBytes()),
                             "image/png"));
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        p.writeTo(ds, DataHandler.class, DataHandler.class, new Annotation[]{},
                   MediaType.valueOf("image/png"), new MetadataMap<String, Object>(), os);
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource

    }
   
    @Test
    public void testWriteDataSource() throws Exception {
        DataSourceProvider p = new DataSourceProvider();
        DataSource ds = new InputStreamDataSource(new ByteArrayInputStream("image".getBytes()),
                                                  "image/png");
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        MultivaluedMap<String, Object> outHeaders = new MetadataMap<String, Object>();
       
        p.writeTo(ds, DataSource.class, DataSource.class, new Annotation[]{},
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource

   
    @Test
    public void testWriteDataSourceWithDiffCT() throws Exception {
        DataSourceProvider p = new DataSourceProvider();
        p.setUseDataSourceContentType(true);
        DataSource ds = new InputStreamDataSource(new ByteArrayInputStream("image".getBytes()),
                                                  "image/png");
        ByteArrayOutputStream os = new ByteArrayOutputStream();
        MultivaluedMap<String, Object> outHeaders = new MetadataMap<String, Object>();
        p.writeTo(ds, DataSource.class, DataSource.class, new Annotation[]{},
                   MediaType.valueOf("image/jpeg"), outHeaders, os);
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource

        }
        return new MessageBodyWriterDataHandler(r, obj, cls, genericType, anns, mt);
    }
   
    private DataHandler createInputStreamDH(InputStream is, String mimeType) {
        return new DataHandler(new InputStreamDataSource(is, mimeType));
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource

    }

    public Object readFrom(Class cls, Type genericType, Annotation[] annotations,
                               MediaType type, MultivaluedMap headers, InputStream is)
        throws IOException {
        DataSource ds = new InputStreamDataSource(is, type.toString());
        return DataSource.class.isAssignableFrom(cls) ? ds : new DataHandler(ds);
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource

        }
        return new MessageBodyWriterDataHandler(r, obj, cls, genericType, anns, mt);
    }
   
    private DataHandler createInputStreamDH(InputStream is, String mimeType) {
        return new DataHandler(new InputStreamDataSource(is, mimeType));
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource

        Class<T> cls = (Class<T>)obj.getClass();
        return getHandlerForObject(obj, cls, genericType, anns, mimeType, id);
    }
   
    private DataHandler createInputStreamDH(InputStream is, String mimeType) {
        return new DataHandler(new InputStreamDataSource(is, mimeType));
    }
View Full Code Here

Examples of org.apache.cxf.jaxrs.ext.multipart.InputStreamDataSource

    public T readFrom(Class<T> cls, Type genericType, Annotation[] annotations,
                               MediaType type,
                               MultivaluedMap<String, String> headers, InputStream is)
        throws IOException {
        DataSource ds = new InputStreamDataSource(is, type.toString());
        return cls.cast(DataSource.class.isAssignableFrom(cls) ? ds : new DataHandler(ds));
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.