Hey all,
I found a bug. Please, see attachment.
--
// Dmitry.
// -*- C++ -*-
//
// (C) 2013 Dmitry Igrishin
//
// Bug report.
// Description: something wrong with browser history handling.
// How to reproduce:
// 1) Open URL: host/ui/path1
// (creates a new session and set internal path to /path1 as expected)
// 2) Click "path2" anchor
// (changes internal path to /path2 as expected)
// 3) Change URL in the address bar to host/ui/path3
// (creates a new session and set internal path to /path3 as expected)
// 4) Click "Back" browser's button
// (creates a new session and set internal path to /path2 as expected)
// 5) Click "Back" browser's button
// (OOPS, compare URL in the address bar with "Current internal path"
// output string -- URL is host/ui/path1, but "Current internal path" is
// "/path2")
// Remarks:
// 1) Initially, host/ui/path1 (not just host/ui) should be opened!
// BTW (another question):
// Just curious, is there way to avoid creation of the new session at step 4)?
#include <Wt/WAnchor>
#include <Wt/WApplication>
#include <Wt/WBreak>
#include <Wt/WServer>
#include <Wt/WText>
using namespace Wt;
namespace {
class App : public WApplication
{
public:
App(const WEnvironment& env);
private:
void
handle_ipc();
WText* current_path_;
WText* current_session_;
};
App::App(const WEnvironment& env)
: WApplication(env)
{
// Anchors.
WLink lnk;
lnk.setInternalPath("/path1");
root()->addWidget(new WAnchor(lnk, "path1"));
lnk.setInternalPath("/path2");
root()->addWidget(new WBreak);
root()->addWidget(new WAnchor(lnk, "path2"));
lnk.setInternalPath("/path3");
root()->addWidget(new WBreak);
root()->addWidget(new WAnchor(lnk, "path3"));
// Status.
root()->addWidget(new WBreak);
root()->addWidget(new WBreak);
root()->addWidget(new WText("Current internal path: "));
root()->addWidget(current_path_ = new WText);
root()->addWidget(new WBreak);
root()->addWidget(new WText("Current session ID: "));
root()->addWidget(current_session_ = new WText);
// Handlers.
internalPathChanged().connect(this, &App::handle_ipc);
handle_ipc();
}
void
App::handle_ipc()
{
current_path_->setText(internalPath());
current_session_->setText(sessionId());
}
Wt::WApplication*
create_app(const WEnvironment& env)
{
return new App(env);
}
} // namespace
int
main(int argc, char* argv[])
{
WServer srv(argv[0]);
srv.setServerConfiguration(argc, argv, WTHTTP_CONFIGURATION);
srv.addEntryPoint(Application, &create_app, "/ui");
if (srv.start()) {
WServer::waitForShutdown(argv[0]);
srv.stop();
} else
return 1;
return 0;
}
------------------------------------------------------------------------------
Rapidly troubleshoot problems before they affect your business. Most IT
organizations don't have a clear picture of how application performance
affects their revenue. With AppDynamics, you get 100% visibility into your
Java,.NET, & PHP application. Start your 15-day FREE TRIAL of AppDynamics Pro!
http://pubads.g.doubleclick.net/gampad/clk?id=84349831&iu=/4140/ostg.clktrk
_______________________________________________
witty-interest mailing list
witty-interest@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/witty-interest