The Redirector service converts one URI into another. It also supports optional methods for registering URI redirects.

Core Interface:

Redirect
{
string get(string uri)
}

The string passed into get() will be matched against registered patterns and a new string will be returned.

Optional Interface:

RedirectRegistar
{
void register(string pattern, string replacement)
}

This method registers a pattern with the redirector. Patterns are regular expressions. The replacement string is a string with regexp replacements strings. For instance, the string "$1" in the replacement string will be replacet by the first part of the regexp grouped by "()".

Optional Interface:

WebRedirector
{
string getURL()
}

This method retrieves the URL used to access the redirector service via HTTP GET. This use useful for allowing non-XML-RPC-enabled applications to use the redirection service. When the URL returned from getURL() is accessed, the path passed to the redirector service will be used in a get() call. The results of this call will be returned to the HTTP client as part of an HTTP redirect, transparently redirecting the HTTP client to the new destination URI.

Optional Interface:

WebRedirectorManager
{
setURL(string url)
}

This method sets the url that the WebRedirector interface's getURL() method should return. This is useful if the redirector service does not know its own URL, such as if it were launched by a servlet server which binds servlets to URLs based on the contents of a configuration file.