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 import java.util.HashMap;
22 import java.util.Iterator;
23 import java.util.Map;
24
25 import org.apache.commons.lang.ArrayUtils;
26
27
28 /***
29 * Information required to re-visit a page in the WebContentPortlet
30 *
31 * @author <a href="mailto:dyoung@phase2systems.com">David L Young</a>
32 * @version $Id: $
33 */
34
35 public class WebContentHistoryPage extends Object
36 implements Serializable
37 {
38 private String url;
39 private Map params;
40 private boolean is_post;
41
42
43
44 public WebContentHistoryPage(String url)
45 {
46 this(url, null, null);
47 }
48 public WebContentHistoryPage(String url, Map params, String method)
49 {
50 super();
51
52
53 if (url==null)
54 throw new IllegalArgumentException("WebContentHistoryPage() - url required");
55
56 this.url = url;
57 this.params = params != null ? params : new HashMap();
58 this.is_post = method != null && method.equalsIgnoreCase("post");
59 }
60
61
62
63 public boolean equals(Object o)
64 {
65 if (o == null || !(o instanceof WebContentHistoryPage))
66 return false ;
67
68 WebContentHistoryPage page = (WebContentHistoryPage)o;
69
70 return page.url.equals(this.url) && page.params.equals(this.params) && page.isPost() == this.isPost() ;
71 }
72 public String toString()
73 {
74 StringBuffer buff = new StringBuffer();
75 buff.append( "[" ).append(isPost() ? "POST: " : "GET: ").append( getUrl() ).append( ", " ).append( getParams().size() ).append(" params: {");
76 Iterator iter = getParams().entrySet().iterator();
77 while ( iter.hasNext() )
78 {
79 Map.Entry entry = (Map.Entry)iter.next();
80 buff.append("(").append(entry.getKey()).append(" . ").append(ArrayUtils.toString(entry.getKey())).append(")");
81 }
82 buff.append("}]");
83 return buff.toString();
84 }
85
86
87
88 public String getUrl()
89 {
90 return this.url;
91 }
92 public Map getParams()
93 {
94 return this.params;
95 }
96 public boolean isPost()
97 {
98 return this.is_post;
99 }
100 }