001    package com.khubla.pragmatach.framework.url;
002    
003    import com.khubla.pragmatach.framework.api.PragmatachException;
004    
005    /**
006     * @author tome
007     */
008    public class URICracker {
009       /**
010        * parse the URI parameters. If no parameters, returns "/";
011        */
012       public static String[] crackURI(String uri) throws PragmatachException {
013          try {
014             String p = uri;
015             if (p.startsWith("/")) {
016                p = p.substring(1);
017             }
018             if ((p.length() > 0) && (p.contains("/"))) {
019                return p.split("/");
020             } else {
021                if (p.length() > 0) {
022                   return new String[] { p };
023                } else {
024                   return new String[] { "/" };
025                }
026             }
027          } catch (final Exception e) {
028             throw new PragmatachException("Exception in parseParameters", e);
029          }
030       }
031    }