On Wed, Mar 19, 2008 at 12:07 AM, Antony Bowesman <[EMAIL PROTECTED]> wrote:
> Hi Robert, > > > the main pull parser parses all digit boundaries fine. > > Ah, now I see what you mean. I debugged again and there's two lots of > parsing > going on, > > MimeStreamParser.parseHeader() > ContentHandler.field(fieldData) > BodyDescriptor.addField() > getHeaderParams() > > The Message implementation of ContentHandler.field() is parsing the > message > using the JavaCC parser, the same as the SimpleContentHandler > implementation. the pull parser parses the fields into name and value but the content handler does not expose the results > BodyDescriptor.addField() only parses the > Content-Transfer-Encoding/Content-Type > headers. NB: It does not check 'Content-*' headers as the Javadocs state, > e.g. > Content-Disposition. > > So, it seems like BodyDescriptor.addField() is the odd-man-out. IMHO BodyDescriptor.addField() doesn't belong in the interface at all: it should only be used for initial population by the pull parser > It's parsing > the Content-Type header, but using a different parsing mechanism to the > standard > ContentTypeParser, and as there's no way in the ContentHandler > implementation to > get this BodyDescriptor parsed information to the handler, the handler > must also > parse it. a fully parsed body descriptor is passed in. should be able to use that. If BodyDescriptor is managing Content-* headers, it should it save them all, > e.g. in > > private params Map<String, Map<String, String>>; > > where Strings are headerName/paramName/paramValue. > > For example, the Content-Disposition parameters should be available. > Currently > only Content-Type parameters are. > > The it could offer methods such as > > // Returns the parameters for the given header, e.g. C-T or C-D > String getContentParam(String headerName, String paramName); > Map getContentParams(String headerName); +1 > and helper methods: > boolean isInline(); > boolean isAttachment(); i agree in principal but since BodyDescriptor is an interface it's may be kinder to implementors to factor them into MimeUtil > Anyway, I've just dived into the Mime4J as I want to use it for a project > of > mine. it's just unfortunate that Message really isn't as well tested or mature as the pull parser > If I make any changes, I'll submit them back as patches at a later date. that'd be great - robert
