Examples of DataSource


Examples of javax.activation.DataSource

  }

  public void sendLoginLink(String email, String loginLink) {


    DataSource htmlDataSource = getHtmlDataSource(loginLink);
    DataSource textDataSource = getTextDataSource(loginLink);

    Transport transport;
    try {
      transport = session.getTransport();
      transport.connect();
View Full Code Here

Examples of javax.activation.DataSource

  /**
   * @param loginLink
   * @return
   */
  private static DataSource getTextDataSource(final String loginLink) {
    return new DataSource() {

      public String getContentType() {
        return "text/plain; charset=UTF-8";
      }

View Full Code Here

Examples of javax.activation.DataSource

  /**
   * @param loginLink
   * @return
   */
  private static DataSource getHtmlDataSource(final String loginLink) {
    return new DataSource() {

      public String getContentType() {
        return "text/html";
      }

View Full Code Here

Examples of javax.activation.DataSource

        Iterator attachmentIterator = attachments.iterator();
        while (attachmentIterator.hasNext()) {
          messageBodyPart = new MimeBodyPart();
          CvFileVO thisAttachment = (CvFileVO) attachmentIterator.next();
          String path = thisAttachment.getPhysicalFolderVO().getFullPath(null, true) + thisAttachment.getName();
          DataSource source = new FileDataSource(path);
          messageBodyPart.setDataHandler(new DataHandler(source));
          messageBodyPart.setFileName(thisAttachment.getTitle());
          multipart.addBodyPart(messageBodyPart);
        }
      }
View Full Code Here

Examples of javax.activation.DataSource

        Iterator attachmentIterator = attachments.iterator();
        while (attachmentIterator.hasNext()) {
          messageBodyPart = new MimeBodyPart();
          CvFileVO thisAttachment = (CvFileVO) attachmentIterator.next();
          String path = thisAttachment.getPhysicalFolderVO().getFullPath(null, true) + thisAttachment.getName();
          DataSource source = new FileDataSource(path);
          messageBodyPart.setDataHandler(new DataHandler(source));
          messageBodyPart.setFileName(thisAttachment.getTitle());
          multipart.addBodyPart(messageBodyPart);
        }
      }
View Full Code Here

Examples of javax.activation.DataSource

      Template temp = new Template(name, new InputStreamReader(src), cfg);
      final ByteArrayOutputStream bout = new ByteArrayOutputStream();
      Writer out = new OutputStreamWriter(bout);
      temp.process(renderContext, out);
      out.flush();
      merged = new DataHandler(new DataSource() {
        public InputStream getInputStream() throws IOException {
          return new ByteArrayInputStream(bout.toByteArray());
        }
        public OutputStream getOutputStream() throws IOException {
          return bout;
View Full Code Here

Examples of javax.activation.DataSource

            //����htmlҳ���ϵ�ͼƬ�������£�
            private void processHtmlImage(String mailContent) throws MessagingException {
                for (int i = 0; i < arrayList1.size(); i++) {
                    messageBodyPart = new MimeBodyPart();
                    DataSource source = new FileDataSource((String) arrayList1.get(i));
                    messageBodyPart.setDataHandler(new DataHandler(source));
                    String contentId = "<" + (String) arrayList2.get(i) + ">";
                    messageBodyPart.setHeader("Content-ID", contentId);
                    messageBodyPart.setFileName((String) arrayList1.get(i));
                    multipart.addBodyPart(messageBodyPart);
View Full Code Here

Examples of javax.activation.DataSource

     * @param attachmentName
     * @throws MessagingException
     */
    public void setAttachments(String attachmentName) throws MessagingException {
        messageBodyPart = new MimeBodyPart();
        DataSource source = new FileDataSource(attachmentName);
        messageBodyPart.setDataHandler(new DataHandler(source));
        int index = attachmentName.lastIndexOf(File.separator);
        String attachmentRealName = attachmentName.substring(index + 1);
        messageBodyPart.setFileName(attachmentRealName);
        multipart.addBodyPart(messageBodyPart);
View Full Code Here

Examples of javax.activation.DataSource

          CvFileFacade cvfile  = new CvFileFacade();
          CvFileVO cvfilevo    = cvfile.getEmailAttachment(userId, Integer.parseInt(fileid), this.dataSource);

          String path          = cvfilevo.getPhysicalFolderVO().getFullPath(null, true) + cvfilevo.getName();

          DataSource source    = new FileDataSource(path);
          messageBodyPart.setDataHandler(new DataHandler(source));
          messageBodyPart.setFileName(name);
          multipart.addBodyPart(messageBodyPart);

        } //end of while loop(itt.hasNext())
View Full Code Here

Examples of javax.activation.DataSource

        throws Exception
    {
        client.setProperty(SoapConstants.MTOM_ENABLED, "true");
        client.setProperty(HttpTransport.CHUNKING_ENABLED, "true");
       
        DataSource source = picClient.GetPicture();
        assertNotNull(source);
       
        DataSource pbsource = picClient.GetPictureBean().getData();
        assertNotNull(pbsource);
       
        InputStream is = pbsource.getInputStream();
        assertNotNull(is);
       
        FileDataSource fileSource = new FileDataSource(getTestFile("src/test-resources/xfire.jpg"));
        DataSource source2 = picClient.EchoPicture(fileSource);
        assertNotNull(source2);
       
        DataHandler handler = new DataHandler(source2);
        DataHandler handler2 = picClient.EchoPicture2(handler);
        assertNotNull(handler2);
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.