1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17 package org.apache.pluto.portalImpl.core;
18
19 import java.net.MalformedURLException;
20 import java.net.URL;
21
22 import org.apache.pluto.om.window.PortletWindow;
23 import org.apache.pluto.services.information.ResourceURLProvider;
24
25 public class ResourceURLProviderImpl implements ResourceURLProvider
26 {
27
28 private PortletWindow portletWindow = null;
29 private String stringUrl = "";
30 private String base = "";
31
32 public ResourceURLProviderImpl(DynamicInformationProviderImpl provider,
33 PortletWindow portletWindow)
34 {
35 this.portletWindow = portletWindow;
36 this.base = PortalURL.getBaseURLexcludeContext();
37 }
38
39
40
41 public void setAbsoluteURL(String path)
42 {
43 stringUrl = path;
44 }
45
46 public void setFullPath(String path)
47 {
48 stringUrl = base + path;
49 }
50
51 public String toString()
52 {
53 URL url = null;
54
55 if (!"".equals(stringUrl))
56 {
57 try
58 {
59 url = new URL(stringUrl);
60 }
61 catch (MalformedURLException e)
62 {
63 throw new java.lang.IllegalArgumentException("A malformed URL has occured");
64 }
65 }
66
67 return ((url==null)?"":url.toString());
68
69 }
70
71 }