wt.htmlutil
Class TemplateOutputStream

java.lang.Object
  extended byjava.io.OutputStream
      extended byjava.io.FilterOutputStream
          extended bywt.htmlutil.TemplateOutputStream

public class TemplateOutputStream
extends FilterOutputStream

An output stream filter used when processing templates.

This filter grounds out flush calls so that frequent flushes to character writer objects do not cause a flush of the underlying output stream which might cause frequent calls to the operating system.

Since templates processing will often call methods that want to write text to the template output stream, utility methods are provided here to efficiently reuse an existing print writer and to chose a character encoding compatible with a template's locale. Unlike a standard print writer which ignores IOException, this one will raise a runtime exception in order to abort template processing if there are exceptions writing to the underlying output stream.

All templates for a given locale are expected to share the same character encoding. Since they may differ for each locale and from the platform's default file encoding, property settings of the form wt.template.encoding.xxx where xxx is a locale can be used to override the default character encoding.


Nested Class Summary
(package private)  class TemplateOutputStream.KeepAlive
          Deprecated.  
(package private) static class TemplateOutputStream.Writer
          Deprecated.  
 
Field Summary
private  String encoding
          Deprecated.  
private  Locale locale
          Deprecated.  
private  PrintWriter printWriter
          Deprecated.  
 
Fields inherited from class java.io.FilterOutputStream
out
 
Constructor Summary
TemplateOutputStream(OutputStream out, Locale locale)
          Deprecated.  
 
Method Summary
 void cancelKeepAlive()
          Deprecated.  
 void close()
          Deprecated.  
 void flush()
          Deprecated.  
 void flushAll()
          Deprecated.  
static void flushAll(OutputStream output_stream)
          Deprecated.  
static void flushAll(Properties parameters, Locale locale, OutputStream os)
          Deprecated. Script callable method to flush all pending output to the response stream.
 String getEncoding()
          Deprecated.  
static String getEncoding(Locale locale)
          Deprecated.  
static String getEncoding(OutputStream output_stream, Locale locale)
          Deprecated.  
 PrintWriter getPrintWriter()
          Deprecated.  
static PrintWriter getPrintWriter(OutputStream output_stream, Locale locale)
          Deprecated.  
private  OutputStream getProtectedOut()
          Deprecated.  
 void setEncoding(String encoding)
          Deprecated.  
static void setKeepAlive(OutputStream output_stream, String message, int interval)
          Deprecated.  
static void setKeepAlive(Properties parameters, Locale locale, OutputStream os)
          Deprecated. Set a message to be periodically flushed to the template output stream until normal output is written.
 void setKeepAlive(String message, int interval)
          Deprecated.  
private  void setProtectedOut(OutputStream out)
          Deprecated.  
static void sleep(Properties parameters, Locale locale, OutputStream os)
          Deprecated.  
 void write(byte[] b, int off, int len)
          Deprecated.  
 
Methods inherited from class java.io.FilterOutputStream
write, write
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

printWriter

private PrintWriter printWriter
Deprecated. 

locale

private Locale locale
Deprecated. 

encoding

private String encoding
Deprecated. 
Constructor Detail

TemplateOutputStream

public TemplateOutputStream(OutputStream out,
                            Locale locale)
Deprecated. 
Method Detail

write

public void write(byte[] b,
                  int off,
                  int len)
           throws IOException
Deprecated. 
Throws:
IOException

flush

public void flush()
Deprecated. 

flushAll

public void flushAll()
              throws IOException
Deprecated. 
Throws:
IOException

close

public void close()
           throws IOException
Deprecated. 
Throws:
IOException

getEncoding

public String getEncoding()
Deprecated. 

setEncoding

public void setEncoding(String encoding)
Deprecated. 

getPrintWriter

public PrintWriter getPrintWriter()
Deprecated. 

getProtectedOut

private OutputStream getProtectedOut()
Deprecated. 

setProtectedOut

private void setProtectedOut(OutputStream out)
Deprecated. 

flushAll

public static void flushAll(OutputStream output_stream)
                     throws IOException
Deprecated. 
Throws:
IOException

flushAll

public static void flushAll(Properties parameters,
                            Locale locale,
                            OutputStream os)
                     throws IOException
Deprecated. 
Script callable method to flush all pending output to the response stream. For example:
 
 


Supported API: false

Parameters:
parameters - The arguments that were passed to the Windchill script call.
locale - The Locale to send to the invoked methods for localization.
os - The output stream.
Throws:
IOException

getEncoding

public static String getEncoding(Locale locale)
Deprecated. 

getPrintWriter

public static PrintWriter getPrintWriter(OutputStream output_stream,
                                         Locale locale)
Deprecated. 

getEncoding

public static String getEncoding(OutputStream output_stream,
                                 Locale locale)
Deprecated. 

setKeepAlive

public static void setKeepAlive(Properties parameters,
                                Locale locale,
                                OutputStream os)
Deprecated. 
Set a message to be periodically flushed to the template output stream until normal output is written. This method is callable from script elements in a template. If a comment parameter is specified, it will be written as a HTML comment. If a message parameter is specified, it will be written verbatim. The default messages is a HTML comment saying "working...". The script element must not be followed by any whitespace (include newlines) as these will produce immediate output, thus cancelling the keep alive message. For example:
 






  SUMMARY: NESTED | FIELD | CONSTR | METHOD

DETAIL: FIELD | CONSTR | METHOD