I'm trying to implement REST service in a liferay portlet. Found no way other than using JSON web services in liferay. I don't need to implement web services to interact with the database directly, meaning I dont want to build services to use Json web service. Is there anyway to implement REST web services in a liferay portlet without involving service building, more like a custom web service? Also provide any examples available if possible. Thanks in advance.
For Spring based portlets, there's an excellent and still valid blog Using RESTFul services with Liferay that describes implementing REST services with Spring MVC controllers and Liferay PortalDelegateServlet.
Another option might be to handle the REST calls as resource requests (it. to implement a controller with resource mappings - #ResourceMapping).
Since Liferay version 7.0 there is support in Liferay for deploying JAX-RS endpoints as OSGi services.
In Liferay 7.0 you need to use what is called RestExtender (https://dev.liferay.com/es/develop/tutorials/-/knowledge_base/7-0/jax-ws-and-jax-rs)
From Liferay 7.1 version there is also support for JAX-RS OSGi Whiteboard, which also allows to deploy JAX-RS applications as services and adds a lot more flexibility (https://osgi.org/specification/osgi.cmpn/7.0.0/service.jaxrs.html) (https://dev.liferay.com/es/develop/tutorials/-/knowledge_base/7-1/jax-rs)
Related
I have an java app which supports Basic Authentication,Microsoft is disabling the Basic Authentication option across all Office 365 Tenants on October 1.
In this case, how do I achieve Authenticate an EWS application by using OAuth using java? Is there a proper documentation with Java code available?Thanks a lots.
It depends what libraries your using in Java but regardless of the language your using the first thing you will need is an application registration and you need to decide on the type of oAuth authentication flow you are going to use which depends on the type of application you have see https://learn.microsoft.com/en-us/exchange/client-developer/exchange-web-services/how-to-authenticate-an-ews-application-by-using-oauth as a starter
I probably suck as Googling stuff, but I couldn't find any link that mentioned whether its possible to integrate Spring.net with Oracle's coherance product.
Does anyone know if Spring.net has wrapper libraries for the same ?
Thanks in advance.
The spring integration project for .net is still listed as a spring.net extension project, it's status is "incubator" and it hasn't had any commits since March 2010.
From the project homepage:
The Spring Integration for .NET project will use the design and code
base of the Spring Integration project as a basis, adapting the code
as need to support .NET idioms and move in the direction to take
advantage of .NET only features such as Lambda expressions and
extension methods.
I'd suggest you first find out if Spring Integration for Java supports Oracle's Coherance and if so, you might have a slight chance to get this working in .NET too.
Oracle Coherence provides a native .NET client that you can use to access it from any .NET application, including Spring.NET-based apps.
Here is a link to docs:
http://docs.oracle.com/cd/E24290_01/index.htm
What you are interested in is covered in the Client Guide (Parts I and IV) and .NET API Reference.
My book, Oracle Coherence 3.5, also has two chapters on .NET and POF (Portable Object Format), as well as a full blown WPF sample application talking to a Coherence Java backend.
I am looking to expose an existing app as web service for use on the Blackberry. So I have some questions around the blackbery and its use of web services.
I am wonderings is it possible to use Restful web services (using JSON as the payload) on the blackbery or is SOAP the only web services the balckbery can do?
In recent times I have used the Jersey framework for web services in normal web apps and I think this would suit my current requirements,just need to know if this is possible on the blackberry. Effectively the blackbery would only need to send/recive/procees HTTP calls and JSON so I would imagine this would be possible?
Also I may have to use the enterprise blackberry server, how do I route requests to/from the app (and the enterprise server) to the back end existing app. Is this all seamless with some config settings on the enterprise server or does the the blackberry application need to handle this in a certain way?
You can definitely use a RESTful service and JSON on the BlackBerry. Depending on the version you are targeting you may have to download a JSON library. There is also a good reference guide at http://java.sun.com/developer/technicalArticles/javame/json-me/ you can look through.
The Enterprise server shouldn't affect your ability to use this, as you're essentially making the same calls a browser would, and it will know how to route that traffic.
I am getting started researching / creating a groovy portlet that will connect to a REST based ESB service that returns JSON; I will also need to pass the username in the headers. I was wondering if there are any examples out there on how to create the portlet and set the headers? I am new to groovy and from what I understand this can be accomplished rather easily. Essentially I want a portlet that will allow a user to search for a widget via a search box and return a list of matches. Not sure that it matters but the portlet will be deployed to the Vignette Portal. Any info would be much appreciated!
Thanks in Advance!
Doing a portlet with Java/Groovy is very doable with Spring Portlet MVC. I used some sample code from various sources a year ago but googling on it will give you more modern examples and let you pick something more applicable to your app. The real issue comes up with how you plan on building your app. Gradle is the best option for writing a Groovy web app.
However if you are talking about using Grails, then it becomes much more difficult and I would not advise learning Grails as you are trying to get it jammed into a 'portal' implementation. There are plugins for Liferay and 'portlets' in Grails but when I last looked at them earlier this year, they did not seem fully baked.
Calling REST based services with JSON or whatever from your server code doesn't have to care that you are in a 'portal'. The big issues comes up when you are trying to create the UI with your portal provider specific APIs. Don't be fooled into thinking you won't be using portal specific stuff. We used Liferay a bit and from my perspective the Portlet spec was very slim so to do much of anything interesting in a portal, you have to use some portal specific stuff, at least for UI and authentication services.
So my suggestion is build a Gradle Groovy Web project and use the Spring Portlet MVC Java examples to get something going and then you can simplify with Groovy as it makes sense. Initially you might want to simply start with Java if that is your comfort zone because integrating with your portal might be daunting enough without trying to learn a new language to boot.
I have a legacy web application that I want to enhance by adding a message board. Is it possible to add the message board portlet of liferay into this external application.
I am a newbie so pardon my naivity if I've overlooked something obvious.
Many Thanks
No this is not possible. Liferay is a portlet container that implements JSR 268 portlet specification. All portlets that can be installed in Liferay conform to this specification.
So, if you have a legacy application, which obviously isn't a portlet container, you can't install portlets into it.
Embedding a portlet container in your webapp, just for being able to use Liferay's Message Boards (which isn't THAT good anyway), seems like a huge overkill...
In which language is your application written and which framework(s) do you use? Do a Google to see if there are any projects that you can start from or integrate in your app.
Both the answers in my view are correct limburgie and kgiannakakis, still I would like to add something which may be a little useful.
There is an interesting feature of "Sharing" in liferay with which you can embed portlets as widgets into any application.
But the only catch is that Liferay Server should also be running while your Application is also running on the same or another server.
For more information on sharing you can visit this link.