1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * The contents of this file are subject to the terms of the Liferay Enterprise
5    * Subscription License ("License"). You may not use this file except in
6    * compliance with the License. You can obtain a copy of the License by
7    * contacting Liferay, Inc. See the License for the specific language governing
8    * permissions and limitations under the License, including but not limited to
9    * distribution rights of the Software.
10   *
11   *
12   *
13   */
14  
15  package com.liferay.portlet;
16  
17  import javax.portlet.CacheControl;
18  import javax.portlet.MimeResponse;
19  
20  /**
21   * <a href="CacheControlImpl.java.html"><b><i>View Source</i></b></a>
22   *
23   * @author Brian Wing Shun Chan
24   * @author Deepak Gothe
25   */
26  public class CacheControlImpl implements CacheControl {
27  
28      public CacheControlImpl(
29          String eTag, int expirationTime, boolean publicScope,
30          boolean useCachedContent, MimeResponseImpl mimeResponseImpl) {
31  
32          _eTag = eTag;
33          _expirationTime = expirationTime;
34          _publicScope = publicScope;
35          _useCachedContent = useCachedContent;
36          _mimeResponseImpl = mimeResponseImpl;
37      }
38  
39      public String getETag() {
40          return _eTag;
41      }
42  
43      public boolean isPublicScope() {
44          return _publicScope;
45      }
46  
47      public int getExpirationTime() {
48          return _expirationTime;
49      }
50  
51      public void setETag(String eTag) {
52          _eTag = eTag;
53  
54          _mimeResponseImpl.setProperty(MimeResponse.ETAG, eTag);
55      }
56  
57      public void setExpirationTime(int expirationTime) {
58          _expirationTime = expirationTime;
59  
60          _mimeResponseImpl.setProperty(
61              MimeResponse.EXPIRATION_CACHE, String.valueOf(expirationTime));
62      }
63  
64      public void setPublicScope(boolean publicScope) {
65          _publicScope = publicScope;
66  
67          _mimeResponseImpl.setProperty(
68              MimeResponse.PUBLIC_SCOPE, String.valueOf(publicScope));
69      }
70  
71      public void setUseCachedContent(boolean useCachedContent) {
72          _useCachedContent = useCachedContent;
73  
74          _mimeResponseImpl.setProperty(
75              MimeResponse.USE_CACHED_CONTENT, String.valueOf(useCachedContent));
76      }
77  
78      public boolean useCachedContent() {
79          return _useCachedContent;
80      }
81  
82      private String _eTag;
83      private int _expirationTime;
84      private MimeResponseImpl _mimeResponseImpl;
85      private boolean _publicScope;
86      private boolean _useCachedContent;
87  
88  }