1   /**
2    * Copyright (c) 2000-2010 Liferay, Inc. All rights reserved.
3    *
4    * This library is free software; you can redistribute it and/or modify it under
5    * the terms of the GNU Lesser General Public License as published by the Free
6    * Software Foundation; either version 2.1 of the License, or (at your option)
7    * any later version.
8    *
9    * This library is distributed in the hope that it will be useful, but WITHOUT
10   * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
11   * FOR A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more
12   * details.
13   */
14  
15  package com.liferay.util.servlet.filters;
16  
17  import com.liferay.util.servlet.Header;
18  
19  import java.io.Serializable;
20  
21  import java.util.HashMap;
22  import java.util.List;
23  import java.util.Map;
24  
25  /**
26   * <a href="CacheResponseData.java.html"><b><i>View Source</i></b></a>
27   *
28   * @author Michael Young
29   */
30  public class CacheResponseData implements Serializable {
31  
32      public CacheResponseData(
33          byte[] content, int contentLength, String contentType,
34          Map<String, List<Header>> headers) {
35  
36          _content = content;
37          _contentLength = contentLength;
38          _contentType = contentType;
39          _headers = headers;
40      }
41  
42      public Object getAttribute(String name) {
43          return _attributes.get(name);
44      }
45  
46      public byte[] getContent() {
47          return _content;
48      }
49  
50      public int getContentLength() {
51          return _contentLength;
52      }
53  
54      public String getContentType() {
55          return _contentType;
56      }
57  
58      public Map<String, List<Header>> getHeaders() {
59          return _headers;
60      }
61  
62      public void setAttribute(String name, Object value) {
63          _attributes.put(name, value);
64      }
65  
66      private Map<String, Object> _attributes = new HashMap<String, Object>();
67      private byte[] _content;
68      private int _contentLength;
69      private String _contentType;
70      private Map<String, List<Header>> _headers;
71  
72  }