This page last changed on Aug 12, 2011 by aaime.


Provide a centralized API to build URLs allowing pluggable transformations to change them (e.g., proxy handling and the like).

Proposed By

Andrea Aime

Assigned to Release

1.7.7, 2.0.0


Choose one of: Under Discussion, In Progress, Completed, Rejected, Deferred


GeoServer code needs to generate a number of outputs whose contents back link to GeoServer.
HTTP proxies in general are not able to properly transform the GeoServer XML output, as a result some internal URL mangling strategy has been implemented to generate documents that can be readily used outside of the proxy.
This process, called "proxyfication", is carried on by RequestUtil.proxifiedBaseURL() which works to just change the base URL. The code usually calls also ResponseUtils.appendPath to add path and query elements to the mangled base url.

This process should be streamlined and generalized, providing a single call to build a URL, and a pluggable extension to mangle the various URL components.


Add a new RequestUtil method dedicated to building a URL given its components:

 * Builds and mangles a URL given its constitutent components.
 * The components will be eventually modified by registered
 * URLMangler instances to handle proxies or add security tokens
String buildURL(String baseURL, String path, Map kvp, URLType type);

where URLMangler and URLType would be:

public interface URLMangler
    public enum URLType {
        /** The link points outside Geoserver **/
        /** The link points to a static resource (image, ogc schema, etc.**/
        /** The link points to a dynamic service provided by Geoserver
            (WFS, WMS, WCS, etc.**/

     * Callback that can change the contents of the baseURL, the path or the KVP map
    public void mangleURL(StringBuffer baseURL, StringBuffer path,
                          Map kvp, URLType type);

The RequestUtil.buildURL method will call in turn each of the URLMangler registered in the Spring context and assemble the final URL.
The current "proxification" mechanism will be a a URLMangler changing only the baseURL.

The change per se does not introduce significant new API, but it's deemed to require a GSIP in that it will affect the whole codebase and should be known to developers for any output that backlinks to GeoServer.


Discussion on the mailing list so far:

Backwards Compatibility

No backwards compatibility issue.


Andrea Aime: +1
Alessio Fabiani
Justin Deoliveira: +1
Jody Garnett: +1
Simone Giannecchini:


[JIRA Task|]
[Email Discussion|]
[Wiki Page|]

Document generated by Confluence on May 14, 2014 23:00