Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[GEOS-11371] Refactor inline JavaScript in the GetMap OpenLayers format #7560

Merged
merged 2 commits into from
May 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
package org.geoserver.security;

import static org.custommonkey.xmlunit.XMLAssert.assertXpathEvaluatesTo;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertTrue;

Expand Down Expand Up @@ -302,7 +304,11 @@ public void testOpenLayersMapOutput() throws Exception {
+ citeKey);
byte[] responseContent = getBinary(response);
String htmlDoc = new String(responseContent, StandardCharsets.UTF_8);
assertTrue(
htmlDoc.indexOf("http://localhost:8080/geoserver/cite/wms?authkey=" + citeKey) > 0);
assertThat(
htmlDoc,
containsString(
"<input type=\"hidden\" id=\"servicePath\" value=\"cite/wms?authkey="
+ citeKey
+ "\"/>"));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -127,17 +127,15 @@ public RawMap produceMap(WMSMapContent mapContent) throws ServiceException, IOEx
String templateName = getTemplateName(mapContent);
Template template = cfg.getTemplate(templateName);
HashMap<String, Object> map = new HashMap<>();
map.put("context", mapContent);
boolean hasOnlyCoverages = hasOnlyCoverages(mapContent);
map.put("pureCoverage", hasOnlyCoverages);
map.put("supportsFiltering", supportsFiltering(mapContent));
map.put("pureCoverage", Boolean.toString(hasOnlyCoverages(mapContent)));
map.put("supportsFiltering", Boolean.toString(supportsFiltering(mapContent)));
map.put("styles", styleNames(mapContent));
GetMapRequest request = mapContent.getRequest();
map.put("request", request);
map.put("yx", String.valueOf(isWms13FlippedCRS(request.getCrs())));
map.put("yx", Boolean.toString(isWms13FlippedCRS(request.getCrs())));
map.put(
"maxResolution",
Double.valueOf(getMaxResolution(mapContent.getRenderingArea())));
Double.toString(getMaxResolution(mapContent.getRenderingArea())));
ProjectionHandler handler = null;
try {
handler =
Expand All @@ -150,7 +148,7 @@ public RawMap produceMap(WMSMapContent mapContent) throws ServiceException, IOEx
}
map.put(
"global",
String.valueOf(
Boolean.toString(
handler != null && handler instanceof WrappingProjectionHandler));

String baseUrl =
Expand Down Expand Up @@ -351,7 +349,7 @@ private List<Map<String, String>> getLayerParameter(Map<String, String> rawKvp)
}
if (!exceptionsFound) {
Map<String, String> map = new HashMap<>();
map.put("name", "exceptions");
map.put("name", "EXCEPTIONS");
map.put("value", "application/vnd.ogc.se_inimage");
result.add(map);
}
Expand Down