1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18 package org.apache.jetspeed.portlet.webcontent;
19
20 import java.io.Serializable;
21
22 /***
23 * A cached resource object, stored in memory to optimize access to static resources
24 * such as images and style sheets.
25 *
26 * @author <a href="mailto:taylor@apache.org">David Sean Taylor</a>
27 * @version $Id: WebContentResource.java 517719 2007-03-13 15:05:48Z ate $
28 */
29
30 public class WebContentResource implements Serializable
31 {
32 private transient byte[] content = null;
33 private String url = null;
34 private String lastUrl = null;
35
36 /***
37 * Constructor for a cached resource.
38 *
39 * @param contentType The HTTP content type for a cached resource as defined
40 * in WebPageHelper, i.e. WebPageHelper.CT_HTML, WebPageHelper.CT_IMAGE....
41 * @param content The byte array of content this cached. This content can be
42 * binary images, or static text such as scripts and style sheets.
43 *
44 */
45 public WebContentResource(String url, byte[] content)
46 {
47 this.url = url;
48 if (content != null)
49 {
50 this.content = new byte[content.length];
51 System.arraycopy(content, 0, this.content, 0, this.content.length);
52 }
53 }
54
55 /***
56 * Gets the content of this resource in a byte array.
57 *
58 * @return A byte array of the resource's content.
59 */
60 public byte[] getContent()
61 {
62 return content;
63 }
64
65
66 /***
67 * @return Returns the lastUrl.
68 */
69 public String getLastUrl()
70 {
71 return lastUrl;
72 }
73 /***
74 * @param lastUrl The lastUrl to set.
75 */
76 public void setLastUrl(String lastUrl)
77 {
78 this.lastUrl = lastUrl;
79 }
80 /***
81 * @return Returns the url.
82 */
83 public String getUrl()
84 {
85 return url;
86 }
87 /***
88 * @param url The url to set.
89 */
90 public void setUrl(String url)
91 {
92 this.url = url;
93 }
94 }