<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %> <%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %> <%@ page import="java.util.List" %> <%@ page import="java.util.Collection" %> <%@ page import="java.util.Iterator" %> <%@ page import="java.util.ArrayList" %> <%@ page import="java.net.URLEncoder" %> <%@ page import="com.idca.fsim.searchers.files.models.Host" %> <%@ page import="com.idca.fsim.searchers.files.models.File" %> <%@ page import="com.idca.fsim.searchers.files.models.Path" %> <%@ page import="com.idca.fsim.searchers.files.FilesListener" %> <% Object model = session.getAttribute("model"); Path path = null; Host host = null; Collection paths = null; List files = null; if(model instanceof File) { File file = (File)model; path = file.getPath(); paths = path.getChilderen(); files = FilesListener.getPathManager().getFiles(path); } if(model instanceof Path) { path = (Path)model; paths = path.getChilderen(); files = FilesListener.getPathManager().getFiles(path); } if(model instanceof Host) { host = (Host)model; if (host.getRootPaths().iterator().hasNext()) { paths = ((Path)(host.getRootPaths().iterator().next())).getChilderen(); files = FilesListener.getPathManager().getFiles(((Path)(host.getRootPaths().iterator().next()))); } else { paths = new ArrayList(); files = new ArrayList(); } } request.setAttribute("paths",paths); request.setAttribute("files",files); %> <% if (path!=null && path.getParent()!=null) { %> <% } %> <% if (host!=null) { %> <% } // Iterator p = paths.iterator(); while(p.hasNext()) { Path pp = (Path)p.next(); request.setAttribute("path",pp); %> <% } // Iterator f = files.iterator(); while(f.hasNext()) { request.setAttribute("file",f.next()); File file = (File)request.getAttribute("file"); //redirect?ss="+hit.source.getName()+"&rid="+hit.id+"&up=path_browse"+"\">browse"); String url = "redirect/"+file.getPath()+file.getName(); url = file.getPath().getHost().getProtocol()+file.getPath().getHost().getHostName()+URLEncoder.encode(url, "UTF-8"); %> <% } // %>
">..
/ (root)
> "> <% Path path2 = (Path)request.getAttribute("path"); //if(path2!=null) { out.println(path2.getChilderen().size()); //} else { // out.println("path2 null"); //} %>
<% //File file = (File)request.getAttribute("file"); //if(file!=null) { out.println(File.printSize(file)); //} else { // out.println("file is null"); //} %>