Skip to content

GSIP 39

Jody Garnett edited this page Jul 12, 2017 · 1 revision

GSIP 39 - Centralized, pluggable URL mangling

Overview

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

State

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

Motivation

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.

Proposal

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 **/
        EXTERNAL,
        /** The link points to a static resource (image, ogc schema, etc.**/
        RESOURCE,
        /** The link points to a dynamic service provided by Geoserver
            (WFS, WMS, WCS, etc.**/
        SERVICE
    };

    /**
     * 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.

Feedback

Discussion on the mailing list so far:[http://www.nabble.com/URL-construction-callbacks-to25023368.html]

Backwards Compatibility

No backwards compatibility issue.

Voting

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

Links

JIRA Task Email Discussion Wiki Page

Clone this wiki locally