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

Empty Language parameter in printing legend seems to be refused by some servers. #8871

Closed
1 task done
offtherailz opened this issue Dec 12, 2022 · 5 comments · Fixed by #10041, #10043 or #10443
Closed
1 task done

Comments

@offtherailz
Copy link
Member

offtherailz commented Dec 12, 2022

Description

MapStore by default sends a LANGUAGE parameter for the legend generation in print plugin. This parameter is empty if the i18n for the source is not configured.

LANGUAGE: spec.language || '',

Anyway, sending and empty string for it seems to make some GeoServers rise an error.

<ows:ExceptionReport xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:ows="http://www.opengis.net/ows" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" version="1.0.0" xsi:schemaLocation="http://www.opengis.net/ows https://geoportail.lepuyenvelay.fr/geoserver/schemas/ows/1.0.0/owsExceptionReport.xsd">
<ows:Exception exceptionCode="NoApplicableCode">
<ows:ExceptionText>A Language parameter was provided in the request but it cannot be resolved to an ISO lang code. Parameter value is empty while supported languages are hun,swe,dut,est,fin,ice,gsw,rum,pol,cze,dan,nor,por,ger,lit,ita,fre,gre,eng,lav,gle,spa,hrv,mlt,slo,bul,slv</ows:ExceptionText>
</ows:Exception>
</ows:ExceptionReport>

See this mailing list for the example and the details:

https://groups.google.com/g/mapstore-users/c/PZWlYsDrEMY

How to reproduce

  • Add a layer to the mapstore map from the GeoServer that has this problem (I did my test with this adding as WMS source https://geoportail.lepuyenvelay.fr/geoserver/ows , adding the parkings layer as for the mailing list )
  • Try to print the map with the new layer, adding the legend.

Expected Result

  • The legend is present

Current Result

  • The legend is not present

  • Opening the URL generated my mapstore for the legend (from create.json request body) you have the error reported.

  • Not browser related

Browser info (use this site: https://www.whatsmybrowser.org/ for non expert users)
Browser Affected Version
Internet Explorer
Edge
Chrome
Firefox
Safari

Other useful information

@jusabatier
Copy link

MapStore by default sends a LANGUAGE parameter for the legend generation in print plugin. This parameter is empty if the i18n for the source is not configured.

Is there a way to specify this in Mapstore config ? (-> force it to 'fre' on our platform for example)

@offtherailz
Copy link
Member Author

offtherailz commented Dec 14, 2022

No. This parameter is normally ignored by GeoServer, so sending it didn't caused any problem before. We will need to change it on PrintUtils by not sending the parameter when the value is not present.

Maybe this error is caused by some extension, like "inspire"? Looking at GeoServer code, it looks like the error is this one.

https:/geoserver/geoserver/blob/78d1dda9e1d0f01660541d3ecd260d6b3f370b64/src/extension/inspire/src/main/java/org/geoserver/inspire/LanguagesDispatcherCallback.java#L39-L44

JFI:

MapStore supports localization of styles and legends setting the property localizedLayerStyles like this (see doc):

// if defined, WMS layer styles localization will be added
  "localizedLayerStyles": {
      // name of the ENV parameter variable that is needed for localization proposes
      "name": "mapstore_language"
  },

assuming the implicit rule that if your current locale is fr-FR it will pass fr to the env variable configured in localizedLayerStyles and to LANGUAGE parameter

This only for the layers that activated this specific checkbox, visible only if localizedLayerStyles configuration is present, called "Use localized style" in layer settings. (see doc ) .

@offtherailz
Copy link
Member Author

The fix applied looks to solve the issue on a similar environment, but in the meanwhile, the original server used for this test https://geoportail.lepuyenvelay.fr/geoserver/ows seems to not be printable at all (neither the map and legend).

This looks to be a separate issue and it may require a different investigation/issue @tdipisa

@tdipisa
Copy link
Member

tdipisa commented Mar 8, 2024

The fix applied looks to solve the issue on a similar environment, but in the meanwhile, the original server used for this test https://geoportail.lepuyenvelay.fr/geoserver/ows seems to not be printable at all (neither the map and legend).

This looks to be a separate issue and it may require a different investigation/issue @tdipisa

Maybe @jusabatier can also double check and a new issue, more focused on that scenario, be opened.

@ElenaGallo ElenaGallo removed the BackportNeeded Commits provided for an issue need to be backported to the milestone's stable branch label Mar 11, 2024
@tdipisa
Copy link
Member

tdipisa commented Jun 25, 2024

Reopening due to wrong backport provided for v2024.01.00. Backport PR available at
#10443

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment