I am currently using Wicket version 6.20. Within a Wicket page, I have implemented an AbstractDefaultAjaxBehavior to capture mouse clicks and their x,y coordinates:
class CallFromJavaScript extends AbstractDefaultAjaxBehavior {
private static final long serialVersionUID = -123956851227148114L;
@Override
public void renderHead(Component component, IHeaderResponse response) {
super.renderHead(component, response);
String callbackUrl = getCallbackUrl().toString();
String javaScript = "$(document).ready(function()"
+ "{$(document).click(function(e) {"
+ "Wicket.Ajax.get({ u: '" + callbackUrl
+ "&x='+e.clientX+'&y='+e.clientY});});});";
response.render(OnDomReadyHeaderItem.forScript(javaScript));
}
@Override
protected void respond(final AjaxRequestTarget target) {
Request request = RequestCycle.get().getRequest();
x = Integer.parseInt(request.getRequestParameters()
.getParameterValue("x").toString());
y = Integer.parseInt(request.getRequestParameters()
.getParameterValue("y").toString());
//more code....
}
}
}
When I open the same page with one user (one session), everything functions correctly. However, when I open the page with a different user (separate session or computer), I encounter a StalepageException:
RequestCycleExtra/qtp848034544-122 - /wicket/wicket/page?2-.... WARN : - Handling the following exception org.apache.wicket.core.request.mapper.StalePageException: null
I have observed that when I click with computer A on the page, the java code enters the renderHead method. When I click with computer B, java again enters the renderHead method. This pattern alternates with each click between the two computers.
If I limit the page to only be opened with one computer (one session), the java code enters the renderHead method only once.
Any assistance would be greatly appreciated.