Project

General

Profile

Custom response / mime type

Added by Dave Hite over 14 years ago

Hello,

I'm trying to get into Wt and am wondering if anyone has done any custom response-type or mime-type with Wt?

For example, I would like to generate kml (GoogleEarth file) if someone requests myapp/url/function.kml and I would like to generate html if someone requests the same function myapp/url/function.html for a different type (or, xml, plain text, csv, rss, etc...)

In Ruby Rails I can specify the content-type or have it automatically respond with a template. http://guides.rubyonrails.org/layouts_and_rendering.html

This allows a nice separation of the data "model" from the rendering "view"

This post http://redmine.webtoolkit.eu/boards/1/topics/5 seems to imply that I should create a specialization of WResource?

Wt seems to have support for rendering different views, xhtml, ajax, etc.

Any ideas?

Thanks,

Dave


Replies (1)

RE: Custom response / mime type - Added by Wim Dumon over 14 years ago

This is done with a WResource (or one of its subclasses). You can either use it within the context of a session, or as a global resource, accessible by anyone, by registering your resource to a WServer.

Wim.

    (1-1/1)