Class ResourceUtils

java.lang.Object
com.atlassian.plugin.webresource.ResourceUtils

public class ResourceUtils extends Object
  • Field Details

  • Method Details

    • getType

      public static String getType(@Nonnull String path)
      Determines the type (css/js) of the resource from the given path.
      Parameters:
      path - - the path to use
      Returns:
      the type of resource
    • getBasename

      public static String getBasename(@Nonnull String path)
      Determines the base name (name without the extension) of the resource from the given path.
      Parameters:
      path - - the path to use
      Returns:
      the basename of resource
      Since:
      3.3
    • getQueryParameters

      public static Map<String,String> getQueryParameters(javax.servlet.http.HttpServletRequest request)
      Returns a Map of query parameters from the request. If there are multiple values for the same query parameter, the first value is used.
      See Also:
      • ServletRequest.getParameterMap()
      • ServletRequest.getAttribute(String)
    • canRequestedResourcesContentBeAssumedConstant

      public static boolean canRequestedResourcesContentBeAssumedConstant(Map<String,String> params)
      Given a parameter map, determine if a web resource is cacheable.

      This determines whether we store in the file cache or not, as well as dictating 304 behaviour.

      Returns:
      if the STATIC_HASH is set and cache does not equal false.
    • shouldValidateRequest

      public static boolean shouldValidateRequest(Map<String,String> params)
      Allows HTTP request filters to opt-out of some WRM URL validation on a per-request basis.

      This determines whether the WRM may respond to HTTP requests with non-200 values if any validations fail.

      Parameters:
      params - key-value pairs derived from the HTTP request to check.
      Returns:
      false if the HTTP request has a WRM_INTEGRITY attribute with a `no-validate` value, otherwise true.