Asciidoctor mit Neon transformieren
ulrich
2022-01-09 1d695f99b80503bd6efbf181e6b8733ba3d1fb25
src/de/uhilger/httpserver/adoc/AdocFilter.java
@@ -20,6 +20,7 @@
import com.sun.net.httpserver.Filter;
import com.sun.net.httpserver.HttpExchange;
import com.sun.net.httpserver.HttpHandler;
import de.uhilger.httpserver.base.HttpHelper;
import de.uhilger.httpserver.base.handler.FileHandler;
import java.io.File;
import java.io.IOException;
@@ -55,9 +56,14 @@
      HttpHandler handler = exchange.getHttpContext().getHandler();
      if(handler instanceof FileHandler) {
        FileHandler fileHandler = (FileHandler) handler;
        String fileBase = fileHandler.getFileBase();
        String fileBase = exchange.getHttpContext().getAttributes().get(FileHandler.ATTR_FILE_BASE).toString();
        AdocActor actor = new AdocActor();
        actor.processAdocFile(new File(fileBase, fileHandler.getFileName(exchange)), Boolean.FALSE.toString());
        HttpHelper helper = new HttpHelper();
        if(query != null && query.equalsIgnoreCase("pdf=true")) {
          actor.processAdocFile(new File(fileBase, helper.getFileName(exchange)), Boolean.TRUE.toString());
        } else {
          actor.processAdocFile(new File(fileBase, helper.getFileName(exchange)), Boolean.FALSE.toString());
        }
      }
    }    
    chain.doFilter(exchange);