You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@xalan.apache.org by dl...@locus.apache.org on 2000/08/09 16:01:15 UTC

cvs commit: xml-xalan/java/samples/servlet ApplyXSLT.java ApplyXSLTListener.java DefaultApplyXSLTProperties.java

dleslie     00/08/09 07:01:14

  Modified:    java/samples/servlet ApplyXSLT.java ApplyXSLTListener.java
                        DefaultApplyXSLTProperties.java
  Log:
  1. Modified DefaultApplyXSLTProperties to use 1.1 API
    ( i.e.,  not the require 1.2)
  2. Updated ApplyXSLTListener to extend xalan 2 DefaultErrorHandler.
  
  Revision  Changes    Path
  1.2       +2 -2      xml-xalan/java/samples/servlet/ApplyXSLT.java
  
  Index: ApplyXSLT.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/samples/servlet/ApplyXSLT.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ApplyXSLT.java	2000/08/03 15:18:10	1.1
  +++ ApplyXSLT.java	2000/08/09 14:01:13	1.2
  @@ -1,5 +1,5 @@
   /*****************************************************************************************************
  - * $Id: ApplyXSLT.java,v 1.1 2000/08/03 15:18:10 dleslie Exp $
  + * $Id: ApplyXSLT.java,v 1.2 2000/08/09 14:01:13 dleslie Exp $
    *
    * Copyright (c) 1998-1999 Lotus Corporation, Inc. All Rights Reserved.
    *				This software is provided without a warranty of any kind.
  @@ -246,7 +246,7 @@
         time = System.currentTimeMillis();
   
       // Listener to be used for all reporting
  -    ApplyXSLTListener listener = new ApplyXSLTListener();
  +    ApplyXSLTListener listener = new ApplyXSLTListener("ApplyXSLT");
   	listener.out.println("debug is " + debug);
   
       InputSource xmlSource = null;
  
  
  
  1.2       +6 -5      xml-xalan/java/samples/servlet/ApplyXSLTListener.java
  
  Index: ApplyXSLTListener.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/samples/servlet/ApplyXSLTListener.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ApplyXSLTListener.java	2000/08/03 15:18:11	1.1
  +++ ApplyXSLTListener.java	2000/08/09 14:01:13	1.2
  @@ -1,5 +1,5 @@
   /*****************************************************************************************************
  - * $Id: ApplyXSLTListener.java,v 1.1 2000/08/03 15:18:11 dleslie Exp $
  + * $Id: ApplyXSLTListener.java,v 1.2 2000/08/09 14:01:13 dleslie Exp $
    *
    * Copyright (c) 1998-1999 Lotus Corporation, Inc. All Rights Reserved.
    *				This software is provided without a warranty of any kind.
  @@ -10,7 +10,7 @@
   
   import java.io.*;
   import org.xml.sax.*;
  -import org.apache.xalan.xpath.xml.ProblemListenerDefault.*;
  +import org.apache.xalan.utils.DefaultErrorHandler;
   
   /*****************************************************************************************************
    * ApplyXSLTListener provides a buffered listener essential for capturing, and then subsequently
  @@ -23,7 +23,7 @@
    *
    *****************************************************************************************************/
   
  -public class ApplyXSLTListener extends org.apache.xalan.xpath.xml.ProblemListenerDefault implements ErrorHandler
  +public class ApplyXSLTListener extends DefaultErrorHandler implements ErrorHandler
   {
   
       /**
  @@ -39,9 +39,10 @@
       /**
         * Constructor.
         */
  -    public ApplyXSLTListener()
  +    public ApplyXSLTListener(String identifier)
       {
  -	out = new PrintWriter(new BufferedOutputStream(outStream), true);
  +	super(identifier);
  +    out = new PrintWriter(new BufferedOutputStream(outStream), true);
       }
   
       /**
  
  
  
  1.2       +31 -17    xml-xalan/java/samples/servlet/DefaultApplyXSLTProperties.java
  
  Index: DefaultApplyXSLTProperties.java
  ===================================================================
  RCS file: /home/cvs/xml-xalan/java/samples/servlet/DefaultApplyXSLTProperties.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- DefaultApplyXSLTProperties.java	2000/08/03 15:18:11	1.1
  +++ DefaultApplyXSLTProperties.java	2000/08/09 14:01:13	1.2
  @@ -1,5 +1,5 @@
   /*****************************************************************************************************
  - * $Id: DefaultApplyXSLTProperties.java,v 1.1 2000/08/03 15:18:11 dleslie Exp $
  + * $Id: DefaultApplyXSLTProperties.java,v 1.2 2000/08/09 14:01:13 dleslie Exp $
    * 
    * Copyright (c) 1998-1999 Lotus Corporation, Inc. All Rights Reserved.
    *				This software is provided without a warranty of any kind.
  @@ -11,6 +11,8 @@
   import java.net.*;
   import javax.servlet.*;
   import javax.servlet.http.*;
  +import java.util.Enumeration;
  +import java.util.Properties;
   
   /*****************************************************************************************************
    * 
  @@ -210,20 +212,32 @@
      * Sets required system properties until we figure out why servlet 
      * sometimes fails to read properties from properties files.
      */	
  -  protected void setSystemProperties()
  -  {
  -	 System.setProperty("trax.processor.xslt", "org.apache.xalan.processor.StylesheetProcessor");
  -	 System.setProperty("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser");
  -	 System.setProperty("serialize.methods", "xml,html,Text");
  -	 System.setProperty("serialize.xml", "org.apache.xml.serialize.XMLSerializer");	 
  -	 System.setProperty("serialize.html", "org.apache.xml.serialize.HTMLSerializer");	 
  -	 System.setProperty("serialize.text", "org.apache.xml.serialize.TextSerializer");	 
  -	 System.setProperty("serialize.xhtml", "org.apache.xml.serialize.XHTMLSerializer");	 
  -	 System.setProperty("serialize.wml", "org.apache.xml.serialize.WMLSerializer");	
  -	 System.setProperty("serialize.format.xml", "serialize.format.XMLOutputFormat");	 
  -	 System.setProperty("serialize.format.html", "serialize.format.XMLOutputFormat");	 
  -	 System.setProperty("serialize.format.text", "serialize.format.XMLOutputFormat");	 
  -	 System.setProperty("serialize.format.xhtml", "serialize.format.XHTMLOutputFormat");	 
  -	 System.setProperty("serialize.format.text", "serialize.format.TextOutputFormat");	 
  -  }
  +    protected void setSystemProperties()
  +	{
  +	  Properties props = new Properties();
  +	  props.put("trax.processor.xslt", "org.apache.xalan.processor.StylesheetProcessor");
  +	  props.put("org.xml.sax.driver", "org.apache.xerces.parsers.SAXParser");
  +	  props.put("serialize.methods", "xml,html,Text");
  +	  props.put("serialize.xml", "org.apache.xml.serialize.XMLSerializer");	 
  +	  props.put("serialize.html", "org.apache.xml.serialize.HTMLSerializer");	 
  +	  props.put("serialize.text", "org.apache.xml.serialize.TextSerializer");	 
  +	  props.put("serialize.xhtml", "org.apache.xml.serialize.XHTMLSerializer");	 
  +	  props.put("serialize.wml", "org.apache.xml.serialize.WMLSerializer");	
  +	  props.put("serialize.format.xml", "serialize.format.XMLOutputFormat");	 
  +	  props.put("serialize.format.html", "serialize.format.XMLOutputFormat");	 
  +	  props.put("serialize.format.text", "serialize.format.XMLOutputFormat");	 
  +	  props.put("serialize.format.xhtml", "serialize.format.XHTMLOutputFormat");	 
  +	  props.put("serialize.format.text", "serialize.format.TextOutputFormat");	 
  +	  
  +      Properties systemProps = System.getProperties();
  +      Enumeration propEnum = props.propertyNames();
  +      while(propEnum.hasMoreElements())
  +      {
  +        String prop = (String)propEnum.nextElement();
  +        if(!systemProps.containsKey(prop))
  +          systemProps.put(prop, props.getProperty(prop));
  +      }
  +      System.setProperties(systemProps);
  +	}
  +
   }