public class

ResourceUrlParser

extends Object
java.lang.Object
   ↳ com.atlassian.plugin.servlet.ResourceUrlParser

This class is deprecated.
Since 2.2

Class Overview

Parses resource download URLs for a plugin resource download strategy, and can determine whether a given URL is valid for that download strategy.

The URLs are in the form "/servletPath/strategyPrefix/moduleCompleteKey/resourceName", where the 'servletPath' is defined as SERVLET_PATH, the 'strategyPrefix' is defined by a constructor parameter, the remainder is parsed by this parser into a PluginResource.

Summary

Public Constructors
ResourceUrlParser(String strategyPrefix)
Create a parser with the given strategy prefix for parsing URLs.
Public Methods
boolean matches(String resourceUrl)
Returns true if the provided URL matches a the URL prefix defined for this download strategy.
PluginResource parse(String resourceUrl)
Parses resource download URLs for this plugin resource download strategy, returning a PluginResource.
[Expand]
Inherited Methods
From class java.lang.Object

Public Constructors

public ResourceUrlParser (String strategyPrefix)

Create a parser with the given strategy prefix for parsing URLs.

For example, a strategy prefix of 'resources' means that this parser will match URLs which include 'download/resources'. (Where 'download' is defined as SERVLET_PATH.)
Parameters
strategyPrefix a String which will be found following 'download' at the start of matching URLs.

Public Methods

public boolean matches (String resourceUrl)

Returns true if the provided URL matches a the URL prefix defined for this download strategy.

Parameters
resourceUrl the URL of the resource request
Returns
  • true if the URL designates a request for this download strategy, otherwise false.

public PluginResource parse (String resourceUrl)

Parses resource download URLs for this plugin resource download strategy, returning a PluginResource. Returns null if the URL does not match (i.e. matches(String) returns false), or the final part of the URL cannot be split into a moduleCompleteKey and resourceName (i.e. there's no slash in the final component).

Parsing uses the download strategy prefix to determine where in the URL string to start. The strategy prefix and one character following it (typically a slash) is skipped, then the remainder is split on the first slash found.
Parameters
resourceUrl the URL of the resource request
Returns
  • a resource which includes the plugin or plugin module's complete key and the resource name, or null if the URL doesn't parse correctly.