Support #3575
closedSupport of URL routing/navigation for RESTful web services
0%
Description
Hi all,
I am investigating the Wt framework for supporting HTTP REST-like web services. The services will not be called by the browser but by a dedicated client.
So far, I've figured out that static web services can be offered with the following idiom:
Wt::WServer server(argv_[0]);
server.addResource(some_http_handler_ptr, "/api/v1/some_resource");
if (server.start()) {
Wt::WServer::waitForShutdown();
server.stop();
}
But, my question is: can I support throwing a bunch of URLs (e.g., a regular expression like "api/v1/some_resource/*") into the same handler? This could be very useful for supporting URL navigation and having http handler hierarchies. What I've only been able to do is having a specific URLs bound to a specific handler.
I've checked the internal path API of Wt, but it seems to be targeted towards browsing a web page with a browser (Wt::WAnchor is a link on a web page) and not the kind of application I am looking at.
Would greatly appreciate it anyone could offer some insight on this.
Thanks,
Periklis
Updated by Koen Deforche over 9 years ago
- Status changed from New to Resolved
- Assignee set to Koen Deforche
Hey,
Yes, Request::pathInfo() will return the details:
For example, when deploying your static resource at "/resource", GET /resource/details/file will arrive at it with a Request::pathInfo() == "/details/file".
Updated by Koen Deforche over 9 years ago
- Status changed from Resolved to Closed