/*
|
http-template - Template 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.template;
|
|
import com.github.mustachejava.DefaultMustacheFactory;
|
import java.io.File;
|
import java.io.IOException;
|
import java.io.Writer;
|
|
/**
|
* Eine MustacheFactory die die Methode encode der
|
* DefaultMustacheFactory deaktiviert.
|
*
|
* @author Ulrich Hilger
|
* @version 1, 30.06.2021
|
*/
|
public class NeonMustacheFactory extends DefaultMustacheFactory {
|
|
/**
|
* Eine MustacheFactory erzeugen, die Temlates im Classpath sucht
|
*/
|
public NeonMustacheFactory() {
|
super();
|
}
|
|
/**
|
* Eine MustacheFactory erzeugen, die Templates in einem Ordner
|
* des Dateisystems sucht.
|
*
|
* @param fileRoot der Ordner, der als Basis für Dateinamen nebst
|
* realtiven PFadangaben dienen soll
|
*/
|
public NeonMustacheFactory(File fileRoot) {
|
super(fileRoot);
|
}
|
|
/**
|
* Die DefaultMustacheFactory veraendert HTML-Inhalte ueber die Methode
|
* encode. Deshalb wird die MEthode hier ueberschrieben und der Wert in
|
* 'value' unveraendert herausgeschrieben.
|
*
|
* @param value zu schreibender Wert
|
* @param writer der Writer, der zum Schreiben genutzt wird
|
*/
|
@Override
|
public void encode(String value, Writer writer) {
|
try {
|
writer.write(value);
|
//super.encode(value, writer);
|
} catch (IOException ex) {
|
//Logger.getLogger(NeonMustacheFactory.class.getName()).log(Level.SEVERE, null, ex);
|
ex.printStackTrace();
|
}
|
}
|
|
|
|
}
|