Includes, which use a normale Template Key to find the sourcefile

Syntax: #%[key]%#


git-svn-id: https://svn.berlios.de/svnroot/repos/yacy/trunk@103 6c8d7289-2bf4-0310-a012-ef5d649a1542
pull/1/head
allo 20 years ago
parent abb6750090
commit 77fd0fdf3f

@ -282,16 +282,20 @@ final class httpTemplate {
String line = "";
keyStream = new ByteArrayOutputStream(); //reset stream
if(transferUntil(pis, keyStream, iClose)){
String filename = keyStream.toString();
if(filename.startsWith( Character.toString((char)lbr) ) && filename.endsWith( Character.toString((char)rbr) )){ //simple pattern for filename
filename= new String(replacePattern( filename.substring(1, filename.length()-1), pattern, dflt));
}
try{
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream( new File("htroot", keyStream.toString()) )));
BufferedReader br = new BufferedReader(new InputStreamReader(new FileInputStream( new File("htroot", filename) )));
//Read the Include
while( (line = br.readLine()) != null ){
include+=line+de.anomic.server.serverCore.crlfString;
}
}catch(IOException e){
//file not found?
System.err.println("Include Error with file: "+keyStream.toString());
e.printStackTrace();
System.err.println("Include Error with file: "+filename);
//e.printStackTrace();
}
PushbackInputStream pis2 = new PushbackInputStream(new ByteArrayInputStream(include.getBytes()));
writeTemplate(pis2, out, pattern, dflt, prefix);

Loading…
Cancel
Save