From 1d695f99b80503bd6efbf181e6b8733ba3d1fb25 Mon Sep 17 00:00:00 2001
From: ulrich
Date: Sun, 09 Jan 2022 14:26:06 +0000
Subject: [PATCH] Logging entfernt

---
 src/de/uhilger/httpserver/adoc/AdocFilter.java |   18 ++++++++++++------
 1 files changed, 12 insertions(+), 6 deletions(-)

diff --git a/src/de/uhilger/httpserver/adoc/AdocFilter.java b/src/de/uhilger/httpserver/adoc/AdocFilter.java
index 27eeef4..e37fede 100644
--- a/src/de/uhilger/httpserver/adoc/AdocFilter.java
+++ b/src/de/uhilger/httpserver/adoc/AdocFilter.java
@@ -20,6 +20,8 @@
 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;
 import java.net.URI;
@@ -52,14 +54,18 @@
     if(requestPathStr.toLowerCase().endsWith(ADOC)) {
       logger.fine("filter: " + requestPathStr);
       HttpHandler handler = exchange.getHttpContext().getHandler();
-      if(handler instanceof AdocHandler) {
-        AdocHandler adocHandler = (AdocHandler) handler;
-        String fileBase = adocHandler.getFileBase();
+      if(handler instanceof FileHandler) {
+        FileHandler fileHandler = (FileHandler) handler;
+        String fileBase = exchange.getHttpContext().getAttributes().get(FileHandler.ATTR_FILE_BASE).toString();
         AdocActor actor = new AdocActor();
-        actor.processAdocFile(new File(fileBase, adocHandler.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);
   }
 

--
Gitblit v1.9.3