protected Resource getResourceToProcess()

in server/src/jetbrains/buildServer/staticUIExtensions/web/StaticResourcesController.java [79:99]


  protected Resource getResourceToProcess(@NotNull final HttpServletRequest request, @NotNull final HttpServletResponse response) throws Exception {
    if (myProvider == null) {
      throw new IllegalStateException("ResourcesProvider for StaticResourcesController [" + this + "] is null. Cannot dispatch request.");
    }

    // check whether a matching resource exists
    final Resource resource = getResource(request);
    if (resource == null) {
      LOG.debug("No matching resource found - returning 404");
      response.sendError(HttpServletResponse.SC_NOT_FOUND);
      return null;
    }

    // check not modified
    if (new ServletWebRequest(request, response).checkNotModified(resource.lastModified())) {
      LOG.debug("Resource not modified - returning 304");
      return null;
    }

    return resource;
  }