I have made a jQuery based widget which is configured a bit like this:
jQuery("#foo").widget("service", {
output : "test_output_field",
parameters : {'format' : 'json',
'limit' : 20,
'services' : {'service1' : {},
'service2' : {'language' : 'en', 'type' : 'solid', 'parent' : 'father'},
'service3' : {'type' : 'big', 'strict' : 'true', 'filter' : 'all' }
}
}
});
The parameters like 'format' and 'limit' are easy to handle; I just put them in the query string.
The services configuration part is the problem. Only thing that is constant is that there is an arbitrary number of services (here 'service1-3') with varying amount of parameters (specific to a certain service).
I have tried to configure them in a JSON string, but the parsers that are available for Java are horrible at best. I could parse the configuration to url parameters (like &service2_language=en), but the url could grow too long to handle.
What would you do?