On 18/02/16 23:23, Robert Coup wrote:
> +1 for absolute URL. I think it'll need to pass through the URLMangler
> process too so that it can get rewritten if necessary for the environment.

Thanks, Robert, that is a very good point.

Niels, all your URL construction must use URLManglers 
(ProxifyingURLMangler in this case) to ensure that PROXY_BASE_URL 
rewriting occurs. ResponseUtils.buildURL does this. It looks like the 
ResponseUtils.buildURL path is not percent-encoded so you still have to 
do this yourself (or fix ResponseUtils). For example:

ResponseUtils.buildURL(
     "http://localhost:8080";,
     "/rest/resource/po%C3%ABzie/caf%C3%A9",
     new HashMap<String, String>(){{put("format", "xml");}},
     URLType.RESOURCE);

->

http://localhost:8080/geoserver/rest/resource/po%C3%ABzie/caf%C3%A9?format=xml

The kvp Map can be null. If PROXY_BASE_URL is set, it replaces 
"http://localhost:8080";.

As I hinted above, it might be a very good idea to move your path 
percent encoding into ResponseUtils.buildURL so all code can benefit. 
Path elements in URLs muse be encoded when necessary, and until now, 
GeoServer has gotten away with not doing so because all path elements 
are unreserved.

Also, ResponseUtils.urlEncode and ResponseUtils.urlDecode use:
URLEncoder.encode(value, "ISO-8859-1")
URLDecoder.decode(value, "ISO-8859-1")
which I think should be changed to "UTF-8". Leaving this as "ISO-8859-1" 
is going to break a lot more things.

>> - Should Resource-Parent have the query (i.e. "?format=xml") of the
>> original request?
> Personally I'd say "no", because it's pointing to the parent *resource *rather
> than it's representation. *?format=* is a bit of a hack, *Accept:* headers
> are how it's *supposed* to work in the ideal world ;)

I agree. Omitting "?format=xml" seems more RESTful and is probably 
easier for a client to use as it is more straightforward to append 
"?format=xml" than remove a query.

Kind regards,

-- 
Ben Caradoc-Davies <b...@transient.nz>
Director
Transient Software Limited <http://transient.nz/>
New Zealand

------------------------------------------------------------------------------
Site24x7 APM Insight: Get Deep Visibility into Application Performance
APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month
Monitor end-to-end web transactions and take corrective actions now
Troubleshoot faster and improve end-user experience. Signup Now!
http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________
Geoserver-devel mailing list
Geoserver-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/geoserver-devel

Reply via email to