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

add check for GetLegendGraphic parameters 'layer' and 'style' #87

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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions wms/src/main/java/uk/ac/rdg/resc/edal/wms/GetMapStyleParams.java
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,18 @@ public GetMapStyleParams(RequestParams params, WmsCatalogue catalogue) throws Ed
}

if (xmlStyle == null) {
/*
* Check if this a request with LAYER parameter required for GetLegendGraphic
*/
String layerStr = params.getString("layer");
if (layerStr != null && layersStr == null) {
layers = new String[]{layerStr};
}
String styleStr = params.getString("style");
if (stylesStr != null && stylesStr == null) {
styles = new String[]{styleStr};
}

if (layers == null) {
throw new EdalException(
"You must specify either SLD, SLD_BODY or LAYERS and STYLES");
Expand Down
2 changes: 1 addition & 1 deletion wms/src/main/java/uk/ac/rdg/resc/edal/wms/WmsServlet.java
Original file line number Diff line number Diff line change
Expand Up @@ -2009,7 +2009,7 @@ protected void getLegendGraphic(RequestParams params, HttpServletResponse httpSe
"Requested layer is either not present, disabled, or not yet loaded.");
} catch (Exception e) {
throw new MetadataException(
"You must specify either SLD, SLD_BODY or LAYERS and STYLES for a full legend. You may set COLORBARONLY=true to just generate a colour bar");
"You must specify either SLD, SLD_BODY, LAYERS and STYLES, or LAYER and STYLE for a full legend. You may set COLORBARONLY=true to just generate a colour bar");
}
/*
* Test whether we have categorical data - this will generate a
Expand Down