/*
|
http-adoc - Asciidoctor extensions to jdk.httpserver
|
Copyright (C) 2021 Ulrich Hilger
|
|
This program is free software: you can redistribute it and/or modify
|
it under the terms of the GNU Affero General Public License as
|
published by the Free Software Foundation, either version 3 of the
|
License, or (at your option) any later version.
|
|
This program is distributed in the hope that it will be useful,
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
GNU Affero General Public License for more details.
|
|
You should have received a copy of the GNU Affero General Public License
|
along with this program. If not, see <https://www.gnu.org/licenses/>.
|
*/
|
package de.uhilger.httpserver.adoc;
|
|
import com.sun.net.httpserver.HttpExchange;
|
import de.uhilger.httpserver.base.handler.FileHandler;
|
import java.io.IOException;
|
import java.util.logging.Logger;
|
|
/**
|
* Der AdocHandler verwendet den FileHandler zur Auslieferung statischer
|
* Inhalte und einen AdocFilter, um vorab zu pruefen, ob fuer eine
|
* Asciidoctor-Quelldatei bereits eine HTML-Version vorliegt. Wenn nicht,
|
* verwendet der AdocFilter den AdocActor, um eine HTML-Version zu erzeugen,
|
* die dann vom AdocHandler mit Hilfe der Methoden des FileHandler
|
* ausgeliefert werden kann.
|
*
|
* @author Ulrich Hilger
|
* @version 1, 16.06.2021
|
*/
|
public class AdocHandler extends FileHandler {
|
|
private static final Logger logger = Logger.getLogger(AdocHandler.class.getName());
|
|
public AdocHandler(String absoluteDirectoryPathAndName) {
|
super(absoluteDirectoryPathAndName);
|
}
|
|
@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
|
}
|
|
public String getFileBase() {
|
return this.fileBase;
|
}
|
|
|
}
|