class PathExtractor {

  String path(RequestContext context) {
    HttpServletRequest request = context.getRequest();
    StringBuilder builder = new StringBuilder();

    builder.append(request.getContextPath()).append(request.getServletPath());
    if (request.getPathInfo() != null) {
      builder.append(request.getPathInfo());
    }

    if (context.getRequestQueryParams() != null) {
      appendQueryParams(context, builder);
    }

    return builder.toString();
  }

}