tomcat-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "James Carman" <ja...@carmanconsulting.com>
Subject Re: DefaultServlet problem...
Date Fri, 12 Apr 2002 16:01:04 GMT
Maybe a combination of the solutions should be in order.  There should be a
parseDateHeader() method wich returns a Date instance.  Inside the
parseDateHeader() method, it should actually call the
HttpServletRequest.getDateHeader() method.  Also, the
HttpServletRequest.getDateHeader() method should not share SimpleDateFormat
objects across threads.


----- Original Message -----
From: "Remy Maucherat" <remm@apache.org>
To: "Tomcat Developers List" <tomcat-dev@jakarta.apache.org>
Sent: Friday, April 12, 2002 11:14 AM
Subject: Re: DefaultServlet problem...


> > The DefaultServlet class is performing logic which belongs (and is
already
> > there) in the HttpServletRequest implementation.  It implements HTTP
date
> > header parsing as follows...
> >
> >
> >                 // Parsing the HTTP Date
> >                 for (int i = 0; (date == null) && (i < formats.length);
> i++)
> > {
> >                     try {
> >                         date = formats[i].parse(headerValue);
> >                     } catch (ParseException e) {
> >                         ;
> >                     }
> >                 }
> >
> > The methods needing an HTTP date header should use the
> > HttpServletRequest.getDateHeader() method.  If it is absolutely
necessary
> > that this logic be inside the DefaultServlet class, then it should at
> least
> > be extracted into a private helper method (called parseDateHeader or
> > something), rather than repeated 4 times.
>
> Yes, this looks better indeed.
>
> Remy
>
>
> --
> To unsubscribe, e-mail:
<mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
> For additional commands, e-mail:
<mailto:tomcat-dev-help@jakarta.apache.org>
>
>
>


--
To unsubscribe, e-mail:   <mailto:tomcat-dev-unsubscribe@jakarta.apache.org>
For additional commands, e-mail: <mailto:tomcat-dev-help@jakarta.apache.org>


Mime
View raw message