code: public static Map<String, String> parseUrl(String url) throws Exception {
          final String[] values = url.split(":", 2);
          HashMap<String, String> sortParameters = new HashMap<String, String>();
          sortParameters.put(SORT_BY_KEY, values[0]);
          if (values.length > 1) {
              sortParameters.put(SORT_DIRECTION_KEY, values[1]);
              if (sortParameters.get(SORT_BY_KEY).isEmpty()) {
                  throw new Exception("Error parsing the SortBy parameter: missing field to sort by");
              }
              if (!sortParameters.get(SORT_DIRECTION_KEY).equalsIgnoreCase(Direction.ASC.name()) && !sortParameters.get(SORT_DIRECTION_KEY).equalsIgnoreCase(Direction.DESC.name())) {
                  throw new Exception("Error parsing the SortBy parameter: sort direction needs to be either " + Direction.ASC + " or " + Direction.DESC);
              }
          }
          else if (values.length == 1) {
              // Default to ascending if only the sorting field has been passed without direction
              sortParameters.put(SORT_DIRECTION_KEY, Direction.ASC.name());
          }
          return sortParameters;
      }
docs: Parse the sorting part of the URI and return sortBy and sortDirection counterparts
  @param url  String representing the sorting part of the URI, which is of the form SortBy=<field>:<direction>', for example: '?SortBy=date_created:asc'
  @return a map containing sortBy and sortDirection
  @throws Exception if there is a parsing error