1
14
15 package com.liferay.portal.webserver;
16
17 import com.liferay.portal.kernel.util.GetterUtil;
18 import com.liferay.portal.kernel.util.HttpUtil;
19 import com.liferay.portal.kernel.util.StringPool;
20
21 import java.util.Date;
22
23
28 public class WebServerEntry {
29
30 public WebServerEntry(String path, String name) {
31 this(path, name, null, null, null, 0);
32 }
33
34 public WebServerEntry(
35 String path, String name, Date createDate, Date modifiedDate,
36 String description, long size) {
37
38 _path = getPath(path, name);
39 _name = name;
40 _createDate = createDate;
41 _modifiedDate = modifiedDate;
42 _description = GetterUtil.getString(description);
43 _size = size;
44 }
45
46 public Date getCreateDate() {
47 return _createDate;
48 }
49
50 public String getDescription() {
51 return _description;
52 }
53
54 public Date getModifiedDate() {
55 return _modifiedDate;
56 }
57
58 public String getName() {
59 return _name;
60 }
61
62 public String getPath() {
63 return _path;
64 }
65
66 public long getSize() {
67 return _size;
68 }
69
70 public void setCreateDate(Date createDate) {
71 _createDate = createDate;
72 }
73
74 public void setDescription(String description) {
75 _description = description;
76 }
77
78 public void setModifiedDate(Date modifiedDate) {
79 _modifiedDate = modifiedDate;
80 }
81
82 public void setName(String name) {
83 _name = name;
84 }
85
86 public void setPath(String path) {
87 _path = path;
88 }
89
90 public void setSize(long size) {
91 _size = size;
92 }
93
94 protected String getPath(String path, String name) {
95 if (name.endsWith(StringPool.SLASH)) {
96 name = HttpUtil.fixPath(name, false, true);
97
98 return getPath(path, name) + StringPool.SLASH;
99 }
100
101 if (path.endsWith(StringPool.SLASH)) {
102 path = path + HttpUtil.encodeURL(name, true);
103 }
104 else {
105 path = path + StringPool.SLASH + HttpUtil.encodeURL(name, true);
106 }
107
108 return path;
109 }
110
111 private Date _createDate;
112 private String _description;
113 private Date _modifiedDate;
114 private String _name;
115 private String _path;
116 private long _size;
117
118 }