1 16 19 20 package org.apache.pluto.tags; 21 22 import java.io.IOException ; 23 24 import javax.portlet.PortletURL; 25 import javax.servlet.jsp.JspException ; 26 import javax.servlet.jsp.JspWriter ; 27 import javax.servlet.jsp.PageContext ; 28 import javax.servlet.jsp.tagext.TagData ; 29 import javax.servlet.jsp.tagext.TagExtraInfo ; 30 import javax.servlet.jsp.tagext.TagSupport ; 31 import javax.servlet.jsp.tagext.VariableInfo ; 32 33 39 public abstract class BasicURLTag extends TagSupport 40 { 41 42 public static class TEI extends TagExtraInfo 43 { 44 public VariableInfo [] getVariableInfo(TagData tagData) 45 { 46 VariableInfo vi[] = null; 47 String var = tagData.getAttributeString("var"); 48 if (var != null) 49 { 50 vi = new VariableInfo [1]; 51 vi[0] = new VariableInfo (var, "java.lang.String", true, VariableInfo.AT_BEGIN); 52 } 53 return vi; 54 } 55 } 56 57 protected String portletMode; 58 protected String secure; 59 protected Boolean secureBoolean; 60 protected String windowState; 61 protected PortletURL url; 62 protected String var; 63 64 68 public abstract int doStartTag() throws JspException ; 69 70 74 public int doEndTag() throws JspException { 75 if (var == null) 76 { 77 try 78 { 79 JspWriter writer = pageContext.getOut(); 80 writer.print(url); 81 writer.flush(); 82 } 83 catch (IOException ioe) 84 { 85 throw new JspException ("actionURL/renderURL Tag Exception: cannot write to the output writer."); 86 } 87 } else { 88 pageContext.setAttribute (var, url.toString(), PageContext.PAGE_SCOPE); 89 } 90 return EVAL_PAGE; 91 } 92 93 97 public String getPortletMode() 98 { 99 return portletMode; 100 } 101 102 105 public String getSecure() 106 { 107 return secure; 108 } 109 110 113 public boolean getSecureBoolean() 114 { 115 return this.secureBoolean.booleanValue(); 116 } 117 118 122 public String getWindowState() 123 { 124 return windowState; 125 } 126 127 130 public PortletURL getUrl() 131 { 132 return url; 133 } 134 135 139 public String getVar() 140 { 141 return var; 142 } 143 144 148 public void setPortletMode(String portletMode) 149 { 150 this.portletMode = portletMode; 151 } 152 153 157 public void setSecure(String secure) 158 { 159 this.secure = secure; 160 this.secureBoolean = new Boolean (secure); 161 } 162 163 167 public void setWindowState(String windowState) 168 { 169 this.windowState = windowState; 170 } 171 172 176 public void setUrl(PortletURL url) 177 { 178 this.url = url; 179 } 180 181 185 public void setVar(String var) 186 { 187 this.var = var; 188 } 189 } 190 | Popular Tags |