| | |
| | | package de.uhilger.httpserver.adoc; |
| | | |
| | | import com.sun.net.httpserver.HttpExchange; |
| | | import de.uhilger.httpserver.base.HttpResponder; |
| | | import de.uhilger.httpserver.base.handler.FileHandler; |
| | | import java.io.File; |
| | | import java.io.IOException; |
| | | import java.net.URI; |
| | | import java.util.logging.Logger; |
| | | |
| | | /** |
| | |
| | | |
| | | @Override |
| | | public void handle(HttpExchange e) throws IOException { |
| | | logger.fine(e.getRequestURI().toString()); |
| | | // hier ggf. noch etwas eigenes machen... |
| | | super.handle(e); // zu FileHandler delegieren |
| | | URI uri = e.getRequestURI(); |
| | | logger.fine(uri.toString()); |
| | | String query = uri.getQuery(); |
| | | //String[] params = query.split("?&"); // hier noch Regex ermitteln |
| | | String requestPathStr = uri.getPath(); |
| | | //logger.fine("filter: " + requestUriStr); |
| | | if(requestPathStr.toLowerCase().endsWith(AdocFilter.ADOC)) { |
| | | File adocfile = new File(fileBase, getFileName(e)); |
| | | AdocActor actor = new AdocActor(); |
| | | File outfile = actor.getTargetFile(adocfile, AdocActor.HTML); |
| | | HttpResponder fs = new HttpResponder(); |
| | | fs.serveFile(e, outfile); |
| | | } else { |
| | | super.handle(e); // andere Inhalte zu FileHandler delegieren |
| | | } |
| | | } |
| | | |
| | | public String getFileBase() { |