Reading-eScience-Centre / edal-java

Environmental Data Abstraction Layer libraries
Other
39 stars 30 forks source link

Godiva3 "Export to PNG" link generation #119

Open lesserwhirls opened 5 years ago

lesserwhirls commented 5 years ago

When using the Godiva3 viewer in the TDS, the "Export to PNG" link is generated with two slashes between the context and the server. For example:

https://thredds-test.unidata.ucar.edu/thredds/Godiva.html?server=https://thredds-test.unidata.ucar.edu/thredds/wms/grib/NCEP/NAM/Alaska_95km/Best

By selecting a layer and inspecting the "Export to PNG" link, e.g.:

https://thredds-test.unidata.ucar.edu//thredds/screenshots/createScreenshot?server=https://thredds-test.unidata.ucar.edu/thredds/wms/grib/NCEP/NAM/Alaska_95km/Best&numColorBands=250&logScale=false&bbox=-203.8799246803,0.94952112107921,-36.757669699699,134.64732510556&abovemaxcolor=extend&belowmincolor=extend&nodatacolor=extend&layer=Geopotential_height_surface&time=2019-08-01T12:00:00.000Z&palette=default&style=default-scalar&scaleRange=-1.77,2393&displayScaleRange=-1.77,2393&opacity=1&bbox=-203.879925,0.949521,-36.75767,134.647325&layerTitle=Geopotential_height_surface,Untitled%20Dataset&crs=CRS:84&mapHeight=600&mapWidth=750&style=default-scalar&zUnits=null&units=gpm&baseUrl=http://godiva.reading.ac.uk/geoserver/ReSC/wms?&baseLayers=naturalearth

we get thredds-test.unidata.ucar.edu//thredds/screenshots/... with the double slash between edu and the context. When running through an Apache proxy using the mod_jk connector, it seems the the double slash is ignored and everything works. However, when running directly through Tomcat, the presence of the double slash results in an error:

HTTP Status 500 - The request was rejected because the URL was not normalized.

type Exception report
message The request was rejected because the URL was not normalized.
description The server encountered an internal error that prevented it from fulfilling this request.
exception
org.springframework.security.web.firewall.RequestRejectedException: The request was rejected because the URL was not normalized.
    org.springframework.security.web.firewall.StrictHttpFirewall.getFirewalledRequest(StrictHttpFirewall.java:248)
    org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:193)
    org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:177)
    org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:347)
    org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:263)
    org.apache.logging.log4j.web.Log4jServletFilter.doFilter(Log4jServletFilter.java:71)
note The full stack trace of the root cause is available in the Apache Tomcat/8.0.44 logs.

Note that when Godiva3 loads fresh and before a layer is selected, the "Export to PNG" link does not include a double slash - the double slash only appears once the "Export to PNG" link is regenerated upon selecting a layer. My GWT skills are pretty much non-existent, but hopefully this report helps identify the problem.

guygriffiths commented 4 years ago

Sorry for the long delay in this - I don't have a great deal of time available for working on ncWMS at the moment. I've fixed it in the develop branch and will try to cut a v2.4.2 release tomorrow