Hey Koen,
On Tue, Mar 9, 2010 at 5:16 PM, Koen Deforche <[email protected]> wrote:
> Hey Maurice,
>
> 2010/3/3 Koen Deforche <[email protected]>:
> > Hey Maurice,
> >
> > 2010/3/3 Maurice Gittens <[email protected]>:
> >> Hi,
> >>
> >> I'd like to use the Witty Application Server to serve not only a Witty
> >> Application
> >> but also to serve JSON data as a restful data service.
> >>
> >> Consequently I will need to handle HTTP POST, DELETE and PUT methods
> >> in the My Wt application server.
> >>
> >> I would like to allow users logged in via a valid Wt session access to
> my
> >> Restful Json data stores.
> >> What is the recommended way to do this with Wt?
> >
> > Currently, you can already GET and POST to a WResource. Providing
> > support for DELETE and PUT is a logical extension. You can also
> > already access the raw input stream (that was POST'ed or PUT) when it
> > is not something that can be parsed by the CGI Parser from
> > Http::Request::in().
> >
> > The missing parts are:
> > - provide support for DELETE and PUT commands in the httpd and check
> > that it works for the fastcgi connector.
> > - expose information on the command in Http::Request (GET, POST,
> > DELETE or PUT).
>
> I've implemented this now and so expect this in public git sometime next
> week.
>
> > Currently a WResource will have a random (auto-generated) URL. You
> > probably want a predictable URL for your service, and this would also
> > require a small extension to WResource (setInternalPath()) together
> > with support in our web controller.
>
> I've implemented this as well. Note that there will still be a session
> appended to the path.
>
>
Thank you for implementing this functionality.
I decided to give it a test today and there were two things I encountered
that I
wanted to share.
1. I was surprised to find that there exists no method called:
void WApplication::addResource(WResource *resource, const std::string&
path);
Since one creates a session independent resource
using void WServer::addResource(WResource *resource, const std::string&
path)
do not the principles of good design dictate that session specific resources
be created
using void WApplication::addResource(WResource *resource, const std::string&
path) ?
Is not this interface design a direct consequence of the fact that currently
WServer holds
the session independent stuff while WApplication carries the session
dependent stuff?
2. How do I create session specific resource?
By reading the code I discovered:
WApplication::addExposedResource(WResource *resource, const std::string&
internalPath)
however this function is private;
Grepping for this function told me that WResource::setInternalPath is the
function I think I need to
call to have a session specific resource.
However calling setInternalPath from the initialize method of my
WApplication as in:
void myApplication::initialize()
{
myResource = new MyResource(0, "test-page");
myResource->setInternalPath("/test.html");
}
gives me a page not found (HTTP 404 error:).
Does anyone care to show me my mistake?
Thanks.
Cheers,
Maurice
> Regards,
> koen
>
>
> ------------------------------------------------------------------------------
> Download Intel® Parallel Studio Eval
> Try the new software tools for yourself. Speed compiling, find bugs
> proactively, and fine-tune applications for parallel performance.
> See why Intel Parallel Studio got high marks during beta.
> http://p.sf.net/sfu/intel-sw-dev
> _______________________________________________
> witty-interest mailing list
> [email protected]
> https://lists.sourceforge.net/lists/listinfo/witty-interest
>
------------------------------------------------------------------------------
Download Intel® Parallel Studio Eval
Try the new software tools for yourself. Speed compiling, find bugs
proactively, and fine-tune applications for parallel performance.
See why Intel Parallel Studio got high marks during beta.
http://p.sf.net/sfu/intel-sw-dev
_______________________________________________
witty-interest mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/witty-interest