Can concurrency cause StalePageException in wicket - wicket

We are facing StalePageException very frequently. I tried debugging on locally by adding debug point in getStoredPage() method just before this code and then i tried another request for same flow . The render count is not updated but on production i could see this issue.
Can any one help what is causing this and how can i reproduce .
if (renderCount != null && pageInstance.getRenderCount() != renderCount)
{
throw new StalePageException(pageInstance);
}

StalePageException is usually being thrown when the user opens several browser tabs/windows for the same page instance, for example by copy/pasting the current url from the address bar. Then making some more requests in one of the tabs and then trying to use one of the other tabs.
Wicket makes this check so that the user do not use a stale page instance. Imagine a page that shows the details of some entity. If the user deletes this entity in tab1 then (s)he should not be able to edit the same entity in another tab.

Related

FlowRouter Reload Doesn't Route

I'm using FlowRouter. If I start on the homepage everything works well. I can work through the routes (change the pages) without problem. However, if I hit refresh in the browser, I get a series of errors. My url looks like this:
/story/586d536e34821281735b53a4
The ID is being returned in console under the following method:
Tracker.nonreactive(function(){
I think the subscription is being completed, so I'm a little confused as to why reloading a url is different than loading from the home page.
What am I not understanding here?
Reloading a url will make a HTTP request to server to get all the application source. Whereas navigating to a route from another one does not make any HTTP requests to get the application source because they are already available (they were loaded from the previous route), in this case the router will just get the appropriate content and render on the page. This is normal behaviour for Meteor apps and all other single-page apps
The error you encounter is because your data is not yet available on client, to fix it you could simple use a placeholder if the value is undefined.

RefreshMode.ClientWins or StoreWins

I have a simple windows form application using Entity Framework, and i'm stucked in this situation:
-User opens a windowsform (SearchForm) inside the MDIform, displaying products details and their actual stock qty.
-User opens a second windowsform (POSForm) inside the MDIform (alongside SearchForm), and after selling productos, the stock of that product is updated to the new quantity and saved to the DB, at this moment, the other opened winform (SearchForm) must updates the displayed data with the new data, i'm trying reloading the context, reinstantiating the context, refreshing the form, but the form still shows the same data..
I have an eventhandler in SearchForm, that fires when i call a method RefreshData() from POSForm, and try to refresh the data, but nothing seems to change.
Just after closing that form (SearchForm) and then open it again, the data is displayed correctly.
I don't know how to do a good refresh (i'm using context.Refresh(RefreshMode.StoreWins,entry))
I would guess you have a screen refresh / datasource refresh issue not an EF issue.
Write debug code to dump Context content to be sure.

Drupal 7 some non-existing URLs are not Redirecting to 404?

In Drupal 7, some of (non-existing) URLs are not redirecting to 404 or any error page it should. Instead, it still remains showing its Top Parent Folder. For example like:
www.mywebsite.com/items/aaaaaaaaaaaaa
www.mywebsite.com/items/bbbbbbbbbbbbbbbbbb
Every WRONG URLs under /items/ i put like above, are showing the Page of its parent:
www.mywebsite.com/items instead of get redirected to 404
I don't want its parent to be shown if there is no page really.
But the strange thing is, it is NOT happening on every patterns. I mean, another different parents like:
www.mywebsite.com/users/aaaaaaaaaaaaa
www.mywebsite.com/users/bbbbbbbbbbbbbbbbb
For the wrong url typed-in under this /users/ parent path, it is CORRECTLY redirecting to the 404 page.
What is it please?
If I understand your question correctly, it's not a problem at all.
That's because how your/contributed/core modules hooks Drupal menu system.
If a menu item (menu router item to be specific. Think about a path like "admin/config/development/performance") has no "%" sign in it, menu callback function will be executed.
For an example, if a module registers "items" path example.com/items path would not be a 404, and the appropriate menu callback function of the menu item will be fired. That callback function can make use of further URL parts (example.com/items/123) if given.
'node' is a good example. (technically they are different menu router items though) .
Opening example.com/node will not fire a 404.
If a module registers 'items/%' , then, example.com/items will fire a 404. In other words, the second URL part is required in order to execute the menu callback function.
If the problem you are facing is related to a custom module, make sure you register the correct version of your router items. If the second URL part is required, register items/%.
You can execute a 404 by calling drupal_not_found().
Look at this, really helpfull
http://peterpetrik.com/blog/2009/11/non-existent-urls-views-2
Are you using Views for that path (/items)?
Here is an issue for Views: Prevent duplicate content (because Views returns 200 instead of 400 404)
You could create a Contextual filter to prevent this.
merlinofchaos wrote:
If you don't want this behavior, add the Global: NULL argument to Views and use the setting to validate that the argument is empty.
For Drupal 6, the module Views 404 might help.
You can configure your drupal installation to redirect to a specefic 404 page that you create..
Go to www.yoursite.com/admin/config/system/site-information and enter your 404 page .

Zend AjaxContext, _redirect and hash navigation

first post in SO, even though I've been browsing it for years now to solve those mind-blowing and not so much coding problems.
What I want to do is:
* Use hash navigation (#!/).
* Use Zend controller actions, not php files.
* Load these actions through javascript/jQuery.
So far, I've got this working:
indexController, several Actions, each attached to AjaxContext via addActionContext(), I can call them though my javascript/jQuery file via "hashchange" plugin jQuery(window).hashchange(function(){ bla bla }). I can cycle through actions just fine.
But I want to redirect the user to a login page if he/she is not logged in, which brings me to my issue: How can I achieve that? The redirection is made to another controller (login controller, login action). I was trying something like $this->_redirect('/#!/login/login'); w/o any luck (yes, I've set up an AjaxContext in that controller's init). I keep getting a redirection error ("The page isn't redirecting properly"). If I just type in the address bar "/#!/login/login" I get everything display properly.
Anyway, thanks in advance!
Cheers
Now this starts to get complicated if you ever introduce other non-ajax contexts, but you could add the Ajax context to the Error Controller. Then have the error controller return JSON for the unauthenticated exception if the active context was AJAX (and keep the redirect if the default context was active). Your JS would then listen for that specific error provided by the JSON and manually bounce the user to the appropriate login URL.

zend_auth causing application to error

i have been following some online screencasts and tutorials about zend_auth.
i have a basic zend application created by the zf tool.
within the index controller index action i place a little code to test if a user is authenticated.
if(!Zend_Auth::getInstance()->hasIdentity())
{
$this->_redirect('login');
}
now as far as i'm aware this should check to see if the current session has been authorised with an identity if it hasnt (ie returns false)
it will redirect the screen to the login controller index action.
all i get is the default error action page stating
An error occurred
Application error
does anyone have an idea wtf is going on.
i have a suspicion it has something to do with needing to set up an autoloader but i have already set an include path to the library folder . (plus i have no issues with accessing controller actions and the likes.
i had another issue with a form stopping my application from rendering anything but i will create another question about that.
thanks keyne setting the error reporting on was a good idea
for some reason i thought i had my app sent to development but it was production.
after looking at the error report i found i had forgotten to create a data folder on my test server to hold the session information.
so zend_auth creating a session failed to location the directory.