Package common.attachment

Examples of common.attachment.XopBean


        factoryBean.setProperties(Collections.singletonMap(org.apache.cxf.message.Message.MTOM_ENABLED,
                                                    (Object)"true"));
        WebClient client = factoryBean.createWebClient();
        client.type("multipart/related").accept("multipart/related");
       
        XopBean xop = createXopBean();
       
        System.out.println();
        System.out.println("Posting a XOP attachment with a WebClient");
       
        XopBean xopResponse = client.post(xop, XopBean.class);
       
        verifyXopResponse(xop, xopResponse);
    }
View Full Code Here


        final String serviceURI = "http://localhost:" + port + "/services/attachments";
       
        XopAttachmentService proxy = JAXRSClientFactory.create(serviceURI,
                                                               XopAttachmentService.class);
       
        XopBean xop = createXopBean();
       
        System.out.println();
        System.out.println("Posting a XOP attachment with a proxy");
               
        XopBean xopResponse = proxy.echoXopAttachment(xop);
       
        verifyXopResponse(xop, xopResponse);
    }
View Full Code Here

     * a DataHandler and java.awt.Image
     * @return the bean
     * @throws Exception
     */
    private XopBean createXopBean() throws Exception  {
        XopBean xop = new XopBean();
        xop.setName("xopName");
       
        InputStream is = getClass().getResourceAsStream("/java.jpg");
        byte[] data = IOUtils.readBytesFromStream(is);
       
        // Pass java.jpg as an array of bytes
        xop.setBytes(data);
       
        // Wrap java.jpg as a DataHandler
        xop.setDatahandler(new DataHandler(
                             new ByteArrayDataSource(data, "application/octet-stream")));
       
        if (Boolean.getBoolean("java.awt.headless")) {
            System.out.println("Running headless. Ignoring an Image property.");
        } else {
            xop.setImage(getImage("/java.jpg"));
        }
       
        return xop;
    }
View Full Code Here

TOP

Related Classes of common.attachment.XopBean

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.