Package javax.mail

Examples of javax.mail.URLName


  protected JavamailDocumentCollection( final String storeUrl, final String folderName, final JavamailDocumentFactory factory ) throws MessagingException {
    this.storeUrl = storeUrl;
    this.folderName = folderName;
    this.factory = factory;

    this.store = SESSION.getStore( new URLName( storeUrl ) );
    store.connect();
   
    this.folder = store.getDefaultFolder().getFolder( folderName );
    folder.open( Folder.READ_ONLY );
   
View Full Code Here


  // ---------------------------------------------------------------------------

  public URLName getURL() {
    if (null==oURLSession) {
      if (DebugFile.trace) DebugFile.writeln("new URLName(jdbc://, "+sInHostName+", -1, "+sMBoxDir+", "+sInAccountName+", ...)");
      oURLSession = new URLName("jdbc://", sInHostName, -1, sMBoxDir, sInAccountName, sInAuthStr);
    }
    return oURLSession;
  }
View Full Code Here

    return messagePattern;
  }

  public static boolean isMessageURL(String url) throws Exception {

    URLName urlName = new URLName(url);
    boolean result = false;

    // are there references to a message and optional to an attachment in the message
    if (urlName.getFile() != null) {
      try {
        Matcher matcher = messagePattern.matcher(url);
        matcher.find();
        if (matcher.groupCount() > 0) {
          if (matcher.group(1).startsWith("message")) {
View Full Code Here

    * pop3Url="pop3://demo:secret@localhost:110/INBOX"
    *
    * @return
    */
   public String getMyEmailAddress() {
      URLName urln = new URLName(this.pop3Url);
      return urln.getUsername() + "@" + urln.getHost();
   }
View Full Code Here

    * from pop3Url="pop3://demo:secret@localhost:110/INBOX"
    *
    * @return
    */
   public String getUrlWithoutPassword() {
      URLName urln = new URLName(this.pop3Url);
      return urln.getProtocol() + "://" + urln.getUsername() + "@"
            + urln.getHost()
            + ((urln.getPort() > 0) ? (":" + urln.getPort()) : "") + "/"
            + urln.getFile();
   }
View Full Code Here

      Store store = null;
      //Fails if username contains '@', should be ok for %40?
      //URLName urln = new URLName(this.pop3Url);
     
      // This constructor automatically transforms a '@' in a username to '%40'
      URLName urln = new URLName(this.xbUri.getScheme(), this.xbUri.getHost(),
            this.xbUri.getPort(), this.xbUri.getPath(),
            this.xbUri.getUser(), this.xbUri.getPassword());
      try {
         store = getSession().getStore(urln);
      } catch (NoSuchProviderException e) {
View Full Code Here

         session.setDebug(debug);

         // Get a Store object
         Store store = null;
         if (url != null) {
            URLName urln = new URLName(url);
            store = session.getStore(urln);
            if (showAlert) {
               store.addStoreListener(new StoreListener() {
                  public void notification(StoreEvent e) {
                     String s;
View Full Code Here

   * @throws MessagingException
   */
  public static DBStore open (Session oMailSession, String sProfile,
                              String sMBoxDir, String sGuUser, String sPwd)
    throws MessagingException {
    DBStore oNewInstance = new DBStore (oMailSession, new URLName("jdbc://", sProfile, -1, sMBoxDir, sGuUser, sPwd));
    oNewInstance.connect(sProfile, sGuUser, sPwd);
    return oNewInstance;
  } // open
View Full Code Here

  }

  // ---------------------------------------------------------------------------

  public void connect() throws MessagingException {
    URLName oURLName = getURLName();

    protocolConnect (oURLName.getHost(), oURLName.getPort(), oURLName.getUsername(), oURLName.getPassword());
  }
View Full Code Here

        // We found a message url. Determine the message UID from the url.
        int messageUID = Integer.parseInt(matcher.group(3));
        mLog.debug("Read mime message uid: " + messageUID + " for IMAP url: " + url);
        Session session = Session.getInstance(new Properties());
   
        URLName originURLName = new URLName(ImapToolkit.cutMessageIdentifier(
          CrawlerToolkit.replaceAuthenticationValuesInURL(url, mAccountPasswordEntry)));
        // Replace all %20 with whitespace in folder pathes
        String folder = "";
        if(originURLName.getFile()!=null){
          folder = originURLName.getFile().replaceAll("%20", " ");
        }
        URLName urlName = new URLName(originURLName.getProtocol(), originURLName.getHost(),
          originURLName.getPort(), folder, originURLName.getUsername(), originURLName.getPassword());
   
        IMAPSSLStore imapStore = new IMAPSSLStore(session, urlName);
        imapStore.connect();
        IMAPFolder currentFolder;

        if (urlName.getFile() == null) {
          // There is no folder given
          currentFolder = (IMAPFolder) imapStore.getDefaultFolder();
        } else {
          currentFolder = (IMAPFolder) imapStore.getFolder(urlName.getFile());
        }

        currentFolder.open(Folder.READ_WRITE);
        MimeMessage cplMessage = (MimeMessage) currentFolder.getMessageByUID(messageUID);
   
View Full Code Here

TOP

Related Classes of javax.mail.URLName

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.