Here you can find the source of normalize(URI location)
private static URI normalize(URI location)
//package com.java2s; /******************************************************************************* * Copyright (c) 2012 SAP AG and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * * Contributors:/*from w w w .jav a 2 s .co m*/ * SAP AG - initial API and implementation *******************************************************************************/ import java.net.URI; import java.net.URISyntaxException; public class Main { private static URI normalize(URI location) { // remove trailing slashes try { String path = location.getPath(); if (path != null && path.endsWith("/")) { return new URI(location.getScheme(), location.getAuthority(), path.substring(0, path.length() - 1), location.getQuery(), location.getFragment()); } else { return location; } } catch (URISyntaxException e) { throw new RuntimeException(e); } } }