From 77fd0fdf3f6e86d45e83eddf9a48844a319bd4f6 Mon Sep 17 00:00:00 2001 From: allo Date: Wed, 11 May 2005 09:23:15 +0000 Subject: [PATCH] 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 --- source/de/anomic/http/httpTemplate.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/de/anomic/http/httpTemplate.java b/source/de/anomic/http/httpTemplate.java index ad5a37cd3..94c856784 100644 --- a/source/de/anomic/http/httpTemplate.java +++ b/source/de/anomic/http/httpTemplate.java @@ -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);