From 5ca8131e61226dda11d3ff81e12f9fbd39b99a1a Mon Sep 17 00:00:00 2001
From: ulrich
Date: Sun, 20 Jun 2021 10:17:46 +0000
Subject: [PATCH] Package testbereit

---
 src/de/uhilger/httpserver/adoc/AdocHandler.java |   21 ++++++++++++++++++---
 1 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/de/uhilger/httpserver/adoc/AdocHandler.java b/src/de/uhilger/httpserver/adoc/AdocHandler.java
index dc20617..69ae227 100644
--- a/src/de/uhilger/httpserver/adoc/AdocHandler.java
+++ b/src/de/uhilger/httpserver/adoc/AdocHandler.java
@@ -18,8 +18,11 @@
 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;
 
 /**
@@ -43,9 +46,21 @@
 
   @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() {

--
Gitblit v1.9.3