Dear Tommi,
I did afford the same dilemma when building LIXA (http://lixa.sourceforge.net/)
and XML seemed to me the best choice, just because there are a lot of tools to
deal with it.
Regards
Ch.F.
-------------------------------------------------------------------
Decent workarounds outperform poor solutions
>________________________________
> Da: Tommi Mäkitalo <[email protected]>
>A: [email protected]
>Inviato: Sabato 14 Aprile 2012 11:08
>Oggetto: Re: [Tntnet-general] Request - tntnet configuration in xml or json?
>
>...
>>> Hi again,
>>>
>>> I just forgot to mention one thing. I saw in your server code this
>>> "std::cerr<< data<< std::endl;". This is strange. As far as I know,
>>> this is not standard. Normally you can't output a std::istringstream to
>>> a std::ostream. I was suprised, that it worked.
>>>
>>> But your question leads me to an idea. What do you (all) think about
>>> extending this url mapping with the method. If you can configure
>>> something like:
>>>
>>> mapUrlGET "^/(.*)$" $1_GET@myapp
>>> mapUrlPOST "^/(.*)$" $1_POST@myapp
>>>
>>> Then you can code a component named "test_GET", which is called with the
>>> url "/test" but only when the method is "GET" and a component
>>> "test_POST", which is called when the method is "POST". You do not have
>>> to dispatch it yourself then.
>>>
>>>
>>> Tommi
>>>
>>>
>> I think it's a great idea :)
>>
>> Jean-Michel
>>
>That leads me to the next idea: What about changing the configuration to
>xml? I'm not sure, if this is really a good idea but I would like to
>hear your comments.
>
>The current format of tntnet.conf has its limitations. It is just a map
>from name to a list of values. Xml would be hierarchical. Most of the
>parameters have no problems with that but some are a little more
>complex. Especially the url mapping. Currently we have "mapUrl" which
>takes a regular expression and a target component as values. Optionally
>followed by a path info and additional arguments. And we have VMapUrl
>which takes additionally a virtual host. If we add mapping specific to
>the method or maybe mapping, which is only valid for ssl or without ssl,
>things gets really complicated when you think about the possible
>combinations (MapUrl, MapUrlSsl, MapUrlNoSsl, MapUrlPost, MapUrlPostSsl
>...). Not really a good solution.
>
>In xml it may be possible to make settings optional. Look at this:
>
><urlmapping>
><mapurl>
><url>^/$</url>
><target>index@myapp</target>
></mapurl>
><mapurl>
><url>^/(.*).html$</url>
><vhost>www.tntnet.org</vhost>
><method>POST</method>
><ssl>true</ssl>
><target>$1_POST@myapp</target>
><pathinfo>$1</pathinfo>
><arguments>
><arg>foo</args>
></arguments>
></mapurl>
></urlmapping>
>
>This would map a request "/" to index@myapp and "/blah.html" to
>blah_POST but only if ssl is enabled, the method is post and the virtual
>host is www.tntnet.org.
>
>It is much more flexible. The downside is, that it is hard to edit and
>read, since xml is hard to edit and read.
>
>The implementation would be quite easy since there is a nice xml
>deserializer in cxxtools.
>
>A alternative is json. We have a json deserializer also in cxxtools. The
>same configuration looks then like that:
>
>{
> "mappings": [
> {
> "url": "^/$",
> "target": "index@myapp"
> },
> {
> "url": "^/(.*).html",
> "method": "POST",
> "target": "$1_POST",
> "ssl": true,
> "vhost": "www.tntnet.org",
> "arguments": [ "foo" ]
> }
> ]
>}
>
>This is easier to read and edit.
>
>Any comments?
>
>Tommi
>
>------------------------------------------------------------------------------
>For Developers, A Lot Can Happen In A Second.
>Boundary is the first to Know...and Tell You.
>Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
>http://p.sf.net/sfu/Boundary-d2dvs2
>_______________________________________________
>Tntnet-general mailing list
>[email protected]
>https://lists.sourceforge.net/lists/listinfo/tntnet-general
>
>
>------------------------------------------------------------------------------
For Developers, A Lot Can Happen In A Second.
Boundary is the first to Know...and Tell You.
Monitor Your Applications in Ultra-Fine Resolution. Try it FREE!
http://p.sf.net/sfu/Boundary-d2dvs2
_______________________________________________
Tntnet-general mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tntnet-general