1 52 53 54 import com.go.teaservlet.*; 55 import java.io.*; 56 import java.util.Vector ; 57 58 64 public class SampleDirectoryBrowserContext { 65 66 ApplicationRequest mRequest; 67 ApplicationResponse mResponse; 68 SampleDirectoryBrowserApp mApp; 69 70 public SampleDirectoryBrowserContext(ApplicationRequest request, 71 ApplicationResponse response, 72 SampleDirectoryBrowserApp app) { 73 mRequest = request; 74 mResponse = response; 75 mApp = app; 76 } 77 78 80 public File[] getFiles() { 81 82 String path = mRequest.getParameter("path"); 83 if (path == null) { 84 path = mApp.getInitParameter("defaultPath"); 85 } 86 if (path == null) { 87 path = "/"; 88 } 89 90 File activefile = new File(path); 91 if( activefile.isDirectory()) { 92 return activefile.listFiles(); 93 } else { 94 return null; 95 } 96 } 97 } 98 | Popular Tags |