james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Richard O. Hammer" <ROHam...@EarthLink.net>
Subject JavaMail InternetHeaders could be more friendly to server developers
Date Wed, 04 Feb 2004 16:44:24 GMT
Three months ago in November we exchanged a few ideas about how the 
JavaMail API might be made more useful for development of mail servers 
-- as distinct from development of mail clients.  Now I have 
discovered one more point that I would like to add.  I might be 
mistaken again because of my incomplete understanding of the API, but 
I hope this is right.  My comment concerns 
javax.mail.internet.InternetHeaders.

When a SMTP server receives a message it needs to add a Received: 
header at the top of the headers.  But InternetHeaders does not seem 
to offer any way to add a header specifically at the top of the list. 
  This class seems to offer no way for its users to learn or set the 
order of the headers. (I am referencing the JavaDocs for JavaMail 1.3).

As a consequence the code in James* goes through an awkward 
workaround: constructing a new InternetHeaders object, adding the new 
Received: header, and then adding the remaining header lines by 
looping through an Enumeration of header lines retrieved from the 
original incoming InternetHeaders object.  This workaround relies upon 
behavior which I have not seen documented, namely that the 
addHeaderLine() method always adds to the bottom of the list of headers.

So, I would suggest that InternetHeaders could be improved, for the 
use of server developers, by addition of a method 
addHeaderLineAtTop(), and by promising and documenting the present 
behavior of addHeaderLine(), that it adds to the bottom.

Rich Hammer
Hillsborough, N.C.


*The code in James to which I refer is in:
org.apache.james.smtpserver.SMTPHandler.processMailHeaders(InternetHeaders)


---------------------------------------------------------------------
To unsubscribe, e-mail: server-dev-unsubscribe@james.apache.org
For additional commands, e-mail: server-dev-help@james.apache.org


Mime
View raw message