(String file)
| 132 | } |
| 133 | |
| 134 | private void serveFile(String file) |
| 135 | throws FileNotFoundException, IOException |
| 136 | { |
| 137 | // Do some mappings |
| 138 | if ( file.equals("/") ) |
| 139 | file = "/remote/remote.html"; |
| 140 | |
| 141 | if ( file.startsWith("/remote/") ) |
| 142 | file = "/bsh/util/lib/" + file.substring(8); |
| 143 | |
| 144 | /* |
| 145 | if(file.startsWith("/")) |
| 146 | file = file.substring(1); |
| 147 | if(file.endsWith("/") || file.equals("")) |
| 148 | file = file + "index.html"; |
| 149 | |
| 150 | if(!fileAccessOK(file)) |
| 151 | { |
| 152 | error(403, "Forbidden"); |
| 153 | return; |
| 154 | } |
| 155 | */ |
| 156 | |
| 157 | // don't send java packages over... (e.g. swing) |
| 158 | if ( file.startsWith("/java" ) ) |
| 159 | error(404, "Object Not Found"); |
| 160 | else |
| 161 | try { |
| 162 | System.out.println("sending file: "+file); |
| 163 | sendFileData(file); |
| 164 | } catch(FileNotFoundException e) { |
| 165 | error(404, "Object Not Found"); |
| 166 | } |
| 167 | } |
| 168 | |
| 169 | private void sendFileData(String file) |
| 170 | throws IOException, FileNotFoundException |
no test coverage detected