Playn - is it possible to deploy on Apache server? - java

I understand that it's a GWT, but if it compiles to Javascript, can the generated html module compile to such a packaging that I can just deploy it on Apache, assuming I don't have any backend communications?

Yes. This is basically what I was getting at with this question. For the HTML port, you are effectively building a GWT application, which is just an HTML page hosting a bunch of cleverly obfuscated Javascript.
You can find the relevant Google documentation here:
How do I change the location of my cache/nocache HTML files?

Related

Integrating JS and CSS minimizing with ThymeLeaf and SpringBoot

I have a Spring Boot project which hosts several APIs and some simple web pages.
My project is built using Maven by Jenkins.
I'm using ThymeLeaf as my HTML templating tool for the few web pages that I have.
But I'm having issues integrating a tool to minimize my JS and CSS files.
I would like to have my JS and CSS files as full fat files in my src directory but upon compilation, I would like to have the JS and CSS files minimized and references to the full/fat files updated in the thymeleaf html files.
Edit
To those marking my question down and voting to close it, why not post a comment explaining why?
This is a valid request and if you don't know the answer, go find another question to answer to build up your rep points.

Import appengine library in a gwt module

I have a web application that contains a GWT module. In the client of my GWT module I want to use the library "com.google.appengine.api.datastore.DatastoreService" but, when I compile the gwt module, I have this error: "The import com.google.appengine.api.datastore cannot be resolved". Where is the problem
The first and most obvious things to ask are:
Have you downloaded the java appengine SDK and have you made the JAR files contained within available to your app?
Are you using Eclipse?
I don't think it is possible. Anything on the client side gets translated to javascript that is ran in the browsers. You can directly access a database through javascript in the browser. Not all Java code can run in a browser. In fact not even all the JRE classes can be used either. If you need a type of storage on the client side, look at html 5 local storage.

Creating PDF files in GWT webapp

I have a GWT webapp, and there are various tables showing in the pages.
I need to have a mechanism put in the webapp to convert the tables through XML/XSLT files into PDF files.
I researched for PDF file converters and I found the following libraries:
apache's FOP
iText
But I am getting errors in implementing them. Does GWT support them?
[ERROR] [myGWTProject] - Line 842: No source code is available for type org.apache.fop.apps.FopFactory; did you forget to inherit a required module?
My webapp relies on GWT concerning both parts the client side and the server side.
Any help is appreciated.
In all likelyhood, no. GWT only supports a very limited set of JRE features. Unless they specifically designed the library to integrate it with GWT, it will not work.
To use such libraries, usually, you delegate that to your server, you do the job and when ready you return it to the client.

Gwt and jsp in same project

i was looking for similar title here but i didn't find much info, so if anyone can provide some example or url or any approach how to do it.
For example: is it possible to call a jsp from a gwt widget?
or communication (server - jsp) in gwt project and so on..
Is there any limitation is using jsp in gwt project?
Thanks :-)
GWT compiles down to html+javascript (static files), while JSPs are internally compiled and behave like servlets. You can configure URLs to point to both (via your server config and/or web.xml).
Both GWT and JSP allow you to go to a new URL. In GWT you can use Window.Location.assign(url) (this will load new URL and close current GWT app).
Additionally GWT allows you to load data by making XHR calls to URLs: http://code.google.com/webtoolkit/doc/latest/tutorial/JSON.html
So:
Yes you can goto JSP pages from GWT app.
Yes you can load data provided by JSPs into your GWT app.
In any jsp applications actions lead to URLs. The URL can point to a GWT module.
You will find applications which offer a back-end for the administrator in GWT, while the front-end runs in Struts2. Konakart e-shop is such an example.
My impression is that GWT will replace the other frameworks on the long run. Everybody will want Rich Internet Applications very soon.
On the other hand in the early 80's i was thinking that in very few years everybody would be using Unix, which never happened, but Unix did quite well after all...

Using Java code on embedded HTML instead of JavaScript?

I am working on a project which is basically a Java application with an embedded IE browser (using JDIC 0.9.5) to display custom HTML files (stored locally that I created). I have a test HTML file with a JavaScript function that checks a simple form with checkboxes and alerts the user with a dialog stating which checkboxes are checked.
My question is, is there a way for my Java application to do the same procedure on the embedded HTML form instead of using JavaScript. I want to keep my application and HTML files simple without the clutter of JavaScript in my HTMLs or a pile of .js files.
Thanks for any help and guidance!
You have two options. Either shift the project to run the Java on the server side using JSP technology inside a web container like Apache Tomcat or Jetty, or write you web page to open up a Java applet.
The applet route allows you to run the code on someone else's machine, and as a trade off you will have to run the application in a strongly security constrained environment. After all, if someone were to run code on your machine, you wouldn't want it able to access your disk, etc.
The JSP solution will have you running the code on the same machine as your web server, since you (probably) control your own web server, the code will not be ran with as many security constraints enabled. This means the code can make requests to other machines, write and read files, etc.
You could replace your model with a client-server model using Java Server Pages (JSP).
If you are displaying the page through an embedded browser it is very unlikely that you will be able to get access to the DOM via Java.
One option is to use GWT javascript compiler to code in java and then convert to javascript. If it will only use IE, then you will only need to keep one of the generated .js files, so the clutter will be low.
Since you're embedding your HTML files in your own Java program, I would recommend you to use one of these 2 approaches:
1.- Use Javascript and structure the files cleanly, is not that complex.
2.- When you do the POST check the values in your Java code and return a new dynamically generated HTML file with needed info
I sincerely recommend you to follow the first option. Other options to work with Java in HTML would be JSP or GWT, but both will require a proper J2EE server, which would be overkill in your application

Categories