Forums

Home » Alloy UI » English

Combination View Flat View Tree View
Threads [ Previous | Next ]
toggle
Alessandro Violante
Hooks. Changing directory structure of a folder in Eclipse
November 28, 2012 2:19 AM
Answer

Alessandro Violante

Rank: New Member

Posts: 9

Join Date: October 25, 2012

Recent Posts

Hi,

Searching in the guide for Hooks, i was trying to to my first example hook.

At the beginning it is wrote that you have to

"The directory
structure inside this folder must mirror the one within liferay-portal-
/tomcat-6.0.26/webapps/ROOT. To override the Terms of Use, copy liferayportal-[
version]/tomcat-6.0.26/webapps/ROOT/html/portal/terms_of_use.jsp to
hooks/example-hook/docroot/META-INF/custom_
jsps/html/portal/terms_of_use.jsp."

What are you talking about when you say to change the directory structure of a folder?

If my structure is META-INF/custom_jsps, what i have to change and where? What does it mean?

liferayportal- is the name of my workspace, right?

Alex
David H Nebinger
RE: Hooks. Changing directory structure of a folder in Eclipse
November 28, 2012 5:38 AM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6537

Join Date: September 1, 2006

Recent Posts

Basically you must be aware of how the hook deployment works...

JSP hooks replace the JSPs of the portal w/ your hooked version. In order to replace files, the hook's directory structure must match that of the portal's.

So first you should not be putting the JSPs into the META-INF directory.

Your hook will initially have a docroot directory. In this directory you'd add your custom_jsps directory.

From this directory you build up the directories so the paths match that of root.

So to override the /html/portal/terms_of_use.jsp you're going to end up with a directory in your hook of /docroot/custom_jsps/html/portal/terms_of_use.jsp. You'll make your changes in this file.

When the hook is deployed, it will replace the portal's terms of use jsp page with your own.

If you did not mirror the portal's directory, i.e. you created /docroot/custom_jsps/terms_of_use.jsp, when you deployed your hook the portal's page would be untouched and if you navigated to the webapps/ROOT directory you'd find a new /webapps/ROOT/terms_of_use.jsp page but this page would not be used by the portal.
Apoorva Prakash
RE: Hooks. Changing directory structure of a folder in Eclipse
November 28, 2012 5:40 AM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

Hello Alessandro,

You are just a bit confused, not a big deal... Just take it easy...

See the hooks development wiki here, and if you are using Liferay IDE see this.

Check them, and they will definitely help you...

Thanks and Regards,
Apoorva Prakash
Apoorva Prakash
RE: Hooks. Changing directory structure of a folder in Eclipse
November 28, 2012 5:54 AM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

Yes David, exactly right... just one addition from my side in your words, correct me if I'm wrong...

If we are overriding the terms_of_use.jsp, then the default file from \ROOT\html\portal is renamed as terms_of_use.portal.jsp and our Hook's file is replaced instead with default name.

But I still wonder, what is the standard procedure, if we are removing the customized file form hook, apart from removing the Hook's file, and rename the old one form terms_of_use.portal.jsp to terms_of_use.jsp in server.

Thanks,
Apoorva Prakash
David H Nebinger
RE: Hooks. Changing directory structure of a folder in Eclipse
November 28, 2012 6:17 PM
Answer

David H Nebinger

Rank: Liferay Legend

Posts: 6537

Join Date: September 1, 2006

Recent Posts

Apoorva Prakash:
If we are overriding the terms_of_use.jsp, then the default file from \ROOT\html\portal is renamed as terms_of_use.portal.jsp and our Hook's file is replaced instead with default name.


Well, this occurs, but not through anything you define in your hook.

When your hook is deployed, Liferay will rename the terms_of_use.jsp to terms_of_use.jsp to terms_of_use.liferay.jsp and put your file in it's original place.

When your hook is undeployed, Liferay will remove your terms_of_use.jsp page and restore the original terms_of_use.liferay.jsp back to terms_of_use.jsp.

This whole process ensures that there will always be the terms_of_use.jsp page that the portal is coded to look for whether your hook is deployed or not.
Apoorva Prakash
RE: Hooks. Changing directory structure of a folder in Eclipse
November 28, 2012 9:15 PM
Answer

Apoorva Prakash

Rank: Liferay Master

Posts: 659

Join Date: June 15, 2010

Recent Posts

David H Nebinger:
Apoorva Prakash:
If we are overriding the terms_of_use.jsp, then the default file from \ROOT\html\portal is renamed as terms_of_use.portal.jsp and our Hook's file is replaced instead with default name.


Well, this occurs, but not through anything you define in your hook.

When your hook is deployed, Liferay will rename the terms_of_use.jsp to terms_of_use.jsp to terms_of_use.liferay.jsp and put your file in it's original place.

When your hook is undeployed, Liferay will remove your terms_of_use.jsp page and restore the original terms_of_use.liferay.jsp back to terms_of_use.jsp.

This whole process ensures that there will always be the terms_of_use.jsp page that the portal is coded to look for whether your hook is deployed or not.


Hello David,

Its quite nicely explained.

Thanks and Regards,
Apoorva Prakash