Here you can find the source of normalizeDotSegment(String path)
private static String normalizeDotSegment(String path)
//package com.java2s; /******************************************************************************* * Copyright (c) 2012 National University of Ireland, Galway. All Rights Reserved. * * * This project is a free software: you can redistribute it and/or modify * it under the terms of the GNU Affero General Public License as * published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * This project is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public * License along with this project. If not, see <http://www.gnu.org/licenses/>. *******************************************************************************/ public class Main { private static String normalizeDotSegment(String path) { // remove dot-segment prefix (not removed by URI#normalize) while (path.startsWith("/./") || path.startsWith("/../")) { path = path.replaceFirst("/[\\.]+/", "/"); }//from w w w . j a v a2s . c o m return path; } }