001
014
015 package com.liferay.portlet;
016
017 import javax.portlet.CacheControl;
018 import javax.portlet.MimeResponse;
019
020
024 public class CacheControlImpl implements CacheControl {
025
026 public CacheControlImpl(
027 String eTag, int expirationTime, boolean publicScope,
028 boolean useCachedContent, MimeResponseImpl mimeResponseImpl) {
029
030 _eTag = eTag;
031 _expirationTime = expirationTime;
032 _publicScope = publicScope;
033 _useCachedContent = useCachedContent;
034 _mimeResponseImpl = mimeResponseImpl;
035 }
036
037 @Override
038 public String getETag() {
039 return _eTag;
040 }
041
042 @Override
043 public int getExpirationTime() {
044 return _expirationTime;
045 }
046
047 @Override
048 public boolean isPublicScope() {
049 return _publicScope;
050 }
051
052 @Override
053 public void setETag(String eTag) {
054 _eTag = eTag;
055
056 _mimeResponseImpl.setProperty(MimeResponse.ETAG, eTag);
057 }
058
059 @Override
060 public void setExpirationTime(int expirationTime) {
061 _expirationTime = expirationTime;
062
063 _mimeResponseImpl.setProperty(
064 MimeResponse.EXPIRATION_CACHE, String.valueOf(expirationTime));
065 }
066
067 @Override
068 public void setPublicScope(boolean publicScope) {
069 _publicScope = publicScope;
070
071 _mimeResponseImpl.setProperty(
072 MimeResponse.PUBLIC_SCOPE, String.valueOf(publicScope));
073 }
074
075 @Override
076 public void setUseCachedContent(boolean useCachedContent) {
077 _useCachedContent = useCachedContent;
078
079 _mimeResponseImpl.setProperty(
080 MimeResponse.USE_CACHED_CONTENT, String.valueOf(useCachedContent));
081 }
082
083 @Override
084 public boolean useCachedContent() {
085 return _useCachedContent;
086 }
087
088 private String _eTag;
089 private int _expirationTime;
090 private MimeResponseImpl _mimeResponseImpl;
091 private boolean _publicScope;
092 private boolean _useCachedContent;
093
094 }