----- Original Message -----
From: Morten Norby Larsen <[EMAIL PROTECTED]>
To: David Chisholm <[EMAIL PROTECTED]>
Cc: <[EMAIL PROTECTED]>
Sent: Saturday, December 04, 1999 2:16 PM
Subject: Re: Request for HTTP documentation, tutorials, and/or workshops


> David,
>
> Are you sure you really need to read the HTTP1.1 specs (which are quite
> a mouthful, agreed)?
>

I was having a very strange caching problem - different from the kind
normally posted here, and I needed to really understand how caching
directives are supposed to work.

I was using the following to disable caching in all of my pages:

  response.setHeader("Pragma", "No-cache");
  response.setHeader("Cache-Control","no-cache" );
  response.setHeader("Cache-Control","no-store" );
  response.setDateHeader("Expires", 0);
  Date dateInPast = new Date(0);
  response.setDateHeader("ExpiresAbsolute", dateInPast.getTime());

I've accumulated these from various postings to this mailing list, and they
were working great except in Netscape.  Whenever I would resize a Netscape
window, all of the HTML in the page would redraw just fine, but all of my
javascript would unload.  What's worse, I have a lot of stuff that is
rendered using javascript write() calls, and none of it would redraw.  I
could even view the source of a page and see that a javascript function was
there, but if I tried to reference it, I would get a "foo is undefined"
error.  Of course, everything worked just fine in IE.  (For the version
conscious, I tested this with NS 4.08, 4.5, 4.6 & 4.7, and IE 4.0 & 5.0)

I've since removed the setDateHeader() calls, and it's now working with both
NS and IE, but I needed to understand what I was losing by not using them,
and  thus the need to find a good book on HTTP.

Apparently I'm not missing anything by dropping these calls.  The 'Expires'
header gives the date/time after which a response is considered stale in the
cache.  Since my pages should never go into the cache, this isn't necessary.
(Note:  I'm setting these fields directly in the header and not with meta
tags, so IE should never cache the page, and I don't have to put a meta-tag
at the top and bottom of the page to work around its known caching policy.)

I couldn't even find the 'ExpiresAbsolute' header field in the HTTP 1.1 spec
(ref. http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14), but if
I left its setDateHeader() call in the code, I still experienced the same
problem.

Anyway, the only headers that I set now are:

  response.setHeader("Pragma", "No-cache");
  response.setHeader("Cache-Control","no-cache" );
  response.setHeader("Cache-Control","no-store" );

This fixed the problem, and my pages do not go into the cache.

Thanks for the book reference.  I'll check it out.
David


> I have based my working knowledge of HTTP on the 1.0 specs, which you
> can print on a couple A4 sheets. It will take you far, and is quite
> simple. Here is a URL:
>
>    http://www.w3.org/Protocols/HTTP/HTTP2.html
>
> There's also a mini-web server described somewhere on java.sun.com, I
> believe, which allows you to play with the thing. Printing out the
> request from a real-life browser makes everything much simpler to
> understand.
>
> I have one (a small server) I made myself based on something I found on
> the Web (forgetting who made the basis, sorry). I'll mail it to you if
> you are interested, but the code is mixed up with some bandwidth control
> code, so it's not so clean.
>
> "Core Web Programming" (Prentice Hall) by Marty Hall has a good chapter
> on HTTP and a sample client which allows you to play with the thing from
> the client side.
>
> Hope this helps, and..
> have fun!
>
> Morten
>
>
>
>
> > David Chisholm wrote:
> >
> > I'm having a wonderful time this morning reading the HTTP 1.1 spec.
> > YUCH!  I hate reading IETF and W3C spec documents!  Can anyone
> > recommend a good book, tutorial, or even a class that discusses
> > "using" HTTP versus "implementing" HTTP?  I don't know about anyone
> > else, but to me it's like pulling teeth to find answers to practical
> > usage problems from their spec documents.  The JSP spec is the
> > ultimate developer's guide compared to the IETF and W3C specs.  Those
> > of you who have read the JSP spec can appreciate that :)
> > TIA,
> > David
> >
>
> --
>
> ------------------------------------------------------------------------
> Morten Norby Larsen                              [EMAIL PROTECTED]
> Magister Ludi Multimedia Lab                   Phone: +39 02 26 11 72 80
> Via Battaglia 8, I-20127 Milano, Italy         Fax:   +39 02 26 11 67 33
>                        http://www.magisterludi.com
>

===========================================================================
To unsubscribe: mailto [EMAIL PROTECTED] with body: "signoff JSP-INTEREST".
FAQs on JSP can be found at:
 http://java.sun.com/products/jsp/faq.html
 http://www.esperanto.org.nz/jsp/jspfaq.html

Reply via email to