1 package org.codehaus.classworlds;
2
3 import java.net.URL;
4
5 /***
6 *
7 *
8 * @author <a href="mailto:jason@maven.org">Jason van Zyl</a>
9 *
10 * @version $Id: UrlUtils.java,v 1.1 2003/09/21 23:28:51 jvanzyl Exp $
11 */
12 public class UrlUtils
13 {
14 public static String normalizeUrlPath( String name )
15 {
16 if ( name.startsWith( "/" ) )
17 {
18 name = name.substring( 1 );
19
20 System.out.println( "1 name = " + name );
21 }
22
23 // Looking for org/codehaus/werkflow/personality/basic/../common/core-idioms.xml
24 // | i |
25 // +-------+ remove
26 //
27 int i = name.indexOf( "/.." );
28
29 // Can't be at the beginning because we have no root to refer to so
30 // we start at 1.
31 if ( i > 0 )
32 {
33 int j = name.lastIndexOf( "/", i - 1 );
34
35 name = name.substring( 0, j ) + name.substring( i + 3 );
36
37 System.out.println( "2 name = " + name );
38 }
39
40 return name;
41 }
42 }
This page was automatically generated by Maven