class UrlSessionTracking extends BaseSessionTracking implements SessionTracking {

  @Override
  public IdAndSource retrieveId(RequestWithSession request) {
    String requestUri = ((HttpServletRequest)request).getRequestURI();
    int sessionIdStart = requestUri.toLowerCase().lastIndexOf(sessionIdPathItem);
    if (sessionIdStart > -1) {
      sessionIdStart += sessionIdPathItem.length();
      String sessionId = clean(requestUri.substring(sessionIdStart));
      if (sessionId != null) {
        return new IdAndSource(sessionId, isCookieTracking());
      } else {
        return null;
      }
    }
    if (this.nextSessionTracking != null) {
      return this.nextSessionTracking.retrieveId(request);
    }
    return null;
  }

}