is it possible to upload a Map to Apache ISIS' restful interface? I have following interface where I want to upload to:
public SendMessageResponse send(
@ParameterLayout(named = "dummyParam1") @Parameter(optionality = Optionality.MANDATORY) String dummyParam1,
@ParameterLayout(named = "dummyParam2") @Parameter(optionality = Optionality.MANDATORY) String dummyParam2,
@ParameterLayout(named = "dummyMap1") @Parameter(optionality = Optionality.OPTIONAL) Map<String, String> dummyMap1)
{ ... }
dummyMap1
is the parameter I want to upload. In Java this is my try to convert a JavaMap to a JSON String:
Map<String, String> dummyMap1Up = new HashMap<String, String>();
dummyMap1Up.put("Test123", "123");
dummyMap1Up.put("Test456", "456");
JSONObject json = new JSONObject();
json.put("dummyParam1", "someString");
json.put("dummyParam2", "someOtherString");
json.put("dummyMap1", dummyMap1Up);
But when I want to upload this JSON all parameters are good, except the Map. I get a 422 Unprocessable Entity
status and the following error: Expected a link (because this object's type is not a value) but found no 'href'"
.
I tried to figure out how a Map is build in JSON in Apache ISIS. I tried to get a map from an Apache ISIS response, but the only thing I get is the notice that it is disabled because "disabledReason" : "Non-cloneable view models are read-only"
.
So my question is now: is it possible to upload a JavaMap to Apache ISIS using JSON representation, or is it impossible? When it is impossible to do so, is there any other good solution to upload the Map parts separately or someting like that?
Cheers and thanks for your answers!