Return-Path: Mailing-List: contact cocoon-cvs-help@xml.apache.org; run by ezmlm Delivered-To: mailing list cocoon-cvs@xml.apache.org Received: (qmail 36830 invoked by uid 1041); 19 Aug 2000 16:01:33 -0000 Date: 19 Aug 2000 16:01:33 -0000 Message-ID: <20000819160133.36829.qmail@locus.apache.org> From: giacomo@locus.apache.org To: xml-cocoon-cvs@apache.org Subject: cvs commit: xml-cocoon/src/org/apache/cocoon/environment/http HttpEnvironment.java giacomo 00/08/19 09:01:33 Modified: src/org/apache/cocoon/environment/http Tag: xml-cocoon2 HttpEnvironment.java Log: Fixed Contextpath to make C2 run with Tomcat as well as with Cataline. Tomcat return on a ServletContext.getRealPath("/") call a string ended in a '/' where Catalina does not. Revision Changes Path No revision No revision 1.1.2.9 +7 -1 xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpEnvironment.java Index: HttpEnvironment.java =================================================================== RCS file: /home/cvs/xml-cocoon/src/org/apache/cocoon/environment/http/Attic/HttpEnvironment.java,v retrieving revision 1.1.2.8 retrieving revision 1.1.2.9 diff -u -r1.1.2.8 -r1.1.2.9 --- HttpEnvironment.java 2000/08/04 21:11:36 1.1.2.8 +++ HttpEnvironment.java 2000/08/19 16:01:30 1.1.2.9 @@ -70,7 +70,12 @@ this.response = new HttpResponse (response); this.servletResponse = response; this.servletContext = servletContext; - this.context = new URL("file://"+servletContext.getRealPath("/")); + String ctx = servletContext.getRealPath("/"); + if (ctx.charAt(ctx.length()-1) != '/') { + this.context = new URL("file://"+ctx+'/'); + } else { + this.context = new URL("file://"+ctx); + } this.outputStream = response.getOutputStream(); this.objectModel = new Hashtable(); this.objectModel.put("request", this.request); @@ -92,6 +97,7 @@ */ public void changeContext(String prefix, String context) throws MalformedURLException { +this.servletContext.log("changeContext: prefix="+prefix+",context="+context); if (uri.startsWith (prefix)) { this.prefix.append (prefix); uri = uri.substring(prefix.length());