Nathan,

Here is something for you from ND docs.

Once you get a CSpStringOutputStream containing the generated Html text,
writing it out into a file on the Server should not be difficult.

Regards,

Aby

========================================================================
====
 public abstract int onBeforeHtmlOutputEvent(CSpHtmlOutputEvent event)
throws CSpSkipException
, CSpStopException 
 

Ideas for tasks you can accomplish by overriding this event: 

� Make changes to the generated HTML after the fact. This requires
redirection of the output stream to an internal buffer before the
display() begins. Then, once this event is triggered, you can obtain the
generated HTML, make modifications to it (e.g. by replacing some place
holder token with the "latest news" String) and write out the final
results. Here is the framework for this technique: 

  protected int 
      onBeforeDisplayEvent ( 
         ) 
   { 
      // Save the original output stream 
      _origStream = CSpider.getOutputStream (); 

      // Construct a byte array output stream and create a 
      // CSpStringOutputStream out of it 
      _myArrayStream = new ByteArrayOutputStream (10000); 
      _myStream = new CSpStringOutputStream (_myArrayStream); 

      // Set our temporary string output stream to be used 
      // when constructing the HTML ("stealing" the HTML page) 
      CSpider.setOutputStream (_myStream); 

      return (PROCEED_WITH_BUILTIN_HANDLING); 
   } 

   protected int 
      onBeforeHtmlOutputEvent ( 
         ) 
   { 
      try 
      { 
         // Flush everything so that our byte array will get loaded 
         // with the HTML 
         CSpHtml.flush (_myStream); 

         // Convert the byteArray into a String 
         String   htmlPage = _myArrayStream.toString (); 

         // Restore the original output stream 
         CSpider.setOutputStream (_origStream); 

         // Make some late changes to the HTML 
         String modifiedHtmlPage = 
                 CSpUtil.replaceSubstring (htmlPage, 
                                           ............); 
         // Write the modified HTML out 
         CSpHtml.sendRawDataItem (_origStream, modifiedHtmlPage); 
      } 
      catch (Exception  ex) 
      { 
         // Shouldn't occur 
      } 

      return (PROCEED_WITH_BUILTIN_HANDLING); 
   } 

   protected CSpStringOutputStream _origStream    = null; 
   protected ByteArrayOutputStream _myArrayStream = null; 
   protected CSpStringOutputStream _myStream      = null; 

========================================================================
== 
   

-----Original Message-----
From: Nathan Etter [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, August 11, 1999 11:46 PM
To: [EMAIL PROTECTED]
Subject: [ND] How to make ND generate an HTML file via a call from an
external process?



We have a situation where we want to use ND to provide online query
capabilities.  However, at the same time, we would like to generate
a flat HTML file with ALL of the possible data from the various queries.
Obviously generating this data at runtime would be very slow.

Is it possible to make an API call into the ND server (using either ND
classes,
command line interfaces, or standard Java) to force ND to write the
output
to a file?  (We would preferably schedule this job to run every
evening.)

Any advice would be greatly appreciated.  I searched through this 
newsgroup but couldn't really find much in the history.

Regards,
Nathan Etter
_________________________________________________________________________

For help in using, subscribing, and unsubscribing to the discussion
forums, please go to: http://www.netdynamics.com/support/visitdevfor.html

For dire need help, email: [EMAIL PROTECTED]

Reply via email to