| | |
| | | import com.sun.net.httpserver.HttpExchange; |
| | | import com.sun.net.httpserver.HttpHandler; |
| | | import de.uhilger.mediaz.App; |
| | | import static de.uhilger.mediaz.Server.RB_SLASH; |
| | | import de.uhilger.mediaz.Server; |
| | | import java.io.File; |
| | | import java.io.FileInputStream; |
| | | import java.io.IOException; |
| | |
| | | if (headers.containsKey(RANGE_HEADER)) { |
| | | serveFileParts(e, new File(fileBase, fName)); |
| | | } else { |
| | | if (fName.length() < 1 || fName.endsWith(App.getRs(RB_SLASH))) { |
| | | if (fName.length() < 1 || fName.endsWith(Server.SLASH)) { |
| | | fName += App.getRs(RB_WELCOME_FILE); |
| | | } |
| | | serveFile(e, new File(fileBase, fName)); |
| | |
| | | sb.append(range.getStart()); |
| | | sb.append(App.getRs(RB_DASH)); |
| | | sb.append(range.getEnd()); |
| | | sb.append(App.getRs(RB_SLASH)); |
| | | sb.append(Server.SLASH); |
| | | sb.append(file.length()); |
| | | return sb.toString(); |
| | | } |