I agree, constants like "Content-Type" along with quite a few others are duplicated throughout the HttpClient code. Mostly this is because no-one has spent the time to clean them up. As Eric mentioned convenience methods have not been added to HttpMethod for compatibility reasons. Also, since there are so many commonly used headers we have not wanted to muddy up the HttpMethod interface with more methods.
My preference would be to add header utility methods to another static class, HeaderUtil or something of the like. This class could have a bunch of constants for the various commonly used header names, as well as methods for more complicated header elements like Content-Type (e.g. HeaderUtil.createContentTypeHeader("text/html", "UTF-8")). As always patches are quite welcome.
Mike
On Dec 23, 2003, at 3:43 PM, Gary Gregory wrote:
Hello HttpClient,
For our code which uses HttpClient, I find myself defining constants and
methods in our code for things like "Content-Type" header handling. I am
surprised not to find such a constant in HttpClient in a "public" place. (It
is defined in multipart.Part as protected).
I also see a lot of getRequestHeader("Content-Type") and setRequestHeader("Content-Type", ...).
This is seem like a good opportunity for a refactoring, in this case to getContentType() and setContentType(String).
Is there any reasons these methods do not exist?
I am a committer on [lang] and [codec] (also dabbling in [vsf]) and can help
out directly or via patches if the group is interested in moving in this
direction.
Thanks for reading, Gary
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]