Package javax.mail.internet

Examples of javax.mail.internet.MailDateFormat$MailDateParser


              case 3: // to
                return joinAddresses( message.getRecipients( Message.RecipientType.TO ) );
              case 4: // date
                final String[] date = message.getHeader( "date" );
                if ( date == null || date.length == 0 ) return NO_DATE;
                final MailDateFormat mailDateFormat = new MailDateFormat();
                try {
                  return mailDateFormat.parse( date[ 0 ] );
                }
                catch ( ParseException e ) {
                  LOGGER.warn( "Error parsing date " + date[ 0 ] );
                  return NO_DATE;
                }
View Full Code Here


    * @return the date parsed
    * @see http://www.faqs.org/rfcs/rfc2156.html
    * @throws IllegalArgumentException on ParseException
    */
   public static Date dateTime(String dateString) {
      DateFormat df = new MailDateFormat();
      try {
         return df.parse(dateString);
      } catch (java.text.ParseException e) {
         throw new IllegalArgumentException("Can't parse date-time string '" + dateString + "', please check email RFC 822: " + e.toString());
      }    
   }
View Full Code Here

   /**
    * @param date
    * @return The http://www.faqs.org/rfcs/rfc822.html "date-time" string
    */
   public static String dateTime(Date date) {
      DateFormat df = new MailDateFormat();
      return df.format(date);    
   }
View Full Code Here

    /**
     * Constructor for RFC822DateFormat
     */
    public RFC822DateFormat() {
        super(new MailDateFormat());
    }
View Full Code Here

    /**
     * Constructor for RFC822DateFormat
     */
    public RFC822DateFormat() {
        super(new MailDateFormat());
    }
View Full Code Here

    /**
     * Constructor for RFC822DateFormat
     */
    public RFC822DateFormat() {
        super(new MailDateFormat());
    }
View Full Code Here

    /**
     * Constructor for RFC822DateFormat
     */
    public RFC822DateFormat() {
        super(new MailDateFormat());
    }
View Full Code Here

        assertEquals(TEST_BCC, muleMessage.getInboundProperty(MailProperties.BCC_ADDRESSES_PROPERTY));
        assertEquals(TEST_FROM, muleMessage.getInboundProperty(MailProperties.FROM_ADDRESS_PROPERTY));
        assertEquals(TEST_REPLY_TO, muleMessage.getInboundProperty(MailProperties.REPLY_TO_ADDRESSES_PROPERTY));
        assertEquals("(no subject)", muleMessage.getInboundProperty(MailProperties.SUBJECT_PROPERTY));
        assertEquals(TEST_CONTENT_TYPE, muleMessage.getInboundProperty(MailProperties.CONTENT_TYPE_PROPERTY));
        assertEquals(new MailDateFormat().parse(new MailDateFormat().format(now)), muleMessage.getInboundProperty(MailProperties.SENT_DATE_PROPERTY));
    }
View Full Code Here

        assertEquals(TEST_BCC, muleMessage.getInboundProperty(MailProperties.BCC_ADDRESSES_PROPERTY));
        assertEquals(TEST_FROM, muleMessage.getInboundProperty(MailProperties.FROM_ADDRESS_PROPERTY));
        assertEquals(TEST_REPLY_TO, muleMessage.getInboundProperty(MailProperties.REPLY_TO_ADDRESSES_PROPERTY));
        assertEquals(TEST_SUBJECT, muleMessage.getInboundProperty(MailProperties.SUBJECT_PROPERTY));
        assertEquals(TEST_CONTENT_TYPE, muleMessage.getInboundProperty(MailProperties.CONTENT_TYPE_PROPERTY));
        assertEquals(new MailDateFormat().parse(new MailDateFormat().format(now)), muleMessage.getInboundProperty(MailProperties.SENT_DATE_PROPERTY));
        assertEquals(customProperty, muleMessage.getInboundProperty(customProperty));
    }
View Full Code Here

    String receivedDate = tokens.peek();
    if (Parsing.isValid(receivedDate)) {
      receivedDate = Parsing.normalizeDateToken(Parsing.match(tokens, String.class));
      try {
        MailDateFormat dateFormat = new MailDateFormat();
        dateFormat.setTimeZone(TimeZone.getTimeZone("Australia/Sydney"));
        status.setReceivedDate(dateFormat.parse(receivedDate));
      } catch (ParseException e) {
        log.error("Malformed received date format {}. Unable to parse.", receivedDate, e);
      }
    } else if (receivedDate != null) {
      Parsing.eat(tokens, "NIL");
View Full Code Here

TOP

Related Classes of javax.mail.internet.MailDateFormat$MailDateParser

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.