Coverage Report - org.apache.tapestry.services.CookieSource
 
Classes in this File Line Coverage Branch Coverage Complexity
CookieSource
N/A
N/A
1
 
 1  
 // Copyright 2004, 2005 The Apache Software Foundation
 2  
 //
 3  
 // Licensed under the Apache License, Version 2.0 (the "License");
 4  
 // you may not use this file except in compliance with the License.
 5  
 // You may obtain a copy of the License at
 6  
 //
 7  
 //     http://www.apache.org/licenses/LICENSE-2.0
 8  
 //
 9  
 // Unless required by applicable law or agreed to in writing, software
 10  
 // distributed under the License is distributed on an "AS IS" BASIS,
 11  
 // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 12  
 // See the License for the specific language governing permissions and
 13  
 // limitations under the License.
 14  
 
 15  
 package org.apache.tapestry.services;
 16  
 
 17  
 /**
 18  
  * Used by other services to obtain cookie values for the current request.
 19  
  * 
 20  
  * @author Howard Lewis Ship
 21  
  * @since 4.0
 22  
  */
 23  
 public interface CookieSource
 24  
 {
 25  
     /**
 26  
      * Returns the value of the first cookie whose name matches. Returns null if no such cookie
 27  
      * exists. This method is only aware of cookies that are part of the incoming request; it does
 28  
      * not know about additional cookies added since then (via
 29  
      * {@link #writeCookieValue(String, String)}).
 30  
      */
 31  
     String readCookieValue(String name);
 32  
 
 33  
     /**
 34  
      * Creates or updates a cookie value. The value is stored using a max age (in seconds) defined
 35  
      * by the symbol <code>org.apache.tapestry.default-cookie-max-age</code>. The factory default
 36  
      * for this value is the equivalent of one week.
 37  
      */
 38  
 
 39  
     void writeCookieValue(String name, String value);
 40  
 
 41  
     /**
 42  
      * As with {@link #writeCookieValue(String, String)} but an explicit maximum age may be set.
 43  
      * 
 44  
      * @param name
 45  
      *            the name of the cookie
 46  
      * @param value
 47  
      *            the value to be stored in the cookie
 48  
      * @param maxAge
 49  
      *            the maximum age, in seconds, to store the cookie
 50  
      */
 51  
 
 52  
     void writeCookieValue(String name, String value, int maxAge);
 53  
     
 54  
     /**
 55  
      * As with {@link #writeCookieValue(String, String)} but an explicit path
 56  
      * may be set.
 57  
      */
 58  
     void writeCookieValue(String name, String value, String path);
 59  
     
 60  
     /**
 61  
      * As with {@link #writeCookieValue(String, String)} but an explicit path
 62  
      * may be set.
 63  
      */
 64  
     void writeDomainCookieValue(String name, String value, String domain);
 65  
     
 66  
     /**
 67  
      * As with {@link #writeCookieValue(String, String)} but an explicit path
 68  
      * may be set.
 69  
      */
 70  
     void writeDomainCookieValue(String name, String value, String domain, int maxAge);
 71  
     
 72  
     /**
 73  
      * As with {@link #writeCookieValue(String, String, String)} but an explicit
 74  
      * domain may be set.
 75  
      */
 76  
     void writeCookieValue(String name, String value, String path, String domain);
 77  
     
 78  
     /**
 79  
      * Removes a previously written cookie, by writing a new cookie with a maxAge of 0.
 80  
      */
 81  
 
 82  
     void removeCookieValue(String name);
 83  
 }