Other than accessing Liferay Service through web service, Liferay provides local API as well for Liferay Portlet developers to access Liferay information locally.
To know more about what local services Liferay exposed, please refer the javadoc.
This post will show a simple example on how to access Liferay local service.
Requirement:
1. Liferay Development environment has been setup.
2. Portlet created in Liferay
Steps:
1. Create a java class inside the Liferay Portlet.
2. Write the following codes to access user information.
3. other services which listed in the javadoc could be accessed as well.
Done!!
To know more about what local services Liferay exposed, please refer the javadoc.
This post will show a simple example on how to access Liferay local service.
Requirement:
1. Liferay Development environment has been setup.
2. Portlet created in Liferay
Steps:
1. Create a java class inside the Liferay Portlet.
2. Write the following codes to access user information.
public void getLiferayUser(long userId) throws Exception {
User user = UserLocalServiceUtil.fetchUser(userId);
String email = user.getEmailAddress();
String screenName = user.getScreenName();
}
3. other services which listed in the javadoc could be accessed as well.
Done!!
No comments:
Post a Comment