james-server-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Bill Shannon <bill.shan...@sun.com>
Subject Re: JavaMail InternetHeaders could be more friendly to server developers
Date Fri, 06 Feb 2004 22:01:14 GMT
Richard O. Hammer wrote:
> 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.

It's something of a kludge, but InternetHeaders already handles this in
the addHeaders method.  It knows the preferred order for well-known
headers, and it knows that Received headers should be added in reverse
order.  The addHeaderLine method, on the other hand, always adds to the
end.  I suppose some part of that ought to be part of the spec.  :-)


---------------------------------------------------------------------
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