[jboss-dev-forums] [Design of POJO Server] - Re: Regression on VirtualFile.toURL()

scott.stark@jboss.org do-not-reply at jboss.com
Wed Feb 18 12:17:02 EST 2009


"alesj" wrote : "adrian at jboss.org" wrote : That's what I told you yesterday. The URL you are returning is not valid.
  |   | Its a packed jar not a directory.
  |   | 
  | I don't get it anymore.
  | Who says this is not valid? The spec?
  | 
  | I thought it was about consistency.
  | e.g. have all non-leaves with "/" at the end
  | 

The main problem is that new URL(".../x/", "y") and URL(".../x", "y") result in two different resolved URLs:

  | import java.net.*;
  | 
  | public class x
  | {
  |    public static void main(String[] args)
  | 	throws Exception
  |    {
  |       URL dir = new URL("file:/tmp/x/");
  |       URL file = new URL("file:/tmp/x");
  |       URL subdir = new URL(dir, "y");
  |       URL subfile = new URL(file, "y");
  |       System.out.println(subdir);
  |       System.out.println(subfile);
  |    }
  | }
  | 
  | ... output:
  | 
  | file:/tmp/x/y
  | file:/tmp/y
  | 

This is what Carlo is saying about how the relative url against the jar is being resolved. 

View the original post : http://www.jboss.org/index.html?module=bb&op=viewtopic&p=4211193#4211193

Reply to the post : http://www.jboss.org/index.html?module=bb&op=posting&mode=reply&p=4211193



More information about the jboss-dev-forums mailing list