cocoon-cvs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From blorit...@apache.org
Subject cvs commit: xml-cocoon2/src/org/apache/cocoon/components/url ParsedContextURLProtocolHandler.java
Date Thu, 11 Oct 2001 19:18:29 GMT
bloritsch    01/10/11 12:18:29

  Modified:    src/org/apache/cocoon/components/url
                        ParsedContextURLProtocolHandler.java
  Log:
  Context URL working!!!!!
  
  Revision  Changes    Path
  1.2       +19 -7     xml-cocoon2/src/org/apache/cocoon/components/url/ParsedContextURLProtocolHandler.java
  
  Index: ParsedContextURLProtocolHandler.java
  ===================================================================
  RCS file: /home/cvs/xml-cocoon2/src/org/apache/cocoon/components/url/ParsedContextURLProtocolHandler.java,v
  retrieving revision 1.1
  retrieving revision 1.2
  diff -u -r1.1 -r1.2
  --- ParsedContextURLProtocolHandler.java	2001/10/11 14:34:44	1.1
  +++ ParsedContextURLProtocolHandler.java	2001/10/11 19:18:29	1.2
  @@ -12,6 +12,7 @@
   import org.apache.batik.util.ParsedURLData;
   import org.apache.cocoon.environment.Context;
   import java.net.MalformedURLException;
  +import java.net.URL;
   
   
   /**
  @@ -21,7 +22,7 @@
    * an uncontrolled manner (as far as Cocoon is concerned).
    *
    * @author <a href="mailto:bloritsch@apache.org">Berin Loritsch</a>
  - * @version $Id: ParsedContextURLProtocolHandler.java,v 1.1 2001/10/11 14:34:44 bloritsch
Exp $
  + * @version $Id: ParsedContextURLProtocolHandler.java,v 1.2 2001/10/11 19:18:29 bloritsch
Exp $
    */
   public class ParsedContextURLProtocolHandler extends AbstractParsedURLProtocolHandler {
       private static Context context = null;
  @@ -49,9 +50,10 @@
        * "context://".
        */
       public ParsedURLData parseURL(String uri) {
  +        ParsedURLData urldata = null;
           try {
  -            return new ParsedURLData(ParsedContextURLProtocolHandler.context
  -                                 .getResource(uri.substring("context://".length())));
  +            String path = uri.substring("context:/".length());
  +            urldata = new ParsedURLData(ParsedContextURLProtocolHandler.context.getResource(path));
           } catch (MalformedURLException mue) {
               StringBuffer baseFile = new StringBuffer(ParsedContextURLProtocolHandler
                                                        .context.getRealPath("/"));
  @@ -63,11 +65,21 @@
               baseFile.append(baseFile);
               baseFile.append(uri.substring("context://".length()));
   
  -            ParsedURLData purl = new ParsedURLData();
  -            purl.protocol = "file";
  -            purl.path = baseFile.toString();
  -            return purl;
  +            urldata = new ParsedURLData();
  +            urldata.protocol = "file";
  +            urldata.path = baseFile.toString();
           }
  +
  +        if ("file".equals(urldata.protocol)) {
  +            urldata.host = null;
  +            urldata.port = -1;
  +        } else if (null == urldata.host) {
  +            urldata.port = -1;
  +        } else if (urldata.port < 0) {
  +            urldata.host = null;
  +        }
  +
  +        return urldata;
       }
   
       /**
  
  
  

----------------------------------------------------------------------
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


Mime
View raw message