Package javax.activation

Examples of javax.activation.DataSource


        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


        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

  private void _addAttachment(Multipart multipart, UploadedFile file)
    throws MessagingException
  {
    BodyPart messageBodyPart = new MimeBodyPart();
    DataSource source = new UploadedFileDataSource(file);
    messageBodyPart.setDataHandler(new DataHandler(source));
    messageBodyPart.setFileName(file.getFilename());
    multipart.addBodyPart(messageBodyPart);
  }
View Full Code Here

        result.setFilename(contentStream.getFileName());
        result.setLength(contentStream.getBigLength());
        result.setMimeType(contentStream.getMimeType());

        result.setStream(new DataHandler(new DataSource() {

            public OutputStream getOutputStream() throws IOException {
                return null;
            }
View Full Code Here

                if (name != null) {
                    part.setFileName(name);
                }
            } else {
                // Set data
                DataSource ds = getDataSource(resolver, sources);
                part.setDataHandler(new DataHandler(ds));
                String name = ds.getName();
                if (name != null) {
                    part.setFileName(name);
                }
            }
        }
View Full Code Here

   
                if (!aD.isTextContent()) {
                    Source inputSource = resolver.resolveURI(aD.isURLSource() ? aD.strAttrSrc : aD.strAttrFile);
                    this.usedSources.add(inputSource);
   
                    DataSource dataSource = new SourceDataSource(inputSource, aD.strAttrMimeType, aD.strAttrName);

                    messageBodyPart.setDataHandler(new DataHandler(dataSource));
                } else {
                    messageBodyPart.setContent(aD.strContent, aD.strAttrMimeType);
                }
View Full Code Here

        if (LOG.isTraceEnabled()) {
            LOG.trace("Using Content-Type " + contentType + " for MimeMessage: " + part);
        }

        // always store content in a byte array data store to avoid various content type and charset issues
        DataSource ds = new ByteArrayDataSource(exchange.getIn().getBody(String.class), contentType);
        part.setDataHandler(new DataHandler(ds));

        // set the content type header afterwards
        part.setHeader("Content-Type", contentType);
View Full Code Here

        if (LOG.isTraceEnabled()) {
            LOG.trace("Using Content-Type " + contentType + " for BodyPart: " + part);
        }

        // always store content in a byte array data store to avoid various content type and charset issues
        DataSource ds = new ByteArrayDataSource(exchange.getIn().getBody(String.class), contentType);
        part.setDataHandler(new DataHandler(ds));

        // set the content type header afterwards
        part.setHeader("Content-Type", contentType);
View Full Code Here

                    retVal = dom == null ? read(input).getNode() : dom;
                } else if (Document.class.isAssignableFrom(type)) {
                    retVal = dom == null ? read(input).getNode() : dom;
                } else if (DataSource.class.isAssignableFrom(type)) {
                    final InputStream ins = getInputStream(input);
                    retVal = new DataSource() {
                        public String getContentType() {
                            return "text/xml";
                        }
                        public InputStream getInputStream() throws IOException {
                            return ins;
View Full Code Here

            }
            att.setHeader(header.getName(), header.getValue());
        }
       
        if (quotedPrintable) {
            DataSource source = new AttachmentDataSource(ct,
                                                         new QuotedPrintableDecoderStream(stream));
            att.setDataHandler(new DataHandler(source));
        } else {
            DataSource source = new AttachmentDataSource(ct, stream);
            att.setDataHandler(new DataHandler(source));
        }
       
        return att;
    }
View Full Code Here

TOP

Related Classes of javax.activation.DataSource

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.