Apache Wicket: Communicate between independent pages of same application - wicket

On my wicket page I have a link that opens a second page in another tab/new window.
Click here for second window
These windows are meant to be used in parallel (e.g. in a two-monitor-environment). But I don't want to spread out different menu entries over both screens, so I want all menu entries to stay on MyFirstPage, even if they should influence MySecondPage only.
My ultimate goal is to click a menu entry on MyFirstPage that results in displaying a new Component on MySecondPage. Is this even possible? How can I obtain a java-reference of MySecondPage inside MyFirstPage or establish some other sort of communication?
Everything I found while researching only applied to modal windows or Wicket 1.4, but MySecondPage is not modal.

Maybe wicket's event bus is an option, see: http://code.google.com/p/wicket-guide/downloads/list - Chapter 15.3 Wicket events infrastructure
You could send the event in MyFirstPage , receive it in your Session or Application and there send it to MySecondPage. Session and Application implement IEventSink: http://ci.apache.org/projects/wicket/apidocs/6.x/org/apache/wicket/event/IEventSink.html

There is WebSocket support in Wicket 6:
http://wicketinaction.com/2012/07/wicket-6-native-websockets/
Basically you need to add WebSocketBehavior to the page to make it available for messages from the server.
On the other hand, you can send messages to the server via Wicket.WebSocket.send("A message sent by the client");
I have never tired it but it sounds very promising.

Related

Using NeoLoad to test ZK application

I am trying to use NeoLoad 5.2 to record test scenario for ZK application.
Unfortunately, it looks like some operations are not recorded. For example:
Login and password of the login form are not shown among requests
Population of combo boxes is not shown
I prepared ZK app to generate repeatable components and desktops ids.
Does somebody has such experience? Should I configure NeoLoad or ZK application in some special way to record all the data exchange which happens?
We had a similar issue that the recording did not have any source (empty body). Luckily the play back did have returned code which we used for correlation and validation. Does seem to be a bug in the toolset but we bypassed the issue.

call c function in running app from web service

I have a web server running on a RaspberryPI. The web server is supposed to provide an interface to a program that deals with a connected 3D printing hardware.
How can I create an element on the web page, that triggers via the web server a function inside an already running C program?
More details:
The printer management app is written in C/C++ and runs all the time, providing a few buttons on a touch screen. The web interface will provide an upload button for printing files, a few status informations, and a start/pause/stop button.
I know a lot about C/C++ and the Unix RPC or named-pipe API. However, I know little about HTML and all the associates ways of scripting and communicationg with the web server.
What is the best approach to implement the start/stop button on the web page, so that a function inside my printer controller is triggered, and secondly, how can I get data back from the printer controller onto the web page?
Thanks!

GWT upload - Uploading single file twice

I am currently working on a GWT screen which has a requirement of browsing GWT file once but submitting it to server many times.
But in GWT upload after clicking on submit. or even submitting using singleUploader.submit() method. File browsed by FileInputType get cleared.
Can you suggest any method to upload single file many times using gwt-upload?
Not sure if it is possible. I would try to use https://developer.mozilla.org/en/docs/Web/API/XMLHttpRequest/Using_XMLHttpRequest
and would create (using native javascript) two instances of XmlHttpRequest and would try to send them both.
The anticipated problem here is that input element on the page would receive incoming events as a result of the upload process (loadstart, progress, etc). I am in doubt that it can properly handle two parallel flows of those events successfully.
Another way is to try to send the upload requests consequently, but then you will have to generate second form submit. Which is not trivial, and browsers do not support that on the high level.

A way to control a web page with external link without reload

We have a GWT based thick client like web application. The application is considerably large and has some initial load time.
We would like to send the users of our application e-mail messages with href links that would open up a specific asset in our application. Well this of course has the effect that clicking the link opens up the application again, reloads it which we would like to avoid. Ideally we would like the href link to just signal our application/web page somehow so that we could pick up the event in our application and react to it.
Any ideas how we should approach this or is this even possible ?
Thanks!
You need to use a GWT Hyperlink which is a widget that serves as an "internal" hyperlink. That is, it is a link to another state of the running application. When clicked, it will create a new history frame using History.newItem(java.lang.String), but without reloading the page.
If you are not already using it, information is here on GWT's History mechanism
There seems not to be any elegant solution to send an event from a link to an existing browser window. Few solutions I have encountered this far:
a) Implement a cookie polling solution for the application to poll if a cookie exists or changes. The link points to our server which just sets the cookie and this way informs the running app about the event. Some tricky handling should be implemented with some kind of 2-way protocol between the returned temporary page from server to handle the situation where the application is not (yet) running.
b) The same approach as in solution a) but use html5 local storage for communication. This way the poller is not needed as the local storage fires an event when content changes. This would be a possible solution but is not for me as we have to support older browsers without local storage support.
c) A long polling ajax or a web socket for delivering events from the server to the client. A solution but seems overkill and might require a modern browser for atleast web sockets.

GWT event servise browsers synchronization problem

I have implemented pretty simple application, using gwt and gwt event service 1.1.1, it sends some information to the server and waits for particular event to come back.
When application is opened in one browser window, it works fine.
When it is opened in two browser windows (the same browser and the same address: localhost:port/app or ip:port/app) on one machine, only one instance of my application receives event (UI reflects changes only in one window).
When it is opened in two different browsers, but with the same addresses (for instance, both are localhost:port/app), then both browsers receive events.
When it is opened in two windows of the same browser, but with different addresses (one is localhost:port/app, second is ip:port/app), then it also receives events.
So, could somebody provide any explanation to such behavior? And if is there some kind of workaround for this problem.
Thanks in advance,
Alex.
You are using gwt event service on the server, right?
They claim to have "Only one open connection for event listening". So they actively check that one client has only one connection for sending events. They probably use web sessions to achieve this.
Since you open the same URL in the same browses in two tabs, this two tabs share the same session. There is no way around it. There are a lot of questions about this: https://stackoverflow.com/search?q=browser+tabs+session
Update:
It seems that gwt-event-service can be configured to support multiple sessions: use SessionExtendedConnectionIdGenerator
Update 2:
Use a config file like this: http://code.google.com/p/gwteventservice/source/browse/trunk/conf/eventservice.properties?r=265