Package javax.activation

Examples of javax.activation.FileDataSource


        assertEquals(2, handlers.length);
    }

    private DataHandler createDataHandler()
    {
        FileDataSource fileSource = new FileDataSource(getTestFile("src/test-resources/xfire.jpg"));
        DataHandler handler = new DataHandler(fileSource);
        return handler;
    }
View Full Code Here


public class PictureServiceImpl implements PictureService
{
    public DataSource GetPicture()
    {
        return new FileDataSource(getTestFile("src/test-resources/xfire.jpg"));
    }
View Full Code Here

        Object obj = attachments.elementAt(i);
        if (obj instanceof File) {
          File file = (File)obj;
          if (file.isFile() && file.exists() && file.length() > 0) {
            mimeBodyPart = new MimeBodyPart();
            FileDataSource fds = new FileDataSource(file);
            MimetypesFileTypeMap map = new MimetypesFileTypeMap();
            map.addMimeTypes(getTypeEntry(file));
            fds.setFileTypeMap(map);
            mimeBodyPart.setDataHandler(new DataHandler(fds));
            mimeBodyPart.setFileName(file.getName());
            mimeBodyPart.setDisposition(getDisposition(file));
            mimeMultipart.addBodyPart(mimeBodyPart);
          }
View Full Code Here

                                   "http://localhost:8191/AttachmentEcho");

        client.setProperty(HttpTransport.CHUNKING_ENABLED, new Boolean(chunking).toString());
       
        File f = getTestFile("src/test/org/codehaus/xfire/attachments/echo11.xml");
        FileDataSource fs = new FileDataSource(f);

        final DataHandler dh = new DataHandler(fs);
       
        client.addOutHandler(new AbstractHandler() {
View Full Code Here

    private final DataHandler createDataHandler(String name)
            throws MessagingException
    {
        File f = getTestFile(name);
        FileDataSource fs = new FileDataSource(f);

        return new DataHandler(fs);
    }
View Full Code Here

    private DataHandler createDataHandler(String name)
            throws MessagingException
    {
        File f = getTestFile(name);
        FileDataSource fs = new FileDataSource(f);
       
        return new DataHandler(fs);
    }
View Full Code Here


    public void testText()
        throws Exception
    {
        DataSource ds = new FileDataSource(
            getTestFile("src/test/org/codehaus/xfire/attachments/test.txt"));

        DataHandler handler = new DataHandler(ds);

        Object content = handler.getContent();
View Full Code Here

    }
   
    public void testImages()
        throws Exception
    {
        DataSource ds = new FileDataSource(
            getTestFile("src/test/org/codehaus/xfire/attachments/xfire_logo.jpg"));
   
        DefaultDataContentHandlerFactory factory = new DefaultDataContentHandlerFactory();

        Object content = factory.createDataContentHandler("image/jpeg").getContent(ds);
        assertNotNull(content);
        assertTrue(content instanceof java.awt.Image);
       
        ds = new FileDataSource(getTestFile("src/test/org/codehaus/xfire/attachments/fax.tif"));
        assertNotNull(ds);
       
        content = factory.createDataContentHandler("image/tiff").getContent(ds);
        assertNotNull(content);
        assertTrue("The content data type was not correctly detected. Check you computer/activation framework setup. "
View Full Code Here

       
        Client client = ((XFireProxy) Proxy.getInvocationHandler(picClient)).getClient();
        client.setProperty(SoapConstants.MTOM_ENABLED, "true");
       
        EchoPicture req = new EchoPicture();
        FileDataSource source = new FileDataSource(getTestFile("src/test-resources/xfire.jpg"));
        req.setImage(new DataHandler(source));
       
        EchoPictureResponse res = picClient.EchoPicture(req);
        assertNotNull(res.getImage());
    }
View Full Code Here

        {
            Assert.fail(e.getMessage());
            e.printStackTrace();
        }
       
        FileDataSource source = new FileDataSource(getTestFile("src/test-resources/xfire.jpg"));
        response.setImage(new DataHandler(source));
       
        return response;
    }
View Full Code Here

TOP

Related Classes of javax.activation.FileDataSource

Copyright © 2018 www.massapicom. 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.