cocoon-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From stef...@locus.apache.org
Subject cvs commit: xml-cocoon/src/org/apache/cocoon/processor/xsp XSPProcessor.java
Date Wed, 09 Feb 2000 21:29:36 GMT
stefano     00/02/09 13:29:36

  Modified:    src/org/apache/cocoon/processor/xsp XSPProcessor.java
  Log:
  made it work without special URLs
  
  Revision  Changes    Path
  1.9       +12 -6     xml-cocoon/src/org/apache/cocoon/processor/xsp/XSPProcessor.java
  
  Index: XSPProcessor.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/processor/xsp/XSPProcessor.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- XSPProcessor.java	2000/01/31 21:53:18	1.8
  +++ XSPProcessor.java	2000/02/09 21:29:35	1.9
  @@ -1,4 +1,4 @@
  -/*-- $Id: XSPProcessor.java,v 1.8 2000/01/31 21:53:18 stefano Exp $ --
  +/*-- $Id: XSPProcessor.java,v 1.9 2000/02/09 21:29:35 stefano Exp $ --
   
    ============================================================================
                      The Apache Software License, Version 1.1
  @@ -72,7 +72,7 @@
    * This class implements the XSP engine.
    *
    * @author <a href="mailto:ricardo@apache.org">Ricardo Rocha</a>
  - * @version $Revision: 1.8 $ $Date: 2000/01/31 21:53:18 $
  + * @version $Revision: 1.9 $ $Date: 2000/02/09 21:29:35 $
    */
   public class XSPProcessor extends AbstractActor
     implements Processor, Configurable, Status
  @@ -259,11 +259,17 @@
         template.setLanguageName(language);
   
         try {
  -        URL url = new URL(location);
  +        InputStream stream;
   
  -        Document stylesheet = this.parser.parse(
  -          new InputSource((new URL(location)).openStream()), false
  -        );
  +        if (location.startsWith("resource://")) {
  +            URL x = ClassLoader.getSystemResource(location.substring("resource://".length()));
  +            if (x == null) throw new IOException("Resource not found: " + location);
  +            else stream = x.openStream();
  +        } else {
  +            stream = new FileInputStream(location);
  +        }
  +
  +        Document stylesheet = this.parser.parse(new InputSource(stream), false);
   
           template.setStylesheet(stylesheet);
   
  
  
  

Mime
View raw message