code: public static String getContextRequestUri(HttpServletRequest request) {
  		String requestUri = request.getRequestURI();
  		String contextPath = request.getContextPath();
  		int cpLen = contextPath.length();
  		if(cpLen > 0) {
  			assert requestUri.startsWith(contextPath);
  			return requestUri.substring(cpLen);
  		} else {
  			return requestUri;
  		}
  	}
docs: Gets the current request URI in context-relative form.  The contextPath stripped.