You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@forrest.apache.org by Tim Williams <wi...@gmail.com> on 2006/11/25 13:00:33 UTC

Re: 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

On 11/24/06, rgardler@apache.org <rg...@apache.org> wrote:
> 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());

I know this is experimental code, but....
--tim

Re: 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

Posted by Ross Gardler <rg...@apache.org>.
Tim Williams wrote:
> On 11/25/06, Ross Gardler <rg...@apache.org> wrote:
>> Tim Williams wrote:
>> > On 11/24/06, rgardler@apache.org <rg...@apache.org> wrote:
>>
>> ...
>>
>> >> +               File outFile = new File("c:\\tmp\\" + doc.getPath());
>> >
>> > I know this is experimental code, but....
>>
>> Quite right, it should be written to the "build/site" directory of the
>> content object directory. An oversight on my part. Could you fix it for
>> me, even if it is to place in the "build/site" directory of forrest core
>> (where the command line is run from at present). I'm traveling and don't
>> have my laptop with me so can't do it until Wednesday at the earliest.
> 
> Sorry Ross, I'm heading on a road trip today and will be out of town
> for the next week.  I'll have access while I'm out but very little
> time.  We'll see who gets to it first.

No problem, at least anyone who tries to run it will know the problem 
now. Thanks for highlighting the issue.

Ross

Re: 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

Posted by Tim Williams <wi...@gmail.com>.
On 11/25/06, Ross Gardler <rg...@apache.org> wrote:
> Tim Williams wrote:
> > On 11/24/06, rgardler@apache.org <rg...@apache.org> wrote:
>
> ...
>
> >> +               File outFile = new File("c:\\tmp\\" + doc.getPath());
> >
> > I know this is experimental code, but....
>
> Quite right, it should be written to the "build/site" directory of the
> content object directory. An oversight on my part. Could you fix it for
> me, even if it is to place in the "build/site" directory of forrest core
> (where the command line is run from at present). I'm traveling and don't
> have my laptop with me so can't do it until Wednesday at the earliest.

Sorry Ross, I'm heading on a road trip today and will be out of town
for the next week.  I'll have access while I'm out but very little
time.  We'll see who gets to it first.

--tim

Re: 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

Posted by Ross Gardler <rg...@apache.org>.
Tim Williams wrote:
> On 11/24/06, rgardler@apache.org <rg...@apache.org> wrote:

...

>> +               File outFile = new File("c:\\tmp\\" + doc.getPath());
> 
> I know this is experimental code, but....

Quite right, it should be written to the "build/site" directory of the 
content object directory. An oversight on my part. Could you fix it for 
me, even if it is to place in the "build/site" directory of forrest core 
(where the command line is run from at present). I'm traveling and don't 
have my laptop with me so can't do it until Wednesday at the earliest.

Well spotted - too much rushing on y part again.

Ross