On Friday 15 November 2002 12:54, Bill Angel wrote:
> Hello:
>
> I recently installed ApacheTomcat 4.1.12-LE-jdk14. The installation appears
> to function correctly, but I am experiencing difficulties  getting browsers
> (IE 5.5 and Netscape 7.0) to recognize the "cache-control " directives
> specific to the http/1.1 protocol. I am utilizing a Servlet to send back a
> Response  as follows:
>
>     if(fileName == null) {
>
>         PrintWriter out = new PrintWriter (response.getOutputStream());
>          response.reset();
>          response.setHeader("Pragma","no-cache");
>          response.setHeader("Cache-Control","no-cache");
>          response.setHeader("Cache-Control","no-store");
>          response.setHeader("Cache-Control","must-revalidate");
>          response.setDateHeader("Expires",-1);

Make this: response.setHeader("Expires", 1);
The time is the total number of seconds since Epoch ("Jan 1 1970 00:00:00");

>          response.setContentType("text/html");

You're not generating a valid HTML page, so change:
response.setContentType("text/plain");

>         out.println("file not specified!");
>         out.close();
>         return;
>     }

<cut>

>  Is it possible to detect within the Servlet code whether the connection
> that was established is utilizing http/1.0 or http/1.1?

Yes, use: request.getProtocol().

<cut>

> For security reasons, I want to be able to
> instruct the user's Browser, and any intermediate Proxy Servers,
> NOT to cache documents being sent back to the user during his session. via
> the http/1.1 "Cache-Control" Header functionality.

You can't, this is out of you're controll. A well behaved browser should 
honour your request to not cache this page, but you have no way of enforcing 
it.

>  Also, is it possible  to configure Tomcat to not drop back to using
> http/1.0, when a connection utilizing http/1.1 cannot be established?

AFAIK this happens automagically.

>   Thanks
>
>    Bill Angel
>    Computer Scientist
>    Silver Spring, Maryland
>    [EMAIL PROTECTED]

Regards,
Cees.

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

Reply via email to