com.atlassian.plugin.servlet
Class ResourceUrlParser

java.lang.Object
  extended by com.atlassian.plugin.servlet.ResourceUrlParser

Deprecated. Since 2.2

public class ResourceUrlParser
extends Object

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 AbstractFileServerServlet.SERVLET_PATH, the 'strategyPrefix' is defined by a constructor parameter, the remainder is parsed by this parser into a PluginResource.


Constructor Summary
ResourceUrlParser(String strategyPrefix)
          Deprecated. Create a parser with the given strategy prefix for parsing URLs.
 
Method Summary
 boolean matches(String resourceUrl)
          Deprecated. Returns true if the provided URL matches a the URL prefix defined for this download strategy.
 com.atlassian.plugin.servlet.PluginResource parse(String resourceUrl)
          Deprecated. Parses resource download URLs for this plugin resource download strategy, returning a PluginResource.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ResourceUrlParser

public ResourceUrlParser(String strategyPrefix)
Deprecated. 
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 AbstractFileServerServlet.SERVLET_PATH.)

Parameters:
strategyPrefix - a String which will be found following 'download' at the start of matching URLs.
Method Detail

parse

public com.atlassian.plugin.servlet.PluginResource parse(String resourceUrl)
Deprecated. 
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.

matches

public boolean matches(String resourceUrl)
Deprecated. 
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.


Copyright © 2015 Atlassian. All rights reserved.