How to integrate GWT or Vaadin with Play Framework 2.0 - gwt

Is is possible to implement the client side of a Play Framework 2.x web application using GWT or Vaadin?
Play 1.x has a special module that provides GWT integration, but I can not find examples of the use of these technologies together in Play 2.x version. Can these technologies be integrated? Is there a module, or must some other approach be used?

GWT and Play2 can work together seamlessly, just as GWT can be used with python and go backends.
Using GWT with Play2 has two parts, serving static files and client-server communication.
For the GWT produced static files (js, css, img..) you can just add them to the Play2 public directory, and they will be accessible based on the routes configuration.
For client-server communication your best bet is using a pure json-rest approach, as request-factory, gwt-rpc have some dependency on J2EE servlets.
There are plenty examples of providing a json/REST api with Play2, and plenty examples of interacting with json/REST APIs with GWT.

Henri Kerola demoed this recently for play 2.x and will give a talk at javaone this year:
http://www.youtube.com/watch?v=IwuqAh0VSek

I found a project on github which integrates Vaadin with Play 2.2:
https://github.com/henrikerola/play-vaadin-integration

You can't use Vaadin with play2. Vaadin is basically a Java EE servlet that must live in a Java EE container such as Tomcat.
Play is not based on Java EE, it uses its own server.
As for GWT all server side code needs a Java EE container. But if you just want the client side then it's totally possible as it is with any web framework.
Just create json web services and remove server dependancies.
For an example in php : http://gwtquickstart.blogspot.fr/2009/11/call-php-script-from-gwt.html

Related

How call Rest API in Eclipse RCP application?

I have one Eclipse RCP3 project.Now I need to call a rest api|(java) and Post some information using that API. Need Help.
Being a Java application, an Eclipse RCP app can use most existing Java REST client libraries. My opinion is that the easiest way is to use the ECF JAX-RS Jersey Client. I recently wrote an article about how to incorporate this into an Eclipse RCP application:
https://www.modumind.com/2020/05/19/eclipse-rcp-and-rest-an-introduction/
In short, the JAX-RS Jersey Client is an OSGi Remote Services client created as part of the Eclipse Communications Framework (ECF) project. It embeds a Jersey/Jackson JAX-RS implementation that allows you to create REST clients as annotated interfaces that are made available as OSGi services locally. Jackson is used to data bind the REST responses to Java POJOs which require little or no annotation.
This solution allows you to skip most of the scaffolding code that usually has to be written to make REST calls in a Java application. But of course, you can also use Jersey and Jackson directly, those plugins are made available via Eclipse Orbit project.
http://www.eclipse.org/orbit
The GitHub repository for the ECF JAX-RS Jersey Client can be found here:
https://github.com/ECF/JaxRSProviders

How to use apache sling extension gwt servlet 3.0.0?

I have a GWT project(GWT version 2.4). I want to start up Spray-servlet in server side GWT, but GWT does not support servlet-3.0, therefore I wanted to use org.apache.sling.extensions.gwt.servlet-3.0.0.jar for using servlet-3.0.0.
How I can use org.apache.sling.extensions.gwt.servlet-3.0.0.jar in GWT?
EDIT
If sling does not help me, then how can I run spray-servlet-1.2-RC1 in server side GWT?
org.apache.sling.extensions.gwt.servlet-3.0.0.jar is not a Servlet 3.0 package for GWT, but an extension to Apache Sling meant to allow server-side GWT code to run.
It's not what you're looking for.

Play2 and Servlet Container

Why Play is not supporting the Servlet technology by default. It is supporting Java but not servlet. why this? Is it not meant for Java guys working in Web application with servlets. I would like to develop web application in Scala and Play and deploy in a Servlet container without any workaround or hacking. If it is hard then I would prefer Scala and JSF. This will be the situation most of the java developers trying to adopt Scala.

how to integrate Spring and GWT from 2 different projects

I am tying to integrate a gwt project with my already running spring project.
i am using eclispe, and i have a Spring MVC application that receives JSON requests.
i am using the built in Tomcat to run my MVC application.
now i would like to create a new GWT project and have it communicate with my spring project with JSON.
i understand that they need to run on the same ip and port so i would not have to make cross site communication.
if i try to run my GWT application as run-as->Web application (which is the normal way for the project) on the same port as the Tomcat server i get an error that the address is already in use (which makes sense)
i tried creating a new dynamic web project and make it look the same as the GWT project. even though i am able to run the application, nothing happens, and the "entry point" is not run (i am not getting any errors or anything) it just runs the default HTML welcome file and thats it. with out any GWT.
what am i doing wrong, i am surly misunderstanding something about how all this should work.
can anyone help me out please.
You need to select that you are running on an external server:
That is a question that can't just be answered with yes or no. It all depends on your overall architecture and what you are trying to achieve.
As I said, if it is both the same application I'd recommend to integrate the Spring project into the web project. (and if that's the case, the spring project does not need to be a web project)
If the spring project is its own application and maybe running on a different server, keep them separated. Extend the spring project so it offers the functionality (via ejb or webservice) the gwt-web project needs.
Nevertheless, I recommend you do some reading about how Java EE applications should be designed and what the different tiers (client, server/service, business, etc) are for. Oracle/Sun offers some good articles. For example: http://java.sun.com/blueprints/guidelines/designing_enterprise_applications_2e/ or http://docs.oracle.com/javaee/5/tutorial/doc/bnaay.html#bnabb.

Replacing GWT RPC with JBoss Errai

I myself haven't tried JBoss Errai at all, but I am thinking of migrating the server-side services of my current GWT project into a new project that will be now treated as a platform.
The services in the currect project that are accessed via RPC can be commonly used with other projects as "base platform."
So, I am thinking of using using JBoss Errai for this scenario. And so, the new "base" platform project will be non-GWT and that Ajax apps built with GWT will just call into this platform for authentication, storage, etc.
Is this a good approach anyway?
If your project actually runs fine, why would you want to change it? you can instead, integrate the errai framework and when you want to add a new component, you can take advantage of the features of errai ;-)