Package javax.activation

Examples of javax.activation.URLDataSource


        TestHandlerXMLBinding handler = new TestHandlerXMLBinding();
        addHandlersProgrammatically(disp, handler);

        URL is = getClass().getResource("/messages/XML_GreetMeDocLiteralReq.xml");
        DataSource ds = new URLDataSource(is);

        try {
            disp.invoke(ds);
            fail("Did not get expected exception");
        } catch (HTTPException e) {
View Full Code Here


            return new LazyDataSource(contentId, atts);
        } else if (contentId.indexOf("://") == -1) {
            return new LazyDataSource(contentId, atts);
        } else {
            try {
                return new URLDataSource(new URL(contentId));
            } catch (MalformedURLException e) {
                throw new Fault(e);
            }
        }
       
View Full Code Here

        if (src == null) {
            dh =
                (DataHandler)DataHandlerUtils
                    .getDataHandlerFromText(getText(), (type != null) ? type.toString() : null);
        } else {
            dh = new DataHandler(new URLDataSource(src));
        }
        return dh;
    }
View Full Code Here

                    ds = new FileDataSource( attachment.getValue() );
                } else {
                    // If for some reason the URL does not return a content
                    // type then this type of datasource defaults to
                    // application/octet-stream.
                    ds = new URLDataSource( new URL( attachment.getValue() ) );
                }

                bodyPart = new MimeBodyPart();
                bodyPart.setDataHandler( new DataHandler( ds ) );
                bodyPart.setDisposition( Part.ATTACHMENT );
View Full Code Here

            // the content with the attachment
            final MimeMultipart multipart = new MimeMultipart();
            message.setContent(multipart);
            final BodyPart attachment = new MimeBodyPart();
            attachment.setFileName("unknown-devices.zip");
            final DataSource ds = new URLDataSource(file.toURL());
            attachment.setDataHandler(new DataHandler(ds));
            attachment.setHeader("Content-ID","");
            multipart.addBodyPart(attachment);
            return message;
        } catch (Exception e) {
View Full Code Here

    public String embed(URL url, String name)
            throws MessagingException
    {
        MimeBodyPart mbp = new MimeBodyPart();

        mbp.setDataHandler(new DataHandler(new URLDataSource(url)));
        mbp.setFileName(name);
        mbp.setDisposition("inline");
        String cid = org.apache.turbine.util.GenerateUniqueId.getIdentifier();
        mbp.addHeader("Content-ID", cid);
View Full Code Here

                                 String name,
                                 String description,
                                 String disposition)
            throws MessagingException
    {
        return attach(new URLDataSource(url), name, description, disposition);
    }
View Full Code Here

                        if (getLogger().isDebugEnabled()) {
                            getLogger().debug("cocoon-URI changed to " + iSS);
                        }

                        dataSource = new URLDataSource(new URL(iSS));
                    } else {
                        dataSource = new URLDataSource(new URL(inputSource.getURI()));
                    }

                    messageBodyPart.setDataHandler(new DataHandler(dataSource));
                } else if (aD.isFileSource()) {
                    inputSource = resolver.resolveURI(aD.strAttrFile);
                    dataSource  = new URLDataSource(new URL(inputSource.getURI()));
                    messageBodyPart.setDataHandler(new DataHandler(dataSource));
                }
            } else {
                messageBodyPart.setContent(aD.strContent,
                                           aD.strAttrMimeType);
View Full Code Here

                                 String name,
                                 String description,
                                 String disposition)
            throws MessagingException {
        return attach(
                new URLDataSource(url), name, description, disposition);
    }
View Full Code Here

    public String embed(URL url, String name)
        throws MessagingException
    {
        MimeBodyPart mbp = new MimeBodyPart();

        mbp.setDataHandler (new DataHandler(new URLDataSource(url)));
        mbp.setFileName(name);
        mbp.setDisposition("inline");
//        String cid = org.apache.commons.util.identifier.StringAlphanumeric10IdentifierFactory.nextIdentifier();
        String cid = "abcdefghij"; // TODO: Isto devia ser random
        mbp.addHeader("Content-ID", cid);
View Full Code Here

TOP

Related Classes of javax.activation.URLDataSource

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.