> Yeah, MimeHeaders could use some work (it's got a disturbingly high
> rate of 'XXX' comments).
A first step toward that is in util.collections and util.http:
I Split the MimeHeaders in:
1. the general-purpose org.apache.tomcat.util.collections.MultiMap:
- a specialized map that has MessageBytes as keys and values
- supports keys with multiple values ( and take into account that this
case in not "frequent" )
- lazy hashing ( hash is not implemented at all right now - but I plan to
add it ) - the hash key is computed the first time a search is done (
since in many cases this doesn't happen ).
- do linear search if "few" keys ( in theory linear search is faster for
if there are "few" keys )
- recycleable
This class will be used as base for Parameters ( and probably Cookies,
probably even attributes - with some changes )
2. org.apache.tomcat.util.http.Headers - the header-specialized methods.
I also removed the enumerations ( and made them top-level classes that
will be used only by facades ).
I think it's slightly better, it still needs work.
I'll start replacing MimeHeaders with Headers ( and use that to review the
way MimeHeaders are used and make sure the faster methods are used )
Costin
>
> Assuming I'll be able to commit fixes myself soon, I'll clean this all up at that
>point.
>
> Thanks for the feedback,
> -Dan
>
> [EMAIL PROTECTED] wrote:
> >
> > Hi Dan,
> >
> > I think you'll be able to commit the patch yourself very soon.
> >
> > I just have few comments - it's a good patch ( as it solves the problem),
> > but it's not good for performance.
> >
> > We definitely need to do a refactoring of MimeHeaders :-)
> >
> > The idea behind MimeHeaders is to allow efficient storage and access to
> > headers - without creating intermediary objects and with minimal pain.
> >
> > For example, output headers are stored by the servlet or container and
> > most of the time are accessed only once, when the output is sent. In this
> > case it's enough to do indexed access ( using size(), getName( int idx),
> > getValue( int idx ) ).
> >
> > Creating an enumeration and all the string[] for each request is not a
> > good idea IMHO.
> >
> > Costin
>
>