Project

General

Profile

Actions

Support #1913

closed

Help with static resources

Added by Vitaly Volochay almost 11 years ago. Updated about 9 years ago.

Status:
Closed
Priority:
High
Assignee:
Target version:
-
Start date:
05/21/2013
Due date:
% Done:

0%

Estimated time:

Description

I want to make application which will load plugins dynamically and add them to main menu (WMenu*) to some internal path (/plugin1, plugin2 ...). I also want each plugin to process internal http-requests to it's internal path, so I have to inherit WResource for each plugin and reimplement WResource::handleRequest() and add it as a static resource using WServer::addResource. The problem is I want to add resources after creating it in interface in my WApplication class. But when new session creates it tries to add static resource which is allready added and throws exception. If I add resources before starting server in main it works but logically it's to early to process request. Can you give me some advice how to do it better?

Another question: is it ok if I inherit my resource from QObject also (not only WResource) and move it to QThread? Will it works correctly and process requests in separate thread?

I'm using Wt 3.2.3 currently.

Actions #1

Updated by Koen Deforche almost 11 years ago

  • Status changed from New to Feedback
  • Assignee set to Koen Deforche

Hey,

From your description, I don't think you need to consider resources. You should investigate the internal path API --- you can perfectly implement a plugin infrastructure where each plugin handles its own internal path events, by listening to WApplication::internalPathChanged() and checking whether it's something that they consider to be responsible for.

QThread is an entirely different concept from Wt's thread pool. There should not be a benefit from QThread either --- you still want to protect access to a session using a lock, and Wt already does that while scheduling things inside a thread pool (which is smarter than tying threads to sessions or tasks).

Regards,

koen

Actions #2

Updated by Vitaly Volochay almost 11 years ago

I want to process not only internal path changed but external http requests.

For example: curl -X DELETE http://localhost:port/root/objects?id=5

This should be process by static resource with static url 'http://localhost:port/root/objects'.

Actions #3

Updated by Koen Deforche almost 11 years ago

Hey,

You really need to provision different URLs for 'application' paths (that render as HTML) and web service paths (that provide the 'REST' like interface).

Regards,

koen

Actions #4

Updated by Koen Deforche about 9 years ago

  • Status changed from Feedback to Closed
Actions

Also available in: Atom PDF