Package javax.activation

Examples of javax.activation.DataHandler


    public void testAttachmentArray()
        throws Exception
    {
        client.setProperty(SoapConstants.MTOM_ENABLED, "true");

        DataHandler handler = createDataHandler();
        DataHandler handler2 = createDataHandler();

        DataHandler[] handlers = picClient.EchoPictureArray(new DataHandler[] { handler, handler2 });
        assertEquals(2, handlers.length);
    }
View Full Code Here


    }

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

        return p;
    }
   
    public DataHandler EchoPicture2(DataHandler handler)
    {
        return new DataHandler(GetPicture());
    }
View Full Code Here

        // Data Source
        DataSource source = new ByteArrayDataSource("tsztelak@gmail.com".getBytes(), "text/plain; charset=UTF-8");
        result = service.stringFromDataSource(source);
        System.out.print("Result : "+ result+"\n");
        // Data Handler
        result = service.stringFromDataHandler(new DataHandler(source));
        System.out.print("Result : "+ result+"\n");
        return ;
    }
View Full Code Here

            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

        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() {

            public void invoke(MessageContext context)
                throws Exception
View Full Code Here

            throws MessagingException
    {
        File f = getTestFile(name);
        FileDataSource fs = new FileDataSource(f);

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

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

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

        DataHandler handler = new DataHandler(ds);

        Object content = handler.getContent();
        assertNotNull(content);
        assertTrue("The content data type was not correctly detected. Check you computer/activation framework setup. "
                   + "Expected String but got: " + content.getClass(), content instanceof String);
        assertEquals("bleh", content);
    }
View Full Code Here

        StreamedAttachments atts = new StreamedAttachments(new FileInputStream(getTestFile("src/test/org/codehaus/xfire/attachments/mimedata")),
                                                           "multipart/related; type=\"application/xop+xml\"; start=\"<soap.xml@xfire.codehaus.org>\"; start-info=\"null; charset=utf-8\"; boundary=\"----=_Part_4_701508.1145579811786\"");
        Attachment soapMessage = atts.getSoapMessage();
        assertNotNull(soapMessage);
        assertEquals("text/xml", soapMessage.getHeader("Content-Type"));
        DataHandler handler = soapMessage.getDataHandler();
        assertNotNull(handler);
        assertNotNull(handler.getInputStream());
       
        Iterator parts = atts.getParts();
        assertTrue(parts.hasNext());

        Attachment a = (Attachment) parts.next();
View Full Code Here

TOP

Related Classes of javax.activation.DataHandler

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.