Foros de discusión

Implementing a new Service

thumbnail
Yves Legrand, modificado hace 12 años.

Implementing a new Service

Regular Member Mensajes: 156 Fecha de incorporación: 18/11/09 Mensajes recientes
Hi again,

i want to implement a new service which can be used by the portal (for example for authentication reasons) or by some portlets.
So, this service should be available for different parts of the portal.

In more detail this service implements a webservice client which offers the portlets and the portal some additional methods.
So this service should be available from everywhere in the portal.

How would you implement such an extension? Please let me know how you would do this?

Best wishes,
Yves
thumbnail
David H Nebinger, modificado hace 12 años.

RE: Implementing a new Service

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
You can deploy the jar for your service in the global directory, that way either the portal or portlets would be able to access the code. Doesn't really matter that your service implements a web service client, etc.

So that makes your service accessible, but using it in the portal/portlets depend upon what the service does. Your example, an authentication service, would require at least a hook and possibly an ext plugin to enable use of it in the portal. But a different example, say a zipcode verification service, might not need a hook or anything to be available.
thumbnail
Yves Legrand, modificado hace 12 años.

RE: Implementing a new Service

Regular Member Mensajes: 156 Fecha de incorporación: 18/11/09 Mensajes recientes
Hi David,

thanks for your quick answer! Can you tell me how would you implement and deploy the jar-File when using the Liferay IDE?
Maybe its a stupid quesion, but where should i create my classes wihtin the Liferay IDE? Within an Ext-Plugin? (Maybe then it is not within the classpath for portlets?) Within a hook?(Does this work?)

Thanks,

Yves
thumbnail
David H Nebinger, modificado hace 12 años.

RE: Implementing a new Service (Respuesta)

Liferay Legend Mensajes: 14919 Fecha de incorporación: 2/09/06 Mensajes recientes
Your shared code for the service would just be done in a basic java project. Write your code, then build it as a jar. Deploy the jar manually to the global jars directory to make it available to any deployed war in the app server.

Hook vs ext would come into play when trying to integrate the service into existing LR code and whether a hook would be adequate or not.

For your own portlets, you'd include the jar in the classpath when doing the compile for your portlet classes, but would not include the jar in the war (since it is already available in the global classpath of tomcat).