You are viewing a plain text version of this content. The canonical link for it is here.
Posted to cvs@cocoon.apache.org by st...@apache.org on 2003/02/01 18:09:18 UTC

cvs commit: xml-cocoon2/src/java/org/apache/cocoon/environment/http HttpEnvironment.java

stephan     2003/02/01 09:09:18

  Modified:    src/java/org/apache/cocoon/environment/http
                        HttpEnvironment.java
  Log:
  For a null mime-type, the enviroment is able to retrieve the
  mime-type from the context. This is important for choosing
  the right xmlizer/parser.
  
  Revision  Changes    Path
  1.23      +18 -2     xml-cocoon2/src/java/org/apache/cocoon/environment/http/HttpEnvironment.java
  
  Index: HttpEnvironment.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/java/org/apache/cocoon/environment/http/HttpEnvironment.java,v
  retrieving revision 1.22
  retrieving revision 1.23
  diff -u -r1.22 -r1.23
  --- HttpEnvironment.java	31 Jan 2003 22:51:45 -0000	1.22
  +++ HttpEnvironment.java	1 Feb 2003 17:09:18 -0000	1.23
  @@ -51,12 +51,14 @@
   package org.apache.cocoon.environment.http;
   
   import org.apache.cocoon.Constants;
  +import org.apache.cocoon.ProcessingException;
   import org.apache.cocoon.components.request.RequestFactory;
   import org.apache.cocoon.environment.AbstractEnvironment;
   import org.apache.cocoon.environment.ObjectModelHelper;
   import org.apache.cocoon.environment.Redirector;
   import org.apache.cocoon.environment.Session;
   import org.apache.cocoon.util.NetUtils;
  +import org.apache.cocoon.components.source.SourceUtil;
   
   import javax.servlet.ServletContext;
   import javax.servlet.http.HttpServletRequest;
  @@ -67,6 +69,9 @@
   import java.net.URL;
   import java.util.Enumeration;
   
  +import org.xml.sax.ContentHandler;
  +import org.xml.sax.SAXException;
  +
   /**
    * @author ?
    * @version CVS $Id$
  @@ -288,5 +293,16 @@
           }
           return true;
       }
  -    
  +
  +
  +    public void toSAX( org.apache.excalibur.source.Source source,
  +                String         mimeTypeHint,
  +                ContentHandler handler )
  +    throws SAXException, IOException, ProcessingException {
  +        // Allow to retrieve the mime-type from the context.
  +        if (mimeTypeHint==null)
  +          super.toSAX(source, webcontext.getMimeType(SourceUtil.getPath(source.getURI())), handler);
  +        else
  +          super.toSAX(source, mimeTypeHint, handler);
  +    }    
   }
  
  
  

----------------------------------------------------------------------
In case of troubles, e-mail:     webmaster@xml.apache.org
To unsubscribe, e-mail:          cocoon-cvs-unsubscribe@xml.apache.org
For additional commands, e-mail: cocoon-cvs-help@xml.apache.org