001package votorola.a.web.wap; // Copyright 2012, Michael Allan.  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Votorola Software"), to deal in the Votorola Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicence, and/or sell copies of the Votorola Software, and to permit persons to whom the Votorola Software is furnished to do so, subject to the following conditions: The preceding copyright notice and this permission notice shall be included in all copies or substantial portions of the Votorola Software. THE VOTOROLA SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE VOTOROLA SOFTWARE OR THE USE OR OTHER DEALINGS IN THE VOTOROLA SOFTWARE.
002
003import votorola.g.lang.*;
004
005
006/** A context for configuring the response headers for one or more calls.  Configuration
007  * should be done before writing to the response buffer because the response will be
008  * committed (and its headers sent) on the first flush of the buffer.
009  */
010public @ThreadRestricted("Call constructor") interface ResponseConfiguration
011{
012
013
014   // - R e s p o n s e - C o n f i g u r a t i o n --------------------------------------
015
016
017    /** Instructs the client to validate the response for every request, such that it
018      * never uses a stale response without first asking the user's permission.  Ensures
019      * that <a href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.4'target='_top'>Cache-Control must-revalidate</a>
020      * is added to the headers.
021      */
022    public void headMustRevalidate();
023
024
025
026    /** Makes the response non-cacheable by the client.  Ensures that
027      * <a href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1'target='_top'>Cache-Control no-cache</a>
028      * (HTTP 1.1) and <a href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.32' target='_top'>Pragma no-cache</a>
029      * (HTTP 1.0) are added to the headers.  Also ensures that
030      * <a href='http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.2' target='_top'>Cache-Control no-store</a>
031      * is added for the sake of clients (Firefox 9) that disobey <code>no-cache</code>.
032      *
033      * <p>These nevertheless fail with Chrome 18.
034      * Consider <a href='WAP.html#wNonce' target='_top'>adding a nonce</a>
035      * to the client request as a fallback.</p>
036      */
037    public void headNoCache();
038
039     // Adding Cache-Control private [1] and Expires [2] does not help in Chrome 18.
040     // [1] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.9.1
041     // [2] http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.21
042
043
044}