Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Stewart Cambridge
extending service.js (servicebuilder)
November 8, 2007 9:40 AM
Answer

Stewart Cambridge

Rank: New Member

Posts: 18

Join Date: July 30, 2007

Recent Posts

Dear Liferay and community,

With regard to the following two issues:
Extension environment's exp-ejb/build.xml's build-service doesn't pass correct # of
and
Make everything.js smaller, minimize http requests
I would like to ask the question:
How do I extend a service built in ext so that it works through javascript? How do I extend service.js?

What I am observing is this:
  1. The service builder creates a file called:/ext/ext-web/docroot/html/js/ext/service.js
  2. That the deployed script is NOT merged with /portal/portal-web/docroot/html/js/liferay/service.js
  3. That adding ext/service.js,\ to portal-ext.properties blocks liferay/service.js from functioning.
  4. That adding <header-javascript>/html/js/liferay/service_packed.js</header-javascript> to liferay-portal-ext.xml does not help.


What's the definitive word on this please? I'm chasing my tail here.

Thanks,

Stewart
Stewart Cambridge
RE: extending service.js (servicebuilder)
November 8, 2007 10:08 AM
Answer

Stewart Cambridge

Rank: New Member

Posts: 18

Join Date: July 30, 2007

Recent Posts

Ok, how does this sound for a solution?

The first few lines of the generated ext/service.js contains this:
1Liferay.Service.Portal = {
2    servicePackage: "com.sgl.portal.service.http."
3};


Thus, when we have in portal-ext.properties this:
1        liferay/service.js,\
2        ext/service.js,\


then these opening lines of ext/service.js wipe out almost all the javascript defined in liferay/service.js.

The solution is to delete these three lines from ext/service.js.

DOH!

emoticon
Roman Hoyenko
RE: extending service.js (servicebuilder)
November 8, 2007 10:32 AM
Answer

Roman Hoyenko

Community Moderator

Rank: Liferay Master

Posts: 868

Join Date: October 8, 2007

Recent Posts

I think it is being replaced, not merged. So you need to include all the service.js plus your changes to make it work.