lvillani's picture

Is it possible to bind URI patterns to WebServices when using pion::net::WebServer class?

for example bind: /foo/(.*) to a pion::net::WebService instance

Since I needed this for a project (which is kwebforms, a KDE application under development for Kexi) and didn't look deeply at what pion supports I wrote a class extending pion::net::WebServer (which inherits from pion::net::HTTPServer).

But in order to do that I had to add virtual to the signature of bool HTTPServer::findRequestHandler and change

typedef std::map ResourceMap;
ResourceMap m_resources;
mutable boost::mutex m_resource_mutex;

visibility from private to protected.

These changes most likely will break the ABI.
If you want I can publish a small patch file and the sources of the extended class.
Don't know if you are interested in my patches and/or my changes are well-designed, I just hope they're useful :-)

Mike Dickey's picture
Great

Note that "resources" bound to services in the network library don't require an exact match, but rather a "root path" match. So,

/foo/bar

will trigger the service that is bound to the resource "/foo"

Submitted by Mike Dickey on Tue, 07/08/2008 - 12:36.
lvillani's picture
Yep, I noticed that, that's

Yep, I noticed that, that's why I dropped all my custom-code ;-)

Submitted by lvillani on Thu, 07/10/2008 - 07:48.
lvillani's picture
I found a way to do the same

I found a way to do the same thing without altering core pion-net code :)

Submitted by lvillani on Tue, 07/08/2008 - 01:30.