Re: [Cppcms-users] Issues with resubmitting context in v1.2
Brought to you by:
artyom-beilis
|
From: CN <cn...@fa...> - 2016-06-21 09:47:42
|
On Sun, Jun 19, 2016, at 01:57 PM, Artyom Beilis wrote:
> 1st of all sorry for delayed reply - was offline for a while.
I am very happy to know that you are back online, and much appreciate
your kind helps!
>
> Regarding your error - you had probably missed the concept of filter.
> Filter works BEFORE the data was uploaded processed.
> So you can do some stuff on the fly instead of downloading big content
> and discoverting an issue.
>
> You need to check if request().is_ready() and only than you can use
> it/forward it.
I understood its usage (finally). It was just because I somehow posted
the wrong redacted sample program again (due to long-hour working?)!
> Also JSON-RPC class does not support filer handling it is also not
> really needed.
Many thanks for the explanation!
I am attaching new sample program. Hopefully it is the correct version I
intend to use to illustrate my remaining question:
Why
part2::main(std::string url)
gets string "up2/abc" instead of "abc"?
It appears that regex group catching mechanism
cppcms::mount_point("/up2/(.+)",1)
is not invoked.
Best Regards,
CN
----------
int main(int argc,char ** argv)
{
cppcms::service sv(argc,argv);
booster::shared_ptr<cppcms::application_specific_pool>
p2=cppcms::create_pool<part2>();
sv.applications_pool().mount(p2,cppcms::mount_point("/up2/(.+)",1),cppcms::app::synchronous);
booster::weak_ptr<cppcms::application_specific_pool> p_p2(p2);
sv.applications_pool().mount(cppcms::create_pool<part1>(p_p2),cppcms::mount_point("/up1",1),cppcms::app::asynchronous
| cppcms::app::content_filter);
...
}
class part2 : public cppcms::application
{
private:
void part2::main(std::string url)
{
//QESTION: Why "up2/abc" instead of "abc" is logged?
BOOSTER_DEBUG("url") << url;
}
public:
part2(cppcms::service &s)
: cppcms::application(s){}
};
class part1 : public cppcms::application
{
private:
booster::weak_ptr<cppcms::application_specific_pool>
app_specific_pool;
void main(std::string url)
{
if(!request().is_ready()){
//Do some pre-verification.
}
else{
booster::shared_ptr<cppcms::application_specific_pool>
pool=app_specific_pool.lock();
if(pool){
booster::shared_ptr<cppcms::http::context>
ctx=release_context();
ctx->submit_to_pool(pool,"up2/abc");
}
}
}
public:
part1(cppcms::service
&s,booster::weak_ptr<cppcms::application_specific_pool>
app_specific_pool)
: cppcms::application(s){}
};
--
http://www.fastmail.com - A no graphics, no pop-ups email service
|