planetfederal / geoserver-exts

Other
31 stars 40 forks source link

Importer rest API Create import ContentType: application/json does not support charset #104

Open mathieulavallee opened 8 years ago

mathieulavallee commented 8 years ago

Hi, I am using the importer plugins rest API to add new geodata to geoserver.

According to The documentation: When I create a new import using a POST on URL geoserver/rest/imports/ with a content-Type like

Content-Type : application/json

I specify my import workspace like so

{"import":{
    "targetWorkspace":{"workspace":{"name":"my_work_space"}}
    }
}

and the return the confirmation of the workspace like so

{
"import": {
...
    "targetWorkspace": {
      "workspace": {
        "name": "my_work_space"
      }
    },
}
}

I found a bug when using the Java apache HTTPClient and setting Content type to the preDefined _ContentType.APPLICATIONJSON which set the content type to "application/json; charset=UTF-8". When I use the predefined contentType, I get no targetWorkspace confirmation and the import use the default workspace.

I did not look at the code, but I am suspecting a code that look specificaly for "application/json" since even adding ";" like application/json; does not work.

I also suspect other function to fail supporting charset.

here is the rfc for Content-type https://www.w3.org/Protocols/rfc1341/4_Content-Type.html https://www.w3.org/International/articles/http-charset/