Java Doc for InternetHeaders.java in  » EJB-Server-GlassFish » mail » javax » mail » internet » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » EJB Server GlassFish » mail » javax.mail.internet 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   javax.mail.internet.InternetHeaders

InternetHeaders
public class InternetHeaders (Code)
InternetHeaders is a utility class that manages RFC822 style headers. Given an RFC822 format message stream, it reads lines until the blank line that indicates end of header. The input stream is positioned at the start of the body. The lines are stored within the object and can be extracted as either Strings or javax.mail.Header objects.

This class is mostly intended for service providers. MimeMessage and MimeBody use this class for holding their headers.


A note on RFC822 and MIME headers

RFC822 and MIME header fields must contain only US-ASCII characters. If a header contains non US-ASCII characters, it must be encoded as per the rules in RFC 2047. The MimeUtility class provided in this package can be used to to achieve this. Callers of the setHeader, addHeader, and addHeaderLine methods are responsible for enforcing the MIME requirements for the specified headers. In addition, these header fields must be folded (wrapped) before being sent if they exceed the line length limitation for the transport (1000 bytes for SMTP). Received headers may have been folded. The application is responsible for folding and unfolding headers as appropriate.


See Also:   javax.mail.internet.MimeUtility
author:
   John Mani
author:
   Bill Shannon


Inner Class :final protected static class InternetHeader extends Header
Inner Class :static class matchEnum implements Enumeration

Field Summary
protected  Listheaders
     The actual list of Headers, including placeholder entries. Placeholder entries are Headers with a null value and are never seen by clients of the InternetHeaders class. Placeholder entries are used to keep track of the preferred order of headers.

Constructor Summary
public  InternetHeaders()
     Create an empty InternetHeaders object.
public  InternetHeaders(InputStream is)
     Read and parse the given RFC822 message stream till the blank line separating the header from the body.

Method Summary
public  voidaddHeader(String name, String value)
     Add a header with the specified name and value to the header list.
public  voidaddHeaderLine(String line)
     Add an RFC822 header line to the header store. If the line starts with a space or tab (a continuation line), add it to the last header line in the list.
public  EnumerationgetAllHeaderLines()
     Return all the header lines as an Enumeration of Strings.
public  EnumerationgetAllHeaders()
     Return all the headers as an Enumeration of javax.mail.Header objects.
public  String[]getHeader(String name)
     Return all the values for the specified header.
public  StringgetHeader(String name, String delimiter)
     Get all the headers for this header name, returned as a single String, with headers separated by the delimiter.
public  EnumerationgetMatchingHeaderLines(String[] names)
     Return all matching header lines as an Enumeration of Strings.
public  EnumerationgetMatchingHeaders(String[] names)
     Return all matching javax.mail.Header objects.
public  EnumerationgetNonMatchingHeaderLines(String[] names)
    
public  EnumerationgetNonMatchingHeaders(String[] names)
     Return all non-matching javax.mail.Header objects.
public  voidload(InputStream is)
     Read and parse the given RFC822 message stream till the blank line separating the header from the body.
public  voidremoveHeader(String name)
    
public  voidsetHeader(String name, String value)
     Change the first header line that matches name to have value, adding a new header if no existing header matches.

Field Detail
headers
protected List headers(Code)
The actual list of Headers, including placeholder entries. Placeholder entries are Headers with a null value and are never seen by clients of the InternetHeaders class. Placeholder entries are used to keep track of the preferred order of headers. Headers are never actually removed from the list, they're converted into placeholder entries. New headers are added after existing headers of the same name (or before in the case of Received and Return-Path headers). If no existing header or placeholder for the header is found, new headers are added after the special placeholder with the name ":".
since:
   JavaMail 1.4




Constructor Detail
InternetHeaders
public InternetHeaders()(Code)
Create an empty InternetHeaders object. Placeholder entries are inserted to indicate the preferred order of headers.



InternetHeaders
public InternetHeaders(InputStream is) throws MessagingException(Code)
Read and parse the given RFC822 message stream till the blank line separating the header from the body. The input stream is left positioned at the start of the body. The header lines are stored internally.

For efficiency, wrap a BufferedInputStream around the actual input stream and pass it as the parameter.

No placeholder entries are inserted; the original order of the headers is preserved.
Parameters:
  is - RFC822 input stream





Method Detail
addHeader
public void addHeader(String name, String value)(Code)
Add a header with the specified name and value to the header list.

The current implementation knows about the preferred order of most well-known headers and will insert headers in that order. In addition, it knows that Received headers should be inserted in reverse order (newest before oldest), and that they should appear at the beginning of the headers, preceeded only by a possible Return-Path header.

Note that RFC822 headers can only contain US-ASCII characters.
Parameters:
  name - header name
Parameters:
  value - header value




addHeaderLine
public void addHeaderLine(String line)(Code)
Add an RFC822 header line to the header store. If the line starts with a space or tab (a continuation line), add it to the last header line in the list. Otherwise, append the new header line to the list.

Note that RFC822 headers can only contain US-ASCII characters
Parameters:
  line - raw RFC822 header line




getAllHeaderLines
public Enumeration getAllHeaderLines()(Code)
Return all the header lines as an Enumeration of Strings.



getAllHeaders
public Enumeration getAllHeaders()(Code)
Return all the headers as an Enumeration of javax.mail.Header objects. Header objects



getHeader
public String[] getHeader(String name)(Code)
Return all the values for the specified header. The values are String objects. Returns null if no headers with the specified name exist.
Parameters:
  name - header name array of header values, or null if none



getHeader
public String getHeader(String name, String delimiter)(Code)
Get all the headers for this header name, returned as a single String, with headers separated by the delimiter. If the delimiter is null, only the first header is returned. Returns null if no headers with the specified name exist.
Parameters:
  name - header name
Parameters:
  delimiter - delimiter the value fields for all headers withthis name, or null if none



getMatchingHeaderLines
public Enumeration getMatchingHeaderLines(String[] names)(Code)
Return all matching header lines as an Enumeration of Strings.



getMatchingHeaders
public Enumeration getMatchingHeaders(String[] names)(Code)
Return all matching javax.mail.Header objects. matching Header objects



getNonMatchingHeaderLines
public Enumeration getNonMatchingHeaderLines(String[] names)(Code)
Return all non-matching header lines



getNonMatchingHeaders
public Enumeration getNonMatchingHeaders(String[] names)(Code)
Return all non-matching javax.mail.Header objects. non-matching Header objects



load
public void load(InputStream is) throws MessagingException(Code)
Read and parse the given RFC822 message stream till the blank line separating the header from the body. Store the header lines inside this InternetHeaders object. The order of header lines is preserved.

Note that the header lines are added into this InternetHeaders object, so any existing headers in this object will not be affected. Headers are added to the end of the existing list of headers, in order.
Parameters:
  is - RFC822 input stream




removeHeader
public void removeHeader(String name)(Code)
Remove all header entries that match the given name
Parameters:
  name - header name



setHeader
public void setHeader(String name, String value)(Code)
Change the first header line that matches name to have value, adding a new header if no existing header matches. Remove all matching headers but the first.

Note that RFC822 headers can only contain US-ASCII characters
Parameters:
  name - header name
Parameters:
  value - header value




Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.