dims        01/05/29 10:05:07

  Modified:    src/org/apache/cocoon/environment AbstractEnvironment.java
               src/org/apache/cocoon/servlet CocoonServlet.java
               src/org/apache/cocoon/transformation TraxTransformer.java
  Log:
  Still trying to get Weblogic 6.0 SP1 - WAR deployment working.
  (Almost there...but need some more fixes in Xalan)
  
  Revision  Changes    Path
  1.5       +26 -24    
xml-cocoon2/src/org/apache/cocoon/environment/AbstractEnvironment.java
  
  Index: AbstractEnvironment.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/environment/AbstractEnvironment.java,v
  retrieving revision 1.4
  retrieving revision 1.5
  diff -u -r1.4 -r1.5
  --- AbstractEnvironment.java  2001/05/25 16:01:47     1.4
  +++ AbstractEnvironment.java  2001/05/29 17:04:54     1.5
  @@ -112,33 +112,35 @@
           LogKit.getLoggerFor("cocoon").debug("Changing Cocoon context(" + context + 
") to prefix(" + prefix + ")");
           LogKit.getLoggerFor("cocoon").debug("\tfrom context(" + 
this.context.toExternalForm() + ") and prefix(" + this.prefix + ")");
           LogKit.getLoggerFor("cocoon").debug("\tat URI " + uri);
  -        if (uri.startsWith(prefix)) {
  -            this.prefix.append(prefix);
  -            uri = uri.substring(prefix.length());
  +        if(prefix.length()>=1){
  +            if (uri.startsWith(prefix)) {
  +                this.prefix.append(prefix);
  +                uri = uri.substring(prefix.length());
   
  -            // if we got a absolute context or one with a protocol resolve it
  -            if (context.charAt(0) == '/') {
  -                this.context = new URL("file:" + context);
  -            }else if (context.indexOf(':') > 1) {
  -                this.context = new URL(context);
  -            }else {
  -                this.context = new URL(this.context, context);
  -            }
  -            File f = new File(this.context.getFile());
  -            if (f.isFile()) {
  -                this.context = f.getParentFile().toURL();
  +                // if we got a absolute context or one with a protocol resolve it
  +                if (context.charAt(0) == '/') {
  +                    this.context = new URL("file:" + context);
  +                }else if (context.indexOf(':') > 1) {
  +                    this.context = new URL(context);
  +                }else {
  +                    this.context = new URL(this.context, context);
  +                }
  +                File f = new File(this.context.getFile());
  +                if (f.isFile()) {
  +                    this.context = f.getParentFile().toURL();
  +                } else {
  +                    this.context = f.toURL();
  +                }
               } else {
  -                this.context = f.toURL();
  +                getLogger().error("The current URI ("
  +                    + uri + ") doesn't start with given prefix ("
  +                    + prefix + ")"
  +                );
  +                throw new RuntimeException("The current URI ("
  +                    + uri + ") doesn't start with given prefix ("
  +                    + prefix + ")"
  +                );
               }
  -        } else {
  -            getLogger().error("The current URI ("
  -                + uri + ") doesn't start with given prefix ("
  -                + prefix + ")"
  -            );
  -            throw new RuntimeException("The current URI ("
  -                + uri + ") doesn't start with given prefix ("
  -                + prefix + ")"
  -            );
           }
           LogKit.getLoggerFor("cocoon").debug("New context is " + 
this.context.toExternalForm());
           this.uris.set(this.uris.size()-1, uri);
  
  
  
  1.9       +21 -15    xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java
  
  Index: CocoonServlet.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/servlet/CocoonServlet.java,v
  retrieving revision 1.8
  retrieving revision 1.9
  diff -u -r1.8 -r1.9
  --- CocoonServlet.java        2001/05/25 22:00:50     1.8
  +++ CocoonServlet.java        2001/05/29 17:05:00     1.9
  @@ -14,6 +14,7 @@
   import java.net.URL;
   import java.util.Arrays;
   import java.util.Date;
  +import java.util.Enumeration;
   import java.util.StringTokenizer;
   import javax.servlet.ServletConfig;
   import javax.servlet.ServletContext;
  @@ -57,7 +58,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Stefano Mazzocchi</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Nicola Ken Barozzi</a> Aisa
    * @author <a href="mailto:[EMAIL PROTECTED]";>Berin Loritsch</a>
  - * @version CVS $Revision: 1.8 $ $Date: 2001/05/25 22:00:50 $
  + * @version CVS $Revision: 1.9 $ $Date: 2001/05/29 17:05:00 $
    */
   
   public class CocoonServlet extends HttpServlet {
  @@ -78,6 +79,7 @@
       private static final boolean ALLOW_OVERWRITE = false;
       private static final boolean SILENTLY_RENAME = true;
       private File uploadDir;
  +    private File workDir;
   
       protected ServletContext servletContext;
       protected RepositoryClassLoader classLoader;
  @@ -114,11 +116,8 @@
           this.appContext.put(Constants.CONTEXT_ENVIRONMENT_CONTEXT, new 
HttpContext(this.servletContext));
           this.initLogger(this.servletContext);
   
  -        this.appContext.put(Constants.CONTEXT_CLASSPATH, 
this.getClassPath(this.servletContext));
  -
           this.forceLoad(conf.getInitParameter("load-class"));
   
  -        File workDir = null;
           String workDirParam = conf.getInitParameter("work-directory");
           if ((workDirParam != null) && (workDirParam.trim().equals("") == false)) {
               workDir = IOUtils.createFile( new 
File(this.servletContext.getRealPath("/")) , workDirParam);
  @@ -128,6 +127,7 @@
           }
   
           this.appContext.put(Constants.CONTEXT_WORK_DIR, workDir);
  +        this.appContext.put(Constants.CONTEXT_CLASSPATH, 
this.getClassPath(this.servletContext));
   
           String uploadDirParam = conf.getInitParameter("upload-directory");
           if ((uploadDirParam != null) && (uploadDirParam.trim().equals("") == 
false)) {
  @@ -176,17 +176,23 @@
        throws ServletException {
           StringBuffer buildClassPath = new StringBuffer();
   
  -        if(context.getRealPath("/")==null)
  -            return "";
  -
           String classDir = context.getRealPath("/WEB-INF/classes");
  -        File root = new File(context.getRealPath("/WEB-INF/lib"));
  +        String libDir = context.getRealPath("/WEB-INF/lib");
  +        
  +        File root = null;
  +        if(libDir != null)
  +            root = new File(libDir);
  +        else
  +            root = workDir;
  +        
   
  -        buildClassPath.append(classDir);
  -        try {
  -            classLoader.addDirectory(new File(classDir));
  -        } catch (Exception e) {
  -            log.debug("Could not add directory" + classDir, e);
  +        if(classDir != null) {
  +            buildClassPath.append(classDir);
  +            try {
  +                classLoader.addDirectory(new File(classDir));
  +            } catch (Exception e) {
  +                log.debug("Could not add directory" + classDir, e);
  +            }
           }
   
           if (root.isDirectory()) {
  @@ -540,8 +546,8 @@
           log.debug("getRealPath for /: " + path);
           if(path == null) {
               // Try to figure out the path of the root from that of WEB-INF
  -            path = this.servletContext.getRealPath("/WEB-INF");
  -            log.debug("getRealPath for /WEB-INF: " + path);
  +            path = this.servletContext.getResource("/WEB-INF").toString();
  +            log.debug("getResource for /WEB-INF: " + path);
               path = path.substring(0,path.length()-"WEB-INF".length());
               log.debug("Path for Root: " + path);
           }
  
  
  
  1.11      +22 -2     
xml-cocoon2/src/org/apache/cocoon/transformation/TraxTransformer.java
  
  Index: TraxTransformer.java
  ===================================================================
  RCS file: 
/home/cvs/xml-cocoon2/src/org/apache/cocoon/transformation/TraxTransformer.java,v
  retrieving revision 1.10
  retrieving revision 1.11
  diff -u -r1.10 -r1.11
  --- TraxTransformer.java      2001/05/29 06:21:35     1.10
  +++ TraxTransformer.java      2001/05/29 17:05:04     1.11
  @@ -100,7 +100,7 @@
    * @author <a href="mailto:[EMAIL PROTECTED]";>Davanum Srinivas</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Carsten Ziegeler</a>
    * @author <a href="mailto:[EMAIL PROTECTED]";>Giacomo Pati</a>
  - * @version CVS $Id: TraxTransformer.java,v 1.10 2001/05/29 06:21:35 cziegeler Exp $
  + * @version CVS $Id: TraxTransformer.java,v 1.11 2001/05/29 17:05:04 dims Exp $
    */
   public class TraxTransformer extends ContentHandlerWrapper
   implements Transformer, Composable, Recyclable, Configurable, Cacheable, 
Disposable, URIResolver {
  @@ -148,7 +148,27 @@
               getLogger().debug("Creating new Templates in " + this + " for " + 
this.inputSource.getSystemId());
               InputSource is = new InputSource(this.inputSource.getInputStream());
               is.setSystemId(this.inputSource.getSystemId());
  -            templates = getTransformerFactory().newTemplates(new SAXSource(is));
  +            //templates = getTransformerFactory().newTemplates(new SAXSource(is));
  +
  +            // Create a Templates ContentHandler to handle parsing of the
  +            // stylesheet.
  +            javax.xml.transform.sax.TemplatesHandler templatesHandler =
  +                                                
getTransformerFactory().newTemplatesHandler();
  +
  +            // Create an XMLReader and set its ContentHandler.
  +            org.xml.sax.XMLReader reader =
  +                           org.xml.sax.helpers.XMLReaderFactory.createXMLReader();
  +            reader.setFeature("http://xml.org/sax/features/namespace-prefixes";, 
true);
  +            reader.setContentHandler(templatesHandler);
  +
  +            // Parse the stylesheet.
  +            reader.parse(is);
  +
  +            // Get the Templates object (generated during the parsing of the 
stylesheet)
  +            // from the TemplatesHandler.
  +            templates = templatesHandler.getTemplates();
  +
  +
               putTemplates (templates);
           } else {
               getLogger().debug("Reusing Templates in " + this + " for " + 
this.inputSource.getSystemId());
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     [EMAIL PROTECTED]
To unsubscribe, e-mail:          [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to