Package org.apache.james.mime4j.field

Examples of org.apache.james.mime4j.field.Field


                writer.write(boundary);
                writer.write("\r\n");
                writer.flush();
                BodyPart part = (BodyPart) bodyParts.get(i);
               
                Field cd = part.getHeader().getField(MIME.CONTENT_DISPOSITION);
                writer.write(cd.toString());
                writer.write("\r\n");
                writer.write("\r\n");
                writer.flush();
                if (writeContent) {
                    part.getBody().writeTo(out, MessageUtils.LENIENT);
View Full Code Here


                writer.write(boundary);
                writer.write("\r\n");
                writer.flush();
                BodyPart part = (BodyPart) bodyParts.get(i);
               
                Field cd = part.getHeader().getField(MIME.CONTENT_DISPOSITION);
                writer.write(cd.toString());
                writer.write("\r\n");
                writer.write("\r\n");
                writer.flush();
                if (writeContent) {
                    part.getBody().writeTo(out, MessageUtils.LENIENT);
View Full Code Here

                writer.write(boundary);
                writer.write("\r\n");
                writer.flush();
                BodyPart part = (BodyPart) bodyParts.get(i);
               
                Field cd = part.getHeader().getField(MIME.CONTENT_DISPOSITION);
                writer.write(cd.toString());
                writer.write("\r\n");
                writer.write("\r\n");
                writer.flush();
                if (writeContent) {
                    part.getBody().writeTo(out, MessageUtils.LENIENT);
View Full Code Here

* @version $Id: FieldTest.java,v 1.3 2004/10/25 07:26:47 ntherning Exp $
*/
public class FieldTest extends TestCase {

    public void testGetName() throws Exception {
        Field f = null;
       
        f = Field.parse("Subject: Yada yada yada");
        assertEquals("Testing simple field", "Subject", f.getName());
       
        f = Field.parse("X-yada-yada: Yada yada yada");
        assertEquals("Testing an X- field", "X-yada-yada", f.getName());
       
        try {
            f = Field.parse("Yada yada yada");
            fail("MimeException not thrown when using an invalid "
                    + "field");
View Full Code Here

        } catch (MimeException e) {
        }
    }

    public void testParse() throws Exception {
        Field f = null;
       
        f = Field.parse("Subject: Yada yada yada");
        assertTrue("Field should be UnstructuredField",
                        f instanceof UnstructuredField);
        f = Field.parse("Content-Type: text/plain");
View Full Code Here

    public void testWriteInStrictMode() throws Exception {
        String hello = constructString(SWISS_GERMAN_HELLO);
        Header header = new Header();
        header.addField(Field.parse("Hello: " + hello));
       
        Field field = header.getField("Hello");
        assertNotNull(field);
        assertEquals(hello, field.getBody());
       
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
       
        header.writeTo(buffer, MessageUtils.STRICT_IGNORE);
        String s = buffer.toString(MessageUtils.ASCII.name());
View Full Code Here

        Header header = new Header();
        header.addField(Field.parse("Hello: " + hello));
        header.addField(Field.parse("Content-type: text/plain; charset=" +
                MessageUtils.ISO_8859_1.name()));
       
        Field field = header.getField("Hello");
        assertNotNull(field);
        assertEquals(hello, field.getBody());
       
        ByteArrayOutputStream buffer = new ByteArrayOutputStream();
       
        header.writeTo(buffer, MessageUtils.LENIENT);
        String s = buffer.toString(MessageUtils.ISO_8859_1.name());
View Full Code Here

                writer.write(boundary);
                writer.write("\r\n");
                writer.flush();
                BodyPart part = (BodyPart) bodyParts.get(i);
               
                Field cd = part.getHeader().getField(MIME.CONTENT_DISPOSITION);
                writer.write(cd.toString());
                writer.write("\r\n");
                writer.write("\r\n");
                writer.flush();
                if (writeContent) {
                    part.getBody().writeTo(out);
View Full Code Here

    private DefaultMutableTreeNode createNode(Header header) {
        DefaultMutableTreeNode node = new DefaultMutableTreeNode(
                new ObjectWrapper("Header", header));

        for (Iterator it = header.getFields().iterator(); it.hasNext();) {
            Field field = (Field) it.next();
            String name = field.getName();
           
            node.add(new DefaultMutableTreeNode(new ObjectWrapper(name, field)));
        }       

        return node;
View Full Code Here

* @version $Id: FieldTest.java,v 1.3 2004/10/25 07:26:47 ntherning Exp $
*/
public class FieldTest extends TestCase {

    public void testGetName() {
        Field f = null;
       
        f = Field.parse("Subject: Yada yada yada");
        assertEquals("Testing simple field", "Subject", f.getName());
       
        f = Field.parse("X-yada-yada: Yada yada yada");
        assertEquals("Testing an X- field", "X-yada-yada", f.getName());
       
        try {
            f = Field.parse("Yada yada yada");
            fail("IllegalArgumentException not thrown when using an invalid "
                    + "field");
View Full Code Here

TOP

Related Classes of org.apache.james.mime4j.field.Field

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.