1 9 package org.jboss.portal.portlet.impl; 10 11 import javax.portlet.PortletResponse; 12 13 import org.jboss.portal.server.PortalRequest; 14 import org.jboss.portal.server.PortalResponse; 15 import org.jboss.portal.server.util.Properties; 16 17 21 public abstract class PortletResponseImpl implements PortletResponse 22 { 23 24 protected final PortalRequest req; 25 protected final PortalResponse resp; 26 protected final Properties properties; 27 28 protected PortletResponseImpl( 29 PortalRequest req, 30 PortalResponse resp, 31 Properties properties) 32 { 33 if (resp == null) 34 { 35 throw new IllegalArgumentException ("Resp must not be null"); 36 } 37 this.req = req; 38 this.resp = resp; 39 this.properties = properties; 40 } 41 42 public String encodeURL(String url) 43 { 44 if (url == null) 45 { 46 throw new IllegalArgumentException ("URL must not be null"); 47 } 48 if (!url.startsWith("http://") && !url.startsWith("/")) 49 { 50 throw new IllegalArgumentException ("invalid URL " + url); 51 } 52 return resp.encodeURL(url); 53 } 54 55 public void addProperty(String name, String value) 56 { 57 properties.addProperty(name, value); 58 } 59 60 public void setProperty(String name, String value) 61 { 62 properties.setProperty(name, value); 63 } 64 } 65 | Popular Tags |