0

Routing zkau request through JSR-286 serveResource method

asked 2009-05-08 01:22:57 +0800

k2nakamura gravatar image k2nakamura
9

Hi,

I'm trying to integrate ZK with Liferay Portal 5.2.2. I could render zk page as a portlet, but noticed communication to AU engine goes through webapp URL (e.g. http://localhost:8080/zkportlet/zkau) instead of portlet URL (should be something look like http://localhost:8080/web/guest/jsr286?...). For those who are not familiar with Liferay, it deploys a portlet war as an ordinary webapp and registers it to the portal framework. HTTP requests should be processed by Liferay portal framework rather than hitting the webapp directly to control the portal specific behavior such as rendering and security. If the client hits the webapp URL instead of portlet URL, it could be a security hole and we need to protect it separately.

JSR-286, portlet spec v2, introduced a method javax.portlet.Portlet#serveResource, which can be used to forward the AJAX requests to the underlying servlet to handle them. (i.e. DHtmlUpdateServlet).

So I'd like to ask you if there is a way to customize the URL with which the client send the requests to DHtmlUpdateServlet.
The resource URL can be obtained by calling RenderResponse.getResourceURL(), so it would be nice if I can specify the value inside of DHtmlLayoutPortlet. Then I can add "serveResource" method to DHtmlLayoutPortal and forward the request to DHtmlUpdateServlet.

Thanks,

Kenji

delete flag offensive retag edit

3 Replies

Sort by ยป oldest newest

answered 2009-05-08 03:33:49 +0800

flyworld gravatar image flyworld
155 3

you can take look the Au.js and search the zkau.send
https://zk1.svn.sourceforge.net/svnroot/zk1/trunk/zk/src/archive/web/js/zk/html/au.js

link publish delete flag offensive edit

answered 2009-05-08 14:13:18 +0800

k2nakamura gravatar image k2nakamura
9

It looks like "update-uri" init parameter for DHtmlLayoutServlet is passed in to WebManager, and it propagates the value to au.js. Now the problem is WebManager is singleton and the URI is final, so once it is declared it cannot be changed.
I'll investigate if I can defer the initialization of WebManager and resolve the update-uri at runtime, rather than the static configuration.

Thanks,

Kenji

link publish delete flag offensive edit

answered 2009-06-27 06:46:27 +0800

ramedram gravatar image ramedram
30

updated 2009-06-27 07:11:40 +0800

I think I have a problem connected with your consideration.
If I run liferay in non-root context, I receive session timeout from zkoss au engine (DHtmlUpdateServlet).
I found that it is raised in doGet method when receive request with arg cmd.0 = "echo" and path info = null.
I took a watch in au.js but by now I dont understand how solve it.

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow

RSS

Stats

Asked: 2009-05-08 01:22:57 +0800

Seen: 504 times

Last updated: Jun 27 '09

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More