Bug #2527
Setting internalPath from internalPathChanged() slot
0%
Description
Hi,
When a user manually enters a new internal path from the browser and when a slot of internalPathChanged() sets the internalPath, Wt::WApplication is updated with the new internalPath however the browser still shows the URL entered manually.
I tried with these settings
<tracking>Auto</tracking> <reload-is-new-session>false</reload-is-new-session>
Files
Updated by Koen Deforche over 9 years ago
- Status changed from New to InProgress
- Assignee set to Koen Deforche
Updated by Koen Deforche over 9 years ago
- File SetPath.cpp SetPath.cpp added
- Status changed from InProgress to Feedback
Hey,
I fail to reproduce this, possibly because I do not really understand your description. See attached a test case; how would you modify it or exercise it to reproduce the problem?
Regards,
koen
Updated by Saif Rehman almost 9 years ago
Sorry, I forgot about this report. Here's the changed file.
To reproduce the problem.
- Make sure reloading/changing URL manually from browser won't start a new session
- Open the page from browser
- Manually change the internal path from the browser to /hatter/
The internal path will stay the same on the browser, yet the handlePathChanged slot function will remove '/hatter' from 'internalPath_'.
If you use the button 'click to find hatter', the '/hatter' would be properly removed from both, server and client.
#include <Wt/WApplication> #include <Wt/WContainerWidget> #include <Wt/WPushButton> #include <Wt/WText> using namespace Wt; class MyApp : public WApplication { public: MyApp(const WEnvironment& env) : WApplication(env) { WPushButton* button = new WPushButton( "click to see alice", root() ); button->clicked().connect( this, &MyApp::changePath ); WPushButton* button2 = new WPushButton( "click to find hatter", root() ); button2->clicked().connect( this, &MyApp::changeToWrongPage ); internalPathChanged().connect( this, &MyApp::handlePathChange ); std::cout << "init: "; handlePathChange(internalPath()); } void changePath() { setInternalPath( "/alice/", true ); } void changeToWrongPage() { setInternalPath( "/hatter/", true ); } void handlePathChange( std::string path ) { std::cout << "handlePathChange " << path << std::endl; //Remove /hatter from the internal path IF the internal path has /hatter in it if(path.find("/hatter") != std::string::npos) { setInternalPath(std::string(path).replace(path.find("/hatter"), 7, ""), false); } new WText( path, root() ); new WBreak( root() ); } }; WApplication *createMyApplication(const WEnvironment& env) { return new MyApp(env); } int main(int argc, char **argv) { return WRun(argc, argv, &createMyApplication); }
Updated by Koen Deforche almost 9 years ago
- Status changed from Feedback to Resolved
- Target version set to 3.3.4
Hey,
A fix is in git.
Koen