Using URIHandler to receive HTTP Requests and update UI

Hello everyone!

I’m using an URIHandler to receive some http requests from the outside world of my Application and would like to update the UI of my Applcation, when these request are received. A ProgressIndicator is being added to the window, so it should be automatically updated. This isn’t working though.

I declared my URIHandler as folows:

public class ExternalURIHandler extends ObservedHandler implements URIHandler, ParameterHandler {

    public void handleParameters(Map<String, String[]> parameters) {

    public DownloadStream handleURI(URL context, String relativeUri) {

        if (relativeUri != null && !relativeUri.isEmpty()) {
            final StringBuffer sb = new StringBuffer();
            if (URI_SUCCESS.equals(relativeUri)) {

            } else if (URI_ERROR.equals(relativeUri)) {
            } else if (URI_CALLBACK.equals(relativeUri)) {
                sb.append("<p>Billing Notification received.</p>");
                LOG.debug("Billing Notification received.");
                updateAfterCallback(); // here the application UI should be updated
            ByteArrayInputStream istream = new ByteArrayInputStream(sb.toString().getBytes());
            return new DownloadStream(istream, "text/html", "redirect");
        } else {
            return null;

In my UI class, which is an Window, i declared the method updateAfterCallback() and added a Progress Indicator for automatic updates as follows:

    public void init() {

    public void updateAfterCallback() {
        WMPayCustomerUI window = (WMPayCustomerUI) getApplication().getMainWindow().getChildWindows().iterator().next();
        window.getBrowserPanel().addComponent(new Label("Billing Notification successfully received."));
        LOG.debug("UpdateAfterCallBack called.");

    private ProgressIndicator getProgressIndicator() {
        if (progressIndicator == null) {
            progressIndicator = new ProgressIndicator(new Float(0.0));
        return progressIndicator;

When the respective request comes in, the log output can be read as “DEBUG WMPayCustomerUI - UpdateAfterCallBack called.”, but the UI is not being updated. Can someone tell me what I am doing wrong.

Just to make sure. Is the progress indicator visible on the window you are trying to update?

Who is firing the other HTTP requests ? If you have a user sitting in front of a browser, and some other process elsewhere is firing HTTP requests at the Web Server, there is no connection between the sessions (there will be different instances of Application, and there will be no updates in the UI). If that is indeed your situation, you will need to use something like a BlackBoard or EventBus to make your HTTP events notify the various interested UIs.

Hi! Thanks for your reply!
Yes it is. I’ve already noticed, that the updates can only be made when the ProgressIndicator is visible :wink:
Any Idea?

Hello Jean-François,

Thanks a lot for your answer! :grin:
In my case there is another process firing requests, actually a billing confirmation, as the user sits in front of the web browser.
You are totally right. I will have to use a Blackboard.

I am really grateful for your help! :slight_smile: