Hello, My opinion on this matter.
2007/10/10, Alberto Ruiz <[EMAIL PROTECTED]>: > > > > 2007/10/10, Rowan Kerr <[EMAIL PROTECTED]>: > > > > On 10-Oct-07, at 12:39 PM, Alberto Ruiz wrote: > > > The problem is that on the first example, we use the request URI to > > > identify wich object do we want to modify, sending a post value to > > > http://localhost:8080/vserver/default/extension/jpeg/directory_root > > > > Let's see if I understand correctly (without looking at the actual > > Cherokee code yet)... > > > > So, /vserver/default/extension/jpeg/directory_root is the key you are > > trying to update? > > > That is the URI, the key would be > !vserver!default!extension!jpeg!directory_root = /tmp > > Or is /vserver/default an instance of Cherokee and /extension/jpeg/ > > directory_root the key? > > > I would encourage you to grab the code and see how is the configuration > format for better understanding. But no, /vserver/default is not an instance > of cherokee, but the default virtual server configuration path. > > > There are config paths that contains slashes, for example: > > > !vserver!default!directory!/admin!... > > > > > > the problem here is that we need to modify the URI because slashes > > > are used to split the URI: > > > http://localhost:8080/vserver/default/directory//admin/ . .. > > > > > I've solved this already using the dollar sign: > > > http://localhost:8080/vserver/default/directory/$admin/... > > > > What is "/admin" in this url... a configuration key? > > > Yes > > Why the extra > > slash, when the /extension/jpeg/directory_root doesn't have double > > slashes? (Excuse my ignorance :) ) > > > I was trying to explain you the problem with the slashes on URI > > You could always url-encode instead of doing custom separators (%2F > > insead of $). > > > Yeah, well, $ is just one char I think it makes it clearer. > > > However, the second approach that alo demonstrates has an > > > advantage, you can send several configuration values using just one > > > request. So I think that we should go for the second approach. > > > > The second approach being posting multiple key=value pairs (one per > > line?) to a single endpoint, right? > > > > Alternatively, why not chose that one specific endpoint to handle > > configuration data, and post XML or JSON data to it? Then you can > > include as many configuration keys & values as you want without > > having to deal with custom encoding. > > > Because that would mean that we should embed a JSON parser on the > server side code. And I would like to avoid that if there are other options > to keep the code as clean and simple as possible. > I think that JSON would be the most appropriate method, the JSON syntax is very simmilar to python syntax. It offers really neat & simple communication between the browser and the server. I can understand your desire to avoid additional dependencies, but I think JSON can even make the code cleaner. Something like... > > > > ----- > > POST /update-configuration HTTP/1.1 > > Content-Length: ## > > Content-Type: application/json > > > > [ > > {key: "extension/jpeg/directory_root", value: "/tmp"}, > > {key: "directory/admin", value: "/"} > > ] > > ----- > > > > > -- > Un saludo, > Alberto Ruiz > _______________________________________________ > Cherokee mailing list > [email protected] > http://cherokee-project.com/cgi-bin/mailman/listinfo/cherokee > >
_______________________________________________ Cherokee mailing list [email protected] http://cherokee-project.com/cgi-bin/mailman/listinfo/cherokee
