Introduction
Liferay is the leading Open Source Enterprise Portal. One may asked what an enterprise portal is and this question is very valid as it has been asked on every single Liferay project that I have worked. This blog post is not about defining what an enterprise portal is but it wouldn't be a crime if we provided a brief definition:An enterprise portal is a web application which provides services required by an enterprise such as: user management, authentication and authorisation services, ability to connect to third party applications and provide a single point of access to multiple applications, hence the "portal".The above is my own definition and it could be extended to encompass web content management, content management system (CMS) and single sign on (SSO). This post is about Liferay and the use of its web content management system (WCMS) to create single page applications using AngularJS. The motivation to create portlets using AngularJS instead of Java is as:
- Portlet development using Java is very expensive
- Not many Java developers with portlet experience
- Java portlets development requires heavy duty tools such as build tools, IDE and JVM
- Portlet developers need to be familiar with the Portlet API, lifecycle and framework
Liferay RESTFul API and Security
Liferay ReSTFul and SOAP API implement the same security as the core library:- API can be secured so that only authenticated users can access them (AUTHENTICATION)
- API can be secured so that only users with the right roles can executed certain API calls (AUTHORIZATION)
For a list of API available in Liferay, point your browser to the following
http://<your-server-address>:<your-server-port>/api/jsonwsLiferay will provide a means of testing the services calls when the above URL is loaded. Most services execution will require authentication or a secured token to be passed on with the calls. This level of a security is required in an enterprise environment. It is possible to stop Liferay from checking for the secured token in portal-ext.properties as
Auth.token.check.enabled=falseSoftware developments should promote code reuse, therefore by separating the business logic from the portlet code, developers can share the business logic with third party applications.
Why Use AngularJS to Create Web Applications (Not Portlets)?
This is not a tutorial on AngularJS. Developers should use the same approach for developing any AngularJS application to developing Liferay web applications.AngularJS is a popular JavaScript framework promoting Object Oriented Development (OOD) and Model View Controller (MVC) to the JavaScript community. Java developers are already custom with the methodology through the use of Spring MVC and JSF for front end developments. Developers familiar with Google Web toolkit (GWT) should find themselves in familiar territory. Now to answer the question of why use AngularJS to create web applications on Liferay?
AngularJS is JavaScript and therefore can be executed in the browser without recompilation and redeployment. Liferay Web Content Management System (WCMS) provides an HTML editor and content versioning. Liferay JSONWS API runs on the same server and can be accessed through the JavaScript written in the WCMS. AngularJS modules can be written in a third party editor such Notepad++ and uploaded to Liferay Content Management System (CMS). The Liferay CMS provides a link to the latest version of the file which can be referenced in the HTML/ JavaScript code. By creating the web services in Java through Liferay Services Builder, the java developer can focus on the business logic – including testing. The front end developer can utilise his skills in HTML and JavaScript to develop the user interfaces and any necessary interactions with the backend through the ReSTFul services. There is a clear separation of work and accountability. The learning curve for the Java developers to create the services will be minimal. To preview the live code, the frontend developer only has to save the content (WCMS) and refresh the page to see the latest changes.
Here is a quick example:
<div ng-app="" ng-controller="companiesController">
<ul>
<li ng-repeat="x in data">{{'title: ' +x.title + ', group Id: ' + x.groupId }}</li>
</ul>
</div>
<script>
function companiesController($scope,$http) {
$http.post("http://localhost:8080/api/jsonws/assetentry/get-company-entries/company-id/10157/start/0/end/5?p_auth=cbSXanJ2")
.success(function(response) {$scope.data = response;});
}
companiesController.$inject = ['$scope', '$http'];
</script><script src="http://ajax.googleapis.com/ajax/libs/angularjs/1.2.15/angular.min.js"></script>
You can copy the above in a new web content article and see the result displayed on the page. Make sure to change red bold values to your system specific:
- Company id: for ease of testing, you can retrieve that value from the control panel
- P_auth: this value can be looked up programmatically as it will change every time the user logs into the portal
Hello
ReplyDeletehow do you get the current p_auth from javascript?
nemco.com.au
ReplyDeleteHire AngularJS developer | AngularJS Development Company – Nemco
Nemco is a top level AngularJS Development Company based in sydney, Australia. provide supreme AngularJS development service. Hire angularjs developers from Nemco
angularjs development| angularjs development company
I wanted to thank you for this excellent read!! I definitely loved every little bit of it. I have bookmarked your web site to check out the latest stuff you post.
ReplyDeletehire AngularJS developer
Thank you for sharing this kind of valuable information with us Top Web Design Company in Bangalore | Website Developers in Bangalore | Website Designing Company in Bangalore
ReplyDeleteI admire you for making this valuable and important information available here. This might turn out to be gainful for many seekers who are finding AngularJS Web Application Development Company.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDeleteHello, This post is about Liferay and the use of its web content management system (WCMS) to create single page applications using AngularJS. Content of this blog is very helpful for me, Thank you so much for sharing this blog.
ReplyDeleteHire Angularjs Developer
This comment has been removed by the author.
ReplyDeleteThis comment has been removed by the author.
ReplyDelete1movies.rocks
ReplyDeletewikitimemagazine
ReplyDeletewikitimemagazine
wikitimemagazine
wikitimemagazine
wikitimemagazine
wikitimemagazine
Good post..
ReplyDeleteSAP mm training
SAP pm training
SAP PP training
SAP Qm training
SAP Sd training
SAP Security training
SAP wm training
Scala training
Thanks for Sharing this info, it will helps a lot.
ReplyDeleteWeb Development Company In India
Wohh just what I was looking for, regards for posting.
ReplyDeleteข้อดีUFASLOT
Pest control services for offices
ReplyDeletePest control services for pharma
Pest control hyderabad
Termite control Pre construction
Pest control services for industries
Pest control services for warehouses
sanitization for commercial pest control
Pest control services for factories
With all this hype around blockchain, it's worth taking a look at where development really stands and how we can bridge the gap between today's blockchain development landscape and tomorrow's bright future. Also, the average blockchain developer salary stands at 30,00,000 LPA, which is huge.
ReplyDelete(x-Force keygen) для всех продуктов autocad 2021 Avid Sibelius 8 Camtasia Studio 8 Crack is trustful software which records your computer XForce Keygen Download
ReplyDeleteAvid Sibelius Ultimate 2022 Crack is a fantastic playback of your scores with its powerful music tools. It can add and modify notes easily.Avid Sibelius Ultimate 2023.10 Crack
ReplyDeleteGood post
ReplyDeleteSuper article. Liferay a d'excellentes fonctionnalités et vous pouvez développer des applications étonnantes à l'aide de Liferay. Nous sommes Liferay Spécialistes Maroc. Contactez-nous pour obtenir des détails sur les services.
ReplyDeleteThis comment has been removed by the author.
ReplyDeletehey nice source for us, thanks for sharing the amazing information of Connecting AngularJS to a Backend with REST and JSON and this information really helpful for me and these pics that you are posting in the blog is very nice and provide the good ideas ofLiferay RESTFul API and Security.
ReplyDeleteRestaurant data scraping
Your writing is like a captivating melody; it resonates long after the last word is read. Your ability to craft such immersive narratives is a gift. Thank you for sharing your storytelling magic with us!
ReplyDeleteSame Day Delivery Services in Las Vegas