You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@tapestry.apache.org by Krishna Caldas <kr...@gmail.com> on 2008/08/14 23:12:44 UTC

T5 JBoss/Tomcat & expires header

Hi,

The Expires header parameter (set after fix of
https://issues.apache.org/jira/browse/TAPESTRY-2159) is not working as
expected in JBoss/Tomcat.

For tapestry.js these are the headers:

=======================================
JBoss/Tomcat Response Headers

Server  Apache-Coyote/1.1
X-Powered-By    Servlet 2.4; JBoss-4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA
date=200710221139)/Tomcat-5.5
Last-Modified   Thu, 01 Jan 1970 00:00:00 GMT
Expires Sun, 30 Dec 1979 00:00:00 GMT
Content-Type    text/javascript
Transfer-Encoding       chunked
Content-Encoding        gzip
Vary    Accept-Encoding
Date    Tue, 12 Aug 2008 14:42:50 GMT
=======================================

=======================================
Jetty Response Headers

Last-Modified   Wed, 06 Aug 2008 13:21:22 GMT
Expires Sat, 04 Aug 2018 13:21:22 GMT
Content-Length  38282
Content-Type    text/javascript
Server  Jetty(7.0.0pre3)
=======================================

The Tapestry code is implemented here:

=======================================
public class ResourceStreamerImpl implements ResourceStreamer
{

   private static final long TEN_YEARS = new
TimeInterval("10y").milliseconds();
   ...

   public void streamResource(Resource resource) throws IOException
   {

       ...

       long lastModified = connection.getLastModified();

       response.setDateHeader("Last-Modified", lastModified);
       response.setDateHeader("Expires", lastModified + TEN_YEARS);
...
=======================================

>From URLConnection JavaDoc:

"Returns the value of the last-modified header field. The result is
the number of milliseconds since January 1, 1970 GMT.
 Returns:
   the date the resource referenced by this URLConnection was last
modified, or 0 if not known."


It seams that connection.getLastModified() is returning 0 inside
Tomcat and file last modification date inside Jetty.

Am I missing something?

Thanks,
Krishna

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org


Re: T5 JBoss/Tomcat & expires header

Posted by "Filip S. Adamsen" <fs...@fsadev.com>.
Hi,

This is weird. I run Tapestry 5.0.14 in production on Tomcat 5.5 with no 
issues whatsoever wrt. the Expires header.

Can you reproduce this on different systems?

-Filip

On 2008-08-14 23:12, Krishna Caldas wrote:
> Hi,
> 
> The Expires header parameter (set after fix of
> https://issues.apache.org/jira/browse/TAPESTRY-2159) is not working as
> expected in JBoss/Tomcat.
> 
> For tapestry.js these are the headers:
> 
> =======================================
> JBoss/Tomcat Response Headers
> 
> Server  Apache-Coyote/1.1
> X-Powered-By    Servlet 2.4; JBoss-4.2.2.GA (build: SVNTag=JBoss_4_2_2_GA
> date=200710221139)/Tomcat-5.5
> Last-Modified   Thu, 01 Jan 1970 00:00:00 GMT
> Expires Sun, 30 Dec 1979 00:00:00 GMT
> Content-Type    text/javascript
> Transfer-Encoding       chunked
> Content-Encoding        gzip
> Vary    Accept-Encoding
> Date    Tue, 12 Aug 2008 14:42:50 GMT
> =======================================
> 
> =======================================
> Jetty Response Headers
> 
> Last-Modified   Wed, 06 Aug 2008 13:21:22 GMT
> Expires Sat, 04 Aug 2018 13:21:22 GMT
> Content-Length  38282
> Content-Type    text/javascript
> Server  Jetty(7.0.0pre3)
> =======================================
> 
> The Tapestry code is implemented here:
> 
> =======================================
> public class ResourceStreamerImpl implements ResourceStreamer
> {
> 
>    private static final long TEN_YEARS = new
> TimeInterval("10y").milliseconds();
>    ...
> 
>    public void streamResource(Resource resource) throws IOException
>    {
> 
>        ...
> 
>        long lastModified = connection.getLastModified();
> 
>        response.setDateHeader("Last-Modified", lastModified);
>        response.setDateHeader("Expires", lastModified + TEN_YEARS);
> ...
> =======================================
> 
>>>From URLConnection JavaDoc:
> 
> "Returns the value of the last-modified header field. The result is
> the number of milliseconds since January 1, 1970 GMT.
>  Returns:
>    the date the resource referenced by this URLConnection was last
> modified, or 0 if not known."
> 
> 
> It seams that connection.getLastModified() is returning 0 inside
> Tomcat and file last modification date inside Jetty.
> 
> Am I missing something?
> 
> Thanks,
> Krishna
> 
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
> For additional commands, e-mail: users-help@tapestry.apache.org
> 

---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscribe@tapestry.apache.org
For additional commands, e-mail: users-help@tapestry.apache.org