Vaadin with Porlet 2.0 in Websphere Portal Server 6.1

Hello everyone,

first of all, I am really impressed with what you’ve created! I implemented your samples one after another just in one day and was really impressed with how easily you can make RIA’s with plain Java code.

Now I am testing Vaadin on Websphere Portal 6.1 and have run into some difficulties.

Firstly, the “Portlet 1.0” way works as it should and I think even this should be enough to cover most of the normal use cases.

Now, there seems to be a problem with Porlet 2.0 implementation, “officially” offered only for Liferay but theoretically should be working on WPS too.

Somehow it doesn’t… I have spent quite a few hours investigating into it. The first problem - inability to load static resources from /html/VAADIN/… which btw WPS doesn’t support the way Liferay does anyhow - I solved by overriding the method getStaticFilesLocation(…) and returning a value that works.
But now I got another problem which seems far more complicated. “UIDL cannot be read from server - Error 400”. It seems like the AJAX requests from the client are not reaching the portlet. Current Vaadin Portlet 2.0 implementation seems to have problems here, specifically with the encoded URLs which is normal in WPS and probably not in Liferay.

Has anyone got Vaadin working in WPS with Portlet 2.0? Maybe I did something completely wrong here… If yes, I wonder why there no other posts about this here.

Any help is appreciated.

Hi Yury,

The base problem here is that the portlet cannot offer static resources using a given url (e.g. /VAADIN/theme/reindeer/styles.css). Therefore the static files need to be deployed to the portal. In Liferay this is deployed in the /html/ directory. Where should you deploy static resources in WPS and what is the url one should use?

The Vaadin portlet generates an url that is used for the UIDL communication according to portlet 2.0 specs so this should not be a problem. It could however be the same problem as with Jetspeed 2 that the client side incorrectly uses ? or & to add parameters to the generated url (see http://dev.vaadin.com/ticket/5911). Could you check this with e.g. Firebug? After the initial load there should be a POST request to a generated url, probably with “?repaintAll=1” or “&repaintAll=1” added

Hi Artur,

exactly that is the problem!

the URLs are correctly encoded, but the implementation adds parameters

/&repaintAll=1&sh=1024&sw=1280&cw=1260&c

so here are 2 problems:

  1. you cannot add parameters after “/”
  2. the parameters are not properly encoded, but the URL is.

Once we get past this problem, everything should work.

Best regards

Yury

Here is the header:

POST /wps/myportal/!ut/p/c5/hctLDoIwFIXhtbiCe3mPG2poYwuoqJQJacgNkgA1qKxfnDkzZ_h_BxrYNtt16O1rcLMdoYYmbguNlUAZYiGUhzIOU6UPPMAMt27iNs2YCBOFmCV-hH4enX3Nrogy-PPOhZsIDJjkR1WMf5Xi-7LalAe3hZ7uvXQEp4vkCo6d7e6kaKWxtD3BY6qDibHdB8xPxGs!/&repaintAll=1&sh=1024&sw=1280&cw=1260&ch=837&vw=1164&vh=0&fr= HTTP/1.1
Accept: /
Accept-Language: de
Referer: http://localhost:11111/.VaadinPortlet/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/7890E49F1B5D4BE633809284D5A100CD.cache.html
Content-Type: text/plain;charset=utf-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1)
Host: localhost:10040
Content-Length: 5
Connection: Keep-Alive
Cache-Control: no-cache

and here is the response:

HTTP/1.1 301 Moved Permanently
Location: /wps/mycontenthandler/!ut/p/spa//6_OM0TH0I40OHL10I64CLMKD30G0/html/%26repaintAll%3d1%26sh%3d1024%26sw%3d1280%26cw%3d1260%26ch%3d837%26vw%3d1164%26vh%3d0%26fr%3d
Content-Language: de
Transfer-Encoding: chunked
Date: Mon, 08 Nov 2010 10:03:17 GMT
Server: WebSphere Application Server/6.1

The comes a GET request which also fails:

GET /wps/mycontenthandler/!ut/p/spa//6_OM0TH0I40OHL10I64CLMKD30G0/html/%26repaintAll%3d1%26sh%3d1024%26sw%3d1280%26cw%3d1260%26ch%3d837%26vw%3d1164%26vh%3d0%26fr%3d HTTP/1.1
Accept: /
Accept-Language: de
Referer: http://localhost:11111/.VaadinPortlet/VAADIN/widgetsets/com.vaadin.terminal.gwt.DefaultWidgetSet/7890E49F1B5D4BE633809284D5A100CD.cache.html
Content-Type: text/plain;charset=utf-8
Accept-Encoding: gzip, deflate
User-Agent: Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 5.1; Trident/4.0; .NET CLR 1.1.4322; .NET CLR 2.0.50727; .NET CLR 3.0.4506.2152; .NET CLR 3.5.30729; InfoPath.1)
Host: localhost:10040
Connection: Keep-Alive

response:

HTTP/1.1 400 Bad Request
Accept-Ranges: bytes
Content-Type: text/html;charset=utf-8
$WSEP:
Content-Language: de-DE
Transfer-Encoding: chunked
Connection: Close
Date: Mon, 08 Nov 2010 10:03:18 GMT
Server: WebSphere Application Server/6.1

Artur,

it looks to me like you cannot have here a solution that works on all portals.

Websphere Portal has a proprietary Javascript API


WPS API docs

see
Portal V6.1 Web 2.0 Javadoc

ibm.portal.portlet.PortletWindow acts as the “entry point” for all client-side portlet APIs.

You could try the workaround mentioned in the Jetspeed 2 post: http://vaadin.com/forum/-/message_boards/message/240649 (override ApplicationPortlet2.getVaadinConfigurationMap and change “portletUidlURLBase” to end in an extra “?1”). That’s how I got Jetspeed 2 working.

Yep, that did the trick! Really cool!

Thanks for your help!

Regards,

Yury

Yury,

could you sharean an example of a portlet for websphere as war file? I’m trying to get a working vaadin portlet 2.0 to work on Websphere Portal but it just displays empty portlet, without any content. If I switch to Portlet 1.0 it does show content.

Hello.

I need some help overriding the method getStaticFilesLocation. I copied the VAADIN widgetsets and themes in my WebSpheres ‘shared libs’ directory, but I don’t know how to override the getStaticFilesLocation method. Can I just change it to something like:


protected String getStaticFilesLocation(PortletRequest request) {
/*
        // TODO allow overriding on portlet level?
        String staticFileLocation = getPortalProperty(
                Constants.PORTAL_PARAMETER_VAADIN_RESOURCE_PATH,
                request.getPortalContext());
        if (staticFileLocation != null) {
            // remove trailing slash if any
            while (staticFileLocation.endsWith(".")) {
                staticFileLocation = staticFileLocation.substring(0,
                        staticFileLocation.length() - 1);
            }
            return staticFileLocation;
        } else {
            // default for Liferay
            return "/html";
        }
*/
    return "C:/temp/shared libs";
    }

Thank you very much for your help.

While this might not be the only issue in your case, note that the path returned should be a relative path on the server (accessible via HTTP, based on the root context if I remember correctly) - not a local file system path.