Forums

Home » Liferay Portal » English » 3. Development

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Nandhini Mohan
Diff between creating service_hook and EXT
November 7, 2012 11:02 PM
Answer

Nandhini Mohan

Rank: Junior Member

Posts: 31

Join Date: November 6, 2012

Recent Posts

Hi friends,

In liferay we are creating service_hook to override a method and some times we are creating EXT. Can u tell me what is the difference between them? Which is the best way?
Alireza Zare
RE: Diff between creating service_hook and EXT
November 7, 2012 11:18 PM
Answer

Alireza Zare

Rank: Regular Member

Posts: 110

Join Date: September 3, 2010

Recent Posts

Nandhini Mohan:
Hi friends,

In liferay we are creating service_hook to override a method and some times we are creating EXT. Can u tell me what is the difference between them? Which is the best way?



Hello Nandhini,

Hooks are more for front end modifications like Jsp's, listeners language properties and such.
While ext is used to modify the core library code like action classes and implementation classes.

I hope this will help.

Bestregards,
Alireza
Nandhini Mohan
RE: Diff between creating service_hook and EXT
November 7, 2012 11:40 PM
Answer

Nandhini Mohan

Rank: Junior Member

Posts: 31

Join Date: November 6, 2012

Recent Posts

Thank you Alireza,
But there is some service_hook, in that we can override the methods and modify the functionality of service wrapper classes.
Is both service hook and EXT are same?
Alireza Zare
RE: Diff between creating service_hook and EXT
November 7, 2012 11:54 PM
Answer

Alireza Zare

Rank: Regular Member

Posts: 110

Join Date: September 3, 2010

Recent Posts

Nandhini Mohan:
Thank you Alireza,
But there is some service_hook, in that we can override the methods and modify the functionality of service wrapper classes.
Is both service hook and EXT are same?


As far as I know there is one hook but within the hook you could hook also services by extending the wrappers.
If you want to extend the wrappers than I would say the hooks are great to do so. See: http://www.liferay.com/documentation/liferay-portal/6.0/development/-/ai/overriding-a-portal-service
Alireza Zare
RE: Diff between creating service_hook and EXT
November 8, 2012 12:17 AM
Answer

Alireza Zare

Rank: Regular Member

Posts: 110

Join Date: September 3, 2010

Recent Posts

Liferay 6.0
Hooks:
http://www.liferay.com/documentation/liferay-portal/6.0/development/-/ai/hooks

Ext plugin:
http://www.liferay.com/documentation/liferay-portal/6.0/development/-/ai/ext-plugins

Liferay 6.1
Hooks:
http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/hoo-4

Ext plugins:
http://www.liferay.com/documentation/liferay-portal/6.1/development/-/ai/ext-plugi-4
Roberto Díaz
RE: Diff between creating service_hook and EXT
November 8, 2012 12:25 AM
Answer

Roberto Díaz

LIFERAY STAFF

Rank: New Member

Posts: 24

Join Date: October 30, 2012

Recent Posts

This post could also help you:

http://www.liferay.com/forums/-/message_boards/message/14932112/maximized
Manish Kumar
RE: Diff between creating service_hook and EXT
November 8, 2012 1:34 AM
Answer

Manish Kumar

Rank: Junior Member

Posts: 94

Join Date: March 1, 2012

Recent Posts

Hi Nandhini Mohan,
As much i understand using ext we can do every changes which a hook can do but other than that there are certain things which a ext can do only like,

Customizing portal.properties that are not supported by Hook Plugins
Customizing Struts Actions
Providing custom implementations for any of the Liferay beans declared in Liferay's Spring files (use service wrappers from a hook instead if possible)
Adding JSPs that are referenced from portal properties that can only be changed from an ext plugin (be sure to check if the property can be modified from a hook plugin before doing this)
Direct overwriting of a class (not recommended unless it's strictly necessary).

For this you can refer to the liferay documentation and the url suggested by Roberto Díaz is also very good.

Things that are in favour of hook against ext is that hook is hot deployable, ext is not and ext for one version does not work proper for the next version if you try to use that.
You need to create that again.

Hope this will help you emoticon
Siby Mathew
RE: Diff between creating service_hook and EXT
November 8, 2012 3:12 AM
Answer

Siby Mathew

Rank: Expert

Posts: 267

Join Date: March 4, 2011

Recent Posts

Hi,
In my opinion, use an ext-plugin only if you dont have any other option to achieve the functionality.
Its best to use a hook whenever possible.

Thanks,
Siby
Nandhini Mohan
RE: Diff between creating service_hook and EXT
November 8, 2012 3:33 AM
Answer

Nandhini Mohan

Rank: Junior Member

Posts: 31

Join Date: November 6, 2012

Recent Posts

Thank you so much all