United StatesChange Country, Oracle Worldwide Web Sites Communities I am a... I want to...
JDK-6226081 : URI should be able to relativize paths with partial roots

Details
Type:
Enhancement
Submit Date:
2005-02-07
Status:
Open
Updated Date:
2011-02-16
Project Name:
JDK
Resolved Date:
Component:
core-libs
OS:
windows_xp
Sub-Component:
java.net
CPU:
x86
Priority:
P4
Resolution:
Unresolved
Affected Versions:
5.0
Targeted Versions:

Related Reports

Sub Tasks

Description
A DESCRIPTION OF THE REQUEST :
At the moment, the relativize() method of URI will only  relativize URIs when one is a prefix of the other.  It would be useful, however to be able to do things like

    public static void main(String[] argv)
    {
        try
        {
            URI a = new URI("file:/c:/abc/def/myDocument/doc.xml");
            URI b = new URI("file:/c:/abc/def/images/subdir/image.png");
            
            URI c = a.relativize(b);
            
            System.err.println(c);
        }
        catch (Exception e)
        {
            e.printStackTrace();
        }
    }

If this returned a URI of ../images/subdir/image.png,  it would make my job implementing editors much easier

JUSTIFICATION :
Current relativize method is too limited.
###@###.### 2005-2-07 10:44:17 GMT

                                    

Comments



Hardware and Software, Engineered to Work Together