Package javax.mail.internet

Examples of javax.mail.internet.InternetHeaders$matchEnum


     * @see org.apache.james.nntpserver.repository.NNTPArticle#getHeader(String)
     */
    public String getHeader(String header) {
        try {
            FileInputStream fin = new FileInputStream(articleFile);
            InternetHeaders hdr = new InternetHeaders(fin);
            fin.close();
            return hdr.getHeader(header,null);
        } catch(Exception ex) {
            throw new NNTPException(ex);
        }
    }
View Full Code Here


            //  and write to this outputstream

            //First handle the headers
            InputStream in = source.getInputStream();
            try {
                InternetHeaders headers = new InternetHeaders(in);
                PrintWriter pos = new InternetPrintWriter(new BufferedWriter(new OutputStreamWriter(headerOs), 512), true);
                for (Enumeration e = headers.getNonMatchingHeaderLines(ignoreList); e.hasMoreElements(); ) {
                    String header = (String)e.nextElement();
                    pos.println(header);
                }
                pos.println();
                pos.flush();
View Full Code Here

      for( int i=0; i<certs.length; i++ ) {
        final String filename = "cert" + name + '-' + i + ".der";
        if (log.isDebugEnabled()) {
          log.debug("Returning certificate with issuerDN '"+CertTools.getIssuerDN(certs[i])+"' and subjectDN '"+CertTools.getSubjectDN(certs[i])+"'. Filename="+filename);
        }
        final InternetHeaders headers = new InternetHeaders();
        headers.addHeader("Content-type", "application/pkix-cert");
        headers.addHeader("Content-disposition", "attachment; filename="+filename);
        mp.addBodyPart(new MimeBodyPart(headers,certs[i].getEncoded()));
      }
      if (log.isTraceEnabled()) {
        log.trace("content type: "+mp.getContentType());       
      }
View Full Code Here

                throw new IOException("Couldn't find MIME boundary: " + new String(boundary));
            }

            try {
                // TODO: Do we need to copy these headers somewhere?
                new InternetHeaders(stream);
            } catch (MessagingException e) {
                throw new RuntimeException(e);
            }

            body = new DelegatingInputStream(new MimeBodyPartInputStream(stream, boundary));
View Full Code Here

            return null;
        }
        stream.unread(v);


        InternetHeaders headers;
        try {
            headers = new InternetHeaders(stream);
        } catch (MessagingException e) {
            // TODO create custom IOException
            throw new RuntimeException(e);
        }

        String id = headers.getHeader("Content-ID", null);
        if (id != null && id.startsWith("<")) {
            id = id.substring(1, id.length() - 1);
        } else {
            //no Content-ID, set cxf default ID
            id = "Content-ID: <root.message@cxf.apache.org";
View Full Code Here

            if (!readTillFirstBoundary(stream, boundary)) {
                throw new IOException("Couldn't find MIME boundary: " + boundaryString);
            }

            try {
                InternetHeaders ih = new InternetHeaders(stream);
                message.put(InternetHeaders.class.getName(), ih);
                String val = ih.getHeader("Content-Type", "; ");
                if (!StringUtils.isEmpty(val)) {
                    String cs = HttpHeaderHelper.findCharset(val);
                    if (!StringUtils.isEmpty(cs)) {
                        message.put(Message.ENCODING, HttpHeaderHelper.mapCharset(cs));
                    }
View Full Code Here

            return null;
        }
        stream.unread(v);


        InternetHeaders headers;
        try {
            headers = new InternetHeaders(stream);
        } catch (MessagingException e) {
            // TODO create custom IOException
            throw new RuntimeException(e);
        }
View Full Code Here

     
      if (!isReadyToGetNextStream()) {
        throw new IllegalStateException("nextStreamNotReady");
      }
     
      InternetHeaders headers;
     
      try {
        _delimitedStream = _delimitedStream.getNextStream();
        if (_delimitedStream == null) {
          return null;
        }
       
          headers = new InternetHeaders(_delimitedStream);

      } catch (IOException ioe) {
        ioe.printStackTrace();
        throw new OMException(ioe);
      } catch (MessagingException me) {
        me.printStackTrace();
        throw new OMException(me);
      }

      stream = new IncomingAttachmentInputStream(_delimitedStream, this);
     
      Header header;
      String name;
      String value;
      Enumeration e = headers.getAllHeaders();
      while (e != null && e.hasMoreElements()) {
        header = (Header) e.nextElement();
        name = header.getName().toLowerCase();
        value = header.getValue();
        if (IncomingAttachmentInputStream.HEADER_CONTENT_ID.equals(name)
View Full Code Here

        if (!isReadyToGetNextStream()) {
            throw new IllegalStateException("nextStreamNotReady");
        }

        InternetHeaders headers;

        try {
            _delimitedStream = _delimitedStream.getNextStream();
            if (_delimitedStream == null) {
                return null;
            }

            headers = new InternetHeaders(_delimitedStream);

        } catch (IOException ioe) {
            ioe.printStackTrace();
            throw new OMException(ioe);
        } catch (MessagingException me) {
            me.printStackTrace();
            throw new OMException(me);
        }

        stream = new IncomingAttachmentInputStream(_delimitedStream, this);

        Header header;
        String name;
        String value;
        Enumeration e = headers.getAllHeaders();
        while (e != null && e.hasMoreElements()) {
            header = (Header) e.nextElement();
            name = header.getName().toLowerCase();
            value = header.getValue();
            if (IncomingAttachmentInputStream.HEADER_CONTENT_ID.equals(name)
View Full Code Here

            //  and write to this outputstream

            //First handle the headers
            InputStream in = source.getInputStream();
            try {
                InternetHeaders headers = new InternetHeaders(in);
                PrintWriter pos = new InternetPrintWriter(new BufferedWriter(new OutputStreamWriter(headerOs), 512), true);
                for (Enumeration e = headers.getNonMatchingHeaderLines(ignoreList); e.hasMoreElements(); ) {
                    String header = (String)e.nextElement();
                    pos.println(header);
                }
                pos.println();
                pos.flush();
View Full Code Here

TOP

Related Classes of javax.mail.internet.InternetHeaders$matchEnum

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.