code: public static String deRelativize( final boolean absolutize, final String path )
      {
  
          if ( path == null )
          {
              return null;
          }
  
          // Create a place for the normalized path
          String result = path;
  
          if ( result.equals( "/." ) )
          {
              return "/";
          }
  
          // Add a leading "/" if necessary
          if ( absolutize && !result.startsWith( "/" ) )
          {
              result = "/" + result;
          }
  
          // Resolve occurrences of "//" in the normalized path
          while ( true )
          {
              final int index = result.indexOf( "//" );
              if ( index < 0 )
              {
                  break;
              }
              result = result.substring( 0, index ) + result.substring( index + 1 );
          }
  
          // Resolve occurrences of "/./" in the normalized path
          while ( true )
          {
              final int index = result.indexOf( "/./" );
              if ( index < 0 )
              {
                  break;
              }
              result = result.substring( 0, index ) + result.substring( index + 2 );
          }
  
          // Resolve occurrences of "/../" in the normalized path
          while ( true )
          {
              final int index = result.indexOf( "/../" );
              if ( index < 0 )
              {
                  break;
              }
              if ( index == 0 )
              {
                  return ( null ); // Trying to go outside our context
              }
              final int index2 = result.lastIndexOf( '/', index - 1 );
              result = result.substring( 0, index2 ) + result.substring( index + 3 );
          }
  
          // Return the normalized path that we have completed
          return result;
  
      }
docs: Normalize a relative URI path that may have relative values ("/./",
  "/../", and so on ) it it. <strong>WARNING</strong> - This method is
  useful only for normalizing application-generated paths. It does not try
  to perform security checks for malicious input.
  @param absolutize
  
  @param path
  Relative path to be normalized