Package org.apache.james.mime4j.dom.field

Examples of org.apache.james.mime4j.dom.field.DateTimeField


        RawField rawField = RawFieldParser.DEFAULT.parseField(raw);
        return DateTimeFieldLenientImpl.PARSER.parse(rawField, null);
    }

    public void testDateDST() throws Exception  {
        DateTimeField f = parse("Date: Wed, 16 Jul 2008 17:12:33 +0200");
        assertEquals(new Date(1216221153000L), f.getDate());
    }
View Full Code Here


        DateTimeField f = parse("Date: Wed, 16 Jul 2008 17:12:33 +0200");
        assertEquals(new Date(1216221153000L), f.getDate());
    }

    public void testDateDSTNoDayOfWeek() throws Exception  {
        DateTimeField f = parse("Date: 16 Jul 2008 17:12:33 +0200");
        assertEquals(new Date(1216221153000L), f.getDate());
    }
View Full Code Here

        DateTimeField f = parse("Date: 16 Jul 2008 17:12:33 +0200");
        assertEquals(new Date(1216221153000L), f.getDate());
    }
   
    public void testdd() throws Exception {
        DateTimeField f = parse("Date: Thu, 01 Jan 1970 12:00:00 +0000");
        assertEquals(43200000L, f.getDate().getTime());
    }
View Full Code Here

     * <code>Date</code> object or <code>null</code> if it is not present.
     *
     * @return the date of this message.
     */
    public Date getDate() {
        DateTimeField dateField = obtainField(FieldName.DATE);
        if (dateField == null)
            return null;

        return dateField.getDate();
    }
View Full Code Here

        assertEquals("inline", field.getDispositionType());
    }

    public void testDateStringDateTimeZone() throws Exception {
        DateTimeField field = Fields.date("Date", new Date(0), TimeZone
                .getTimeZone("GMT"));
        assertTrue(field.isValidField());

        assertEquals("Date: Thu, 1 Jan 1970 00:00:00 +0000", decode(field
                ));
        assertEquals(new Date(0), field.getDate());

        field = Fields.date("Resent-Date", new Date(0), TimeZone
                .getTimeZone("GMT+1"));
        assertTrue(field.isValidField());

        assertEquals("Resent-Date: Thu, 1 Jan 1970 01:00:00 +0100",
                decode(field));
        assertEquals(new Date(0), field.getDate());
    }
View Full Code Here

        assertEquals(new Date(0), field.getDate());
    }

    public void testDateDST() throws Exception {
        long millis = 1216221153000l;
        DateTimeField field = Fields.date("Date", new Date(millis), TimeZone
                .getTimeZone("CET"));
        assertTrue(field.isValidField());

        assertEquals("Date: Wed, 16 Jul 2008 17:12:33 +0200", decode(field
                ));
        assertEquals(new Date(millis), field.getDate());
    }
View Full Code Here

        RawField rawField = RawFieldParser.DEFAULT.parseField(raw);
        return DateTimeFieldLenientImpl.PARSER.parse(rawField, null);
    }

    public void testDateDST() throws Exception  {
        DateTimeField f = parse("Date: Wed, 16 Jul 2008 17:12:33 +0200");
        assertEquals(new Date(1216221153000L), f.getDate());
    }
View Full Code Here

        DateTimeField f = parse("Date: Wed, 16 Jul 2008 17:12:33 +0200");
        assertEquals(new Date(1216221153000L), f.getDate());
    }

    public void testDateDSTNoDayOfWeek() throws Exception  {
        DateTimeField f = parse("Date: 16 Jul 2008 17:12:33 +0200");
        assertEquals(new Date(1216221153000L), f.getDate());
    }
View Full Code Here

     * <code>Date</code> object or <code>null</code> if it is not present.
     *
     * @return the date of this message.
     */
    public Date getDate() {
        DateTimeField dateField = obtainField(FieldName.DATE);
        if (dateField == null)
            return null;

        return dateField.getDate();
    }
View Full Code Here

            } else if (fieldname.equalsIgnoreCase("CC")) {
                processAddressList(parsedField, "Cc:", Metadata.MESSAGE_CC);
            } else if (fieldname.equalsIgnoreCase("BCC")) {
                processAddressList(parsedField, "Bcc:", Metadata.MESSAGE_BCC);
            } else if (fieldname.equalsIgnoreCase("Date")) {
                DateTimeField dateField = (DateTimeField) parsedField;
                metadata.set(Metadata.DATE, dateField.getDate());
                metadata.set(Metadata.CREATION_DATE, dateField.getDate());
            }
        } catch (RuntimeException me) {
            if (strictParsing) {
                throw me;
            }
View Full Code Here

TOP

Related Classes of org.apache.james.mime4j.dom.field.DateTimeField

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.