1 19 20 package com.sslexplorer.networkplaces.tags; 21 22 import java.util.StringTokenizer ; 23 24 import javax.servlet.jsp.JspException ; 25 import javax.servlet.jsp.tagext.BodyTagSupport ; 26 27 import org.apache.commons.logging.Log; 28 import org.apache.commons.logging.LogFactory; 29 import org.apache.struts.taglib.TagUtils; 30 31 import com.sslexplorer.networkplaces.forms.FileSystemForm; 32 import com.sslexplorer.policyframework.LaunchSession; 33 34 41 public class PathsTag extends BodyTagSupport { 42 final static Log log = LogFactory.getLog(PathsTag.class); 43 44 private String paths; 45 protected String scope; 46 protected String property; 47 protected String name; 48 49 public int doStartTag() throws JspException { 50 51 LaunchSession launchSession = (LaunchSession)TagUtils.getInstance().lookup(pageContext, name, property, scope); 53 54 55 FileSystemForm fsf = (FileSystemForm) pageContext.getRequest().getAttribute("fileSystemForm"); 56 StringBuffer results = new StringBuffer (); 57 results.append("<div class=\"path\"><span>"); 58 StringTokenizer tok = new StringTokenizer (fsf.getPath(), "/"); 59 60 String currentPath = tok.nextToken(); if (currentPath.equals("fs")){ 63 currentPath = tok.nextToken(); } 65 while(tok.hasMoreTokens()) { 66 String element = tok.nextToken(); 67 currentPath += "/" + element; 68 results.append("<a HREF=\"fileSystem.do?actionTarget=list&" + LaunchSession.LAUNCH_ID + "=" + launchSession.getId() + "&path=" + currentPath + "\">" + element +"</a> / "); 69 } 70 results.append(" </span></div>"); 71 paths = results.toString(); 72 return (SKIP_BODY); 73 } 74 75 78 public int doEndTag() throws JspException { 79 TagUtils.getInstance().write(this.pageContext, paths); 80 return EVAL_PAGE; 81 } 82 83 @Override 84 public void release() { 85 super.release(); 86 name = null; 87 property = null; 88 scope = null; 89 } 90 91 public String getName() { 92 return (this.name); 93 } 94 95 public void setName(String name) { 96 this.name = name; 97 } 98 99 100 public String getProperty() { 101 return (this.property); 102 } 103 104 public void setProperty(String property) { 105 this.property = property; 106 } 107 public String getScope() { 108 return (this.scope); 109 } 110 111 public void setScope(String scope) { 112 this.scope = scope; 113 } 114 115 } | Popular Tags |