Here you can find the source of parsePathElements(URI uri)
public static String[] parsePathElements(URI uri)
//package com.java2s; /************************************************************************************** * Copyright (C) 2008 EsperTech, Inc. All rights reserved. * * http://esper.codehaus.org * * http://www.espertech.com * * ---------------------------------------------------------------------------------- * * The software in this package is published under the terms of the GPL license * * a copy of which has been included with this distribution in the license.txt file. * **************************************************************************************/ import java.net.URI; public class Main { public static String[] parsePathElements(URI uri) { String path = uri.getPath(); if (path == null) { return new String[0]; }// ww w.jav a 2s . c om while (path.startsWith("/")) { path = path.substring(1); } String[] split = path.split("/"); if ((split.length > 0) && (split[0].length() == 0)) { return new String[0]; } return split; } }