1 package org.apache.turbine.util; 2 3 18 19 import javax.servlet.http.HttpServletRequest ; 20 21 45 public class RelativeDynamicURI extends DynamicURI 46 { 47 50 public RelativeDynamicURI() 51 { 52 } 53 54 59 public RelativeDynamicURI(RunData data) 60 { 61 super(data); 62 } 63 64 70 public RelativeDynamicURI(RunData data, String screen) 71 { 72 super(data, screen); 73 } 74 75 82 public RelativeDynamicURI(RunData data, String screen, String action) 83 { 84 super(data, screen, action); 85 } 86 87 95 public RelativeDynamicURI(RunData data, 96 String screen, 97 String action, 98 boolean redirect) 99 { 100 super(data, screen, action, redirect); 101 } 102 103 110 public RelativeDynamicURI(RunData data, 111 String screen, 112 boolean redirect) 113 { 114 super(data, screen, redirect); 115 } 116 117 123 public RelativeDynamicURI(RunData data, boolean redirect) 124 { 125 super(data, redirect); 126 } 127 128 133 public RelativeDynamicURI(ServerData sd) 134 { 135 super(sd); 136 } 137 138 144 public RelativeDynamicURI(ServerData sd, String screen) 145 { 146 super(sd, screen); 147 } 148 149 156 public RelativeDynamicURI(ServerData sd, 157 String screen, 158 String action) 159 { 160 super(sd, screen, action); 161 } 162 163 171 public RelativeDynamicURI(ServerData sd, 172 String screen, 173 String action, 174 boolean redirect) 175 { 176 super(sd, screen, action, redirect); 177 } 178 179 186 public RelativeDynamicURI(ServerData sd, 187 String screen, 188 boolean redirect) 189 { 190 super(sd, screen, redirect); 191 } 192 193 199 public RelativeDynamicURI(ServerData sd, boolean redirect) 200 { 201 super(sd, redirect); 202 } 203 204 222 public String toString() 223 { 224 assertInitialized(); 225 StringBuffer output = new StringBuffer (); 226 output.append(getContextPath()); 227 output.append(getScriptName()); 228 if (this.hasPathInfo) 229 { 230 output.append("/"); 231 output.append(renderPathInfo(this.pathInfo)); 232 } 233 if (this.hasQueryData) 234 { 235 output.append("?"); 236 output.append(renderQueryString(this.queryData)); 237 } 238 if (this.reference != null) 239 { 240 output.append("#"); 241 output.append(this.getReference()); 242 } 243 244 if (this.res != null) 248 { 249 if (this.redirect) 250 { 251 return res.encodeRedirectURL(output.toString()); 252 } 253 else 254 { 255 return res.encodeURL(output.toString()); 256 } 257 } 258 else 259 { 260 return output.toString(); 261 } 262 } 263 264 274 public static String toString(RunData data) 275 { 276 StringBuffer output = new StringBuffer (); 277 HttpServletRequest request = data.getRequest(); 278 279 output.append(data.getServerData().getContextPath()); 280 output.append(data.getServerData().getScriptName()); 281 282 if (request.getPathInfo() != null) 283 { 284 output.append(request.getPathInfo()); 285 } 286 287 if (request.getQueryString() != null) 288 { 289 output.append("?"); 290 output.append(request.getQueryString()); 291 } 292 return output.toString(); 293 } 294 } 295 | Popular Tags |