You are viewing a plain text version of this content. The canonical link for it is here.
Posted to svn@forrest.apache.org by rg...@apache.org on 2006/11/25 01:34:50 UTC

svn commit: r479061 - in /forrest/trunk/whiteboard/forrest2/core/src: core/org/apache/forrest/cli/ core/org/apache/forrest/core/ core/org/apache/forrest/core/document/ core/org/apache/forrest/core/plugin/ core/org/apache/forrest/core/reader/ test/org/a...

Author: rgardler
Date: Fri Nov 24 16:34:49 2006
New Revision: 479061

URL: http://svn.apache.org/viewvc?view=rev&rev=479061
Log:
Make the requestURI visible throughout the document processing pipeline by keeping it within the document generated at each stage of the pipeline.
We can then use this to save the document content to a file in the CLI.

Modified:
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/cli/CLI.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/Controller.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AbstractDocument.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AbstractOutputDocument.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AbstractSourceDocument.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AggregatedSourceDocument.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DefaultOutputDocument.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DefaultSourceDocument.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DocumentFactory.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/IDocument.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/InternalDocument.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/XMLSourceDocument.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/BaseOutputPlugin.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/PassThroughInputPlugin.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/XSLTInputPlugin.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/XSLTOutputPlugin.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/reader/FileReader.java
    forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/reader/HTTPReader.java
    forrest/trunk/whiteboard/forrest2/core/src/test/org/apache/forrest/test/core/plugins/input/HelloWorldInputPlugin.java

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/cli/CLI.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/cli/CLI.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/cli/CLI.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/cli/CLI.java Fri Nov 24 16:34:49 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.forrest.cli;
 
+import java.io.File;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.net.MalformedURLException;
 import java.net.URI;
@@ -56,7 +58,6 @@
 		}
 
 		try {
-			AbstractOutputDocument doc = null;
 			controller = new Controller();
 			System.out.println("\n Processing request for " + args[0]);
 			unProcessedUris.add(args[0]);
@@ -93,12 +94,27 @@
 				log.debug("Processing: " + strUri);
 				doc = controller.getOutputDocument(uri);
 				unProcessedUris.addAll(doc.getLocalDocumentLinks());
-				System.out.println("\n Resulting document for request " + uri
-						+ " is:\n");
-				System.out.println(doc.getContentAsString());
+				outputDocument(doc, uri);
 				processedUris.add(strUri);
 			}
 		}
+	}
+
+	/**
+	 * Output the document.
+	 * @param doc
+	 * @param uri
+	 * @throws IOException
+	 */
+	private static void outputDocument(AbstractOutputDocument doc, URI uri) throws IOException {
+		System.out.println("\n Resulting document for request " + uri
+				+ " is:\n");
+		System.out.println(doc.getContentAsString());
+		
+		File outFile = new File("c:\\tmp\\" + doc.getPath());
+		FileWriter writer = new FileWriter(outFile);
+		writer.write(doc.getContentAsString());
+		writer.close();
 	}
 
 	/**

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/Controller.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/Controller.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/Controller.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/Controller.java Fri Nov 24 16:34:49 2006
@@ -29,10 +29,8 @@
 
 import org.apache.forrest.core.document.AbstractOutputDocument;
 import org.apache.forrest.core.document.AbstractSourceDocument;
-import org.apache.forrest.core.document.AggregateInteralDocument;
 import org.apache.forrest.core.document.AggregatedSourceDocument;
 import org.apache.forrest.core.document.DefaultOutputDocument;
-import org.apache.forrest.core.document.IDocument;
 import org.apache.forrest.core.document.InternalDocument;
 import org.apache.forrest.core.exception.LocationmapException;
 import org.apache.forrest.core.exception.ProcessingException;
@@ -465,7 +463,7 @@
 				content.append("</error>");
 			}
 
-			final DefaultOutputDocument output = new DefaultOutputDocument(
+			final DefaultOutputDocument output = new DefaultOutputDocument(requestURI,
 					content.toString());
 			return output;
 		} else if (requestURI.getPath().endsWith(this.internalURLExtension)) {
@@ -478,7 +476,7 @@
 				content.append(requestURI);
 				content.append("</error>");
 			}
-			final DefaultOutputDocument output = new DefaultOutputDocument(
+			final DefaultOutputDocument output = new DefaultOutputDocument(requestURI,
 					content.toString());
 			return output;
 		}

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AbstractDocument.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AbstractDocument.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AbstractDocument.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AbstractDocument.java Fri Nov 24 16:34:49 2006
@@ -17,18 +17,22 @@
 package org.apache.forrest.core.document;
 
 import java.io.IOException;
+import java.net.URI;
 import java.util.Date;
 
 public abstract class AbstractDocument implements IDocument {
 	private Date lastModified;
 
 	String content;
+	
+	private URI requestURI;
 
 	public AbstractDocument() {
 	}
 
-	public AbstractDocument(final String string) {
-		this.content = string;
+	public AbstractDocument(final URI requestURI, final String content) {
+		setContent(content);
+		setRequestURI(requestURI);
 	}
 
 	public String getContentAsString() throws IOException {
@@ -59,4 +63,24 @@
 	public Date getLastModified() {
 		return this.lastModified;
 	}
+	
+	/**
+	 * Set the URI that was used to request this document.
+	 * 
+	 * @return
+	 */
+	public void setRequestURI(URI requestURI) {
+		this.requestURI = requestURI;
+	}
+
+	/**
+	 * Get the URI that was used to request this document.
+	 * 
+	 * @return
+	 */
+	public URI getRequestURI() {
+		return this.requestURI;
+	}
+
+
 }

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AbstractOutputDocument.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AbstractOutputDocument.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AbstractOutputDocument.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AbstractOutputDocument.java Fri Nov 24 16:34:49 2006
@@ -16,7 +16,6 @@
  */
 package org.apache.forrest.core.document;
 
-import java.net.URI;
 import java.util.Set;
 
 /**
@@ -25,24 +24,24 @@
  */
 public abstract class AbstractOutputDocument extends AbstractDocument {
 
-	private URI requestURI;
 
 	/**
-	 * Get the URI that was used to request this document.
+	 * Get a set of links to local documents in within this
+	 * document. This is used to identify links that should
+	 * be crawled when generating content.
 	 * 
 	 * @return
 	 */
-	public URI getRequestURI() {
-		return this.requestURI;
-	}
+	public abstract Set<String> getLocalDocumentLinks();
 
 	/**
-	 * Get a set of links to local documents in within this
-	 * document. This is used to identify links that should
-	 * be crawled when generating content.
+	 * Get the the relative path to this document from the
+	 * point of view of the client.
 	 * 
 	 * @return
 	 */
-	public abstract Set<String> getLocalDocumentLinks();
+	public String getPath() {
+		return getRequestURI().getPath();
+	}
 
 }

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AbstractSourceDocument.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AbstractSourceDocument.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AbstractSourceDocument.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AbstractSourceDocument.java Fri Nov 24 16:34:49 2006
@@ -18,6 +18,7 @@
 
 import java.io.BufferedReader;
 import java.io.IOException;
+import java.net.URI;
 
 /**
  * A source document is a single input document as retrieved from its source
@@ -26,6 +27,11 @@
  */
 public abstract class AbstractSourceDocument extends AbstractDocument {
 	String type;
+
+	public AbstractSourceDocument(URI requestURI, String content) {
+		setRequestURI(requestURI);
+		setContent(content);
+	}
 
 	@Override
 	public String getContentAsString() throws IOException {

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AggregatedSourceDocument.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AggregatedSourceDocument.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AggregatedSourceDocument.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/AggregatedSourceDocument.java Fri Nov 24 16:34:49 2006
@@ -18,7 +18,6 @@
 
 import java.net.URI;
 import java.util.ArrayList;
-import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -28,6 +27,10 @@
  * 
  */
 public class AggregatedSourceDocument extends AbstractSourceDocument {
+
+	public AggregatedSourceDocument(URI requestURI, String content) {
+		super(requestURI, content);
+	}
 
 	List<AbstractSourceDocument> docs = new ArrayList<AbstractSourceDocument>();
 

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DefaultOutputDocument.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DefaultOutputDocument.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DefaultOutputDocument.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DefaultOutputDocument.java Fri Nov 24 16:34:49 2006
@@ -16,6 +16,7 @@
  */
 package org.apache.forrest.core.document;
 
+import java.net.URI;
 import java.util.HashSet;
 import java.util.Set;
 import java.util.regex.Matcher;
@@ -32,7 +33,8 @@
 	
 	Logger log = Logger.getLogger(DefaultOutputDocument.class);
 
-	public DefaultOutputDocument(final String content) {
+	public DefaultOutputDocument(final URI requestURI, final String content) {
+		this.setRequestURI(requestURI);
 		this.setContent(content);
 	}
 

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DefaultSourceDocument.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DefaultSourceDocument.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DefaultSourceDocument.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DefaultSourceDocument.java Fri Nov 24 16:34:49 2006
@@ -17,6 +17,7 @@
 package org.apache.forrest.core.document;
 
 import java.io.BufferedReader;
+import java.net.URI;
 
 /**
  * A basic source document. It holds the document as a string.
@@ -24,8 +25,8 @@
  */
 public class DefaultSourceDocument extends AbstractSourceDocument {
 
-	public DefaultSourceDocument(final String content) {
-		this.setContent(content);
+	public DefaultSourceDocument(final URI requestURI, final String content) {
+		super(requestURI, content);
 		this.setComplete(true);
 	}
 
@@ -38,16 +39,16 @@
 	 * @param type
 	 *            The mime type of the document. May be null if unkown.
 	 */
-	public DefaultSourceDocument(final String fileData,
+	public DefaultSourceDocument(final URI requestURI, final String fileData,
 			final BufferedReader reader, final String type) {
-		this.setContent(fileData);
+		this(requestURI, fileData);
 		this.setReader(reader);
 		this.setComplete(false);
 		this.setType(type);
 	}
 
-	public DefaultSourceDocument(final String content, final String type) {
-		this.setContent(content);
+	public DefaultSourceDocument(final URI requestURI, final String content, final String type) {
+		this(requestURI, content);
 		this.setComplete(true);
 		this.setType(type);
 	}

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DocumentFactory.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DocumentFactory.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DocumentFactory.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/DocumentFactory.java Fri Nov 24 16:34:49 2006
@@ -20,6 +20,7 @@
 import java.io.IOException;
 import java.io.InputStream;
 import java.io.InputStreamReader;
+import java.net.URI;
 
 import org.apache.forrest.core.exception.ProcessingException;
 
@@ -43,9 +44,9 @@
 	 *             InputStream
 	 * @throws ProcessingException 
 	 */
-	public static AbstractSourceDocument getSourceDocumentFor(
+	public static AbstractSourceDocument getSourceDocumentFor(final URI requestURI, 
 			final InputStream is) throws IOException, ProcessingException {
-		return readFile(is);
+		return readFile(requestURI, is);
 	}
 
 	/**
@@ -57,7 +58,7 @@
 	 * @param is
 	 * @throws ProcessingException 
 	 */
-	private static AbstractSourceDocument readFile(final InputStream is)
+	private static AbstractSourceDocument readFile(final URI requestURI, final InputStream is)
 			throws java.io.IOException, ProcessingException {
 		AbstractSourceDocument doc = null;
 		final StringBuffer fileData = new StringBuffer(1024);
@@ -73,17 +74,17 @@
 			if (fileData.toString().contains("<?xml")) {
 				type = getXMLDocumentType(fileData.toString());
 				if (type != null) {
-					doc = new XMLSourceDocument(fileData.toString(), reader,
+					doc = new XMLSourceDocument(requestURI, fileData.toString(), reader,
 							type);
 				}
 			}
 		}
 		if (type == null) {
 			if (fileData.toString().contains("<?xml")) {
-				doc = new XMLSourceDocument(fileData.toString(), reader,
+				doc = new XMLSourceDocument(requestURI, fileData.toString(), reader,
 						"application/xml");
 			} else if (fileData.toString().toLowerCase().contains("<html>")) {
-				doc = new DefaultSourceDocument(fileData.toString(), reader,
+				doc = new DefaultSourceDocument(requestURI, fileData.toString(), reader,
 						"html");
 			} else {
 				throw new ProcessingException("Unable to determine the source document type");

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/IDocument.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/IDocument.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/IDocument.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/IDocument.java Fri Nov 24 16:34:49 2006
@@ -17,6 +17,7 @@
 package org.apache.forrest.core.document;
 
 import java.io.IOException;
+import java.net.URI;
 
 /**
  * A document contains all the necessary information for processing a resource.
@@ -31,4 +32,18 @@
 	 * @throws IOException
 	 */
 	public String getContentAsString() throws IOException;
+	
+	/**
+	 * Set the URI that was used to request this document.
+	 * 
+	 * @return
+	 */
+	public void setRequestURI(URI requestURI);
+
+	/**
+	 * Get the URI that was used to request this document.
+	 * 
+	 * @return
+	 */
+	public URI getRequestURI();
 }

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/InternalDocument.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/InternalDocument.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/InternalDocument.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/InternalDocument.java Fri Nov 24 16:34:49 2006
@@ -16,6 +16,8 @@
  */
 package org.apache.forrest.core.document;
 
+import java.net.URI;
+
 /**
  * An InternalDocument is a document that has been converted from a Source
  * IDocument into the internal Forrest XML format for processing.
@@ -26,7 +28,8 @@
 	public InternalDocument() {
 	}
 
-	public InternalDocument(final String content) {
+	public InternalDocument(final URI requestURI, final String content) {
+		this.setRequestURI(requestURI);
 		this.setContent(content);
 	}
 

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/XMLSourceDocument.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/XMLSourceDocument.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/XMLSourceDocument.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/document/XMLSourceDocument.java Fri Nov 24 16:34:49 2006
@@ -17,6 +17,7 @@
 package org.apache.forrest.core.document;
 
 import java.io.BufferedReader;
+import java.net.URI;
 
 /**
  * A representation of an XML document.
@@ -26,13 +27,13 @@
  */
 public class XMLSourceDocument extends DefaultSourceDocument {
 
-	public XMLSourceDocument(final String fileData,
+	public XMLSourceDocument(final URI requestURI, final String fileData,
 			final BufferedReader reader, final String type) {
-		super(fileData, reader, type);
+		super(requestURI, fileData, reader, type);
 	}
 
-	public XMLSourceDocument(final String content, final String type) {
-		super(content, type);
+	public XMLSourceDocument(final URI requestURI, final String content, final String type) {
+		super(requestURI, content, type);
 	}
 
 }

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/BaseOutputPlugin.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/BaseOutputPlugin.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/BaseOutputPlugin.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/BaseOutputPlugin.java Fri Nov 24 16:34:49 2006
@@ -68,7 +68,7 @@
 	}
 
 	public IDocument process(final IDocument doc) throws IOException {
-		return new DefaultOutputDocument(doc.getContentAsString());
+		return new DefaultOutputDocument(doc.getRequestURI(), doc.getContentAsString());
 	}
 
 }

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/PassThroughInputPlugin.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/PassThroughInputPlugin.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/PassThroughInputPlugin.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/PassThroughInputPlugin.java Fri Nov 24 16:34:49 2006
@@ -30,7 +30,7 @@
 public class PassThroughInputPlugin extends AbstractInputPlugin {
 
 	public IDocument process(final IDocument doc) throws IOException {
-		return new InternalDocument(doc.getContentAsString());
+		return new InternalDocument(doc.getRequestURI(), doc.getContentAsString());
 	}
 
 }

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/XSLTInputPlugin.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/XSLTInputPlugin.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/XSLTInputPlugin.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/XSLTInputPlugin.java Fri Nov 24 16:34:49 2006
@@ -82,7 +82,7 @@
 			final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
 			final StreamResult out = new StreamResult(outStream);
 			transformer.transform(in, out);
-			return new InternalDocument(outStream.toString());
+			return new InternalDocument(doc.getRequestURI(), outStream.toString());
 		} catch (final TransformerConfigurationException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/XSLTOutputPlugin.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/XSLTOutputPlugin.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/XSLTOutputPlugin.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/plugin/XSLTOutputPlugin.java Fri Nov 24 16:34:49 2006
@@ -22,7 +22,6 @@
 import java.io.StringReader;
 import java.net.URI;
 import java.net.URISyntaxException;
-import java.net.URL;
 
 import javax.xml.transform.Transformer;
 import javax.xml.transform.TransformerConfigurationException;
@@ -70,7 +69,7 @@
 			final ByteArrayOutputStream outStream = new ByteArrayOutputStream();
 			final StreamResult out = new StreamResult(outStream);
 			transformer.transform(in, out);
-			return new DefaultOutputDocument(outStream.toString());
+			return new DefaultOutputDocument(doc.getRequestURI(), outStream.toString());
 		} catch (final TransformerConfigurationException e) {
 			// TODO Auto-generated catch block
 			e.printStackTrace();

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/reader/FileReader.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/reader/FileReader.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/reader/FileReader.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/reader/FileReader.java Fri Nov 24 16:34:49 2006
@@ -46,7 +46,7 @@
 		try {
 			URL resolvedURL = location.resolveURL(requestURI, sourceURI);
 			final InputStream is = new FileInputStream(new File(resolvedURL.toURI()));
-			result = DocumentFactory.getSourceDocumentFor(is);
+			result = DocumentFactory.getSourceDocumentFor(requestURI, is);
 		} catch (final Exception e) {
 			if (location.isRequired())
 				throw new SourceException("Source URL is invalid", e);

Modified: forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/reader/HTTPReader.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/reader/HTTPReader.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/reader/HTTPReader.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/core/org/apache/forrest/core/reader/HTTPReader.java Fri Nov 24 16:34:49 2006
@@ -71,7 +71,7 @@
 			final Tidy tidy = new Tidy();
 			tidy.setXHTML(true);
 			tidy.parseDOM(is, out);
-			result = new DefaultSourceDocument(out.toString());
+			result = new DefaultSourceDocument(requestURI, out.toString());
 		} catch (final Exception e) {
 			result = null;
 			if (location.isRequired())

Modified: forrest/trunk/whiteboard/forrest2/core/src/test/org/apache/forrest/test/core/plugins/input/HelloWorldInputPlugin.java
URL: http://svn.apache.org/viewvc/forrest/trunk/whiteboard/forrest2/core/src/test/org/apache/forrest/test/core/plugins/input/HelloWorldInputPlugin.java?view=diff&rev=479061&r1=479060&r2=479061
==============================================================================
--- forrest/trunk/whiteboard/forrest2/core/src/test/org/apache/forrest/test/core/plugins/input/HelloWorldInputPlugin.java (original)
+++ forrest/trunk/whiteboard/forrest2/core/src/test/org/apache/forrest/test/core/plugins/input/HelloWorldInputPlugin.java Fri Nov 24 16:34:49 2006
@@ -30,6 +30,6 @@
 	public static final String CONTENT = "<html xmlns=\"http://www.w3.org/2002/06/xhtml2\" xml:lang=\"en\" xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" xsi:schemaLocation=\"http://www.w3.org/2002/06/xhtml2/ http://www.w3.org/MarkUp/SCHEMA/xhtml2.xsd\">  <head>    <title>XHTML 2 Simple Sample Page</title>   </head>  <body>  <h>Hello World</h>  </body></html>";
 
 	public IDocument process(final IDocument doc) {
-		return new InternalDocument(CONTENT);
+		return new InternalDocument(doc.getRequestURI(), CONTENT);
 	}
 }