Project

General

Profile

Actions

Support #3575

closed
KD

Support of URL routing/navigation for RESTful web services

Support #3575: Support of URL routing/navigation for RESTful web services

Added by Anonymous about 12 years ago. Updated almost 12 years ago.

Status:
Closed
Priority:
Normal
Assignee:
Target version:
-
Start date:
09/11/2014
Due date:
% Done:

0%

Estimated time:

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

KD Updated by Koen Deforche almost 12 years ago Actions #1

  • 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".

KD Updated by Koen Deforche almost 12 years ago Actions #2

  • Status changed from Resolved to Closed
Actions

Also available in: PDF Atom