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.
Related
Since my attempt to set up a Dart project myself I think I miss something fundamental since I didn't succeeded. So I still need the help of the community.
Coming from GWT I am used to a single application forming a single JS file which is ran and will augment a HTML element once it is recognized by the application.
There will be usually two JS files, one for the user-frontend and the web applications backend application.
I want a solution with an incremental build during development time (which I guess Dart offers when used in Dartium)
I have an inhouse web framework that I want to be started and used to send the Dart files for the Dartium session. How this will integrate and interfere with the debug sessions?
Update regarding web framework:
The web framework is a component based rendering engine, including database and uses its own resource management including everything http related like setting the cache flags etc. Its about 1.5 MB with 1200+ tests. Its simply everything you need starting with a simple servlet. Its also using an embedded jetty.
The relevance here is that I need to know how the debugger connects to Dartium and how it finds the files once an instance is running and delivered a html file containing dartium sources, so how can I start my own web server at a given port and still have dartium debug capabilities?
Update regarding the former answers:
I tried it but after two days gave up to learn more and do some other stuff. I just don't know why it is just not possible to add a simple file to the root package of my Dart module like the good old package.html (javadoc) fil. I then just add the Dart libaries to my project and the Dart plugin adds the required Dart nature to the project and creates a builder entry, done. Why do I have to do all the fuzz. Or even better why cant I just annotate my Module's main class to form a module and so I can replace the extra file completely?
I guess the Dart plugin has a model of the Dart code already so discovery is done on the fly in Eclipse.
I also do not know why I cant put my dart code in a dart source folder like src/dart/main and src/dart/test.
Or is this possible? I am still trying to get this done. I will use a fresh Eclipse 3.8 install and check if I can get Dartium to work. Just installing the plugin seams not to do the trick.
Update regarding the JS generation:
I cannot understand why Dart is not offering an incremental build of JS files. Even if it is a single file. It should not be that hard to debundle the given compile steps. I guess it will be something like compile each source file independently and link those together, do some tree shaking and done. Would be awesome if this can be made possible. Remember one can hold a model of the output file in memory (or on disk) and know what part of the js relates to what source file. Then just look up the link symbol tables and write back the part that has changed.
For me the killer feature for Dart would be the ease of configuration as I outlined and the incremental build of JS files making co-developing in JS a no-brainer. I guess in the end both JS files will be just about 750kb combined. So all the stuff with additional compression would not force me to upgrade my 8GB memory or will stress my SSD at all (350MB/sec for writes in burst mode).
Is there any work planed on this? Would be great to have Dart as the final solution for JS creation but to be honest I do not understand why GWT is the way to create JS this way. An incremental build and easy setup for GWT would be also welcome.
Seems not to be a question ...
In Dart you have usually one JS file because Dart on the server runs native (without transpiling)
With Dartium you don't have a build at all because it also runs Dart natively.
You build to JavaScript only for deployment (and of course to test the build output before deployment).
The debugging is done by Dartium itself (you can use the Chrome DevTools debugger without DartEditor if you want). DartEditor access the debugger API of Dartium and acts as a remote display/control.
Debugging web clients loaded from other webservers is supported.
What might cause some work is setting up your custom web server so that it forwards requests to source files to pub serve the web server used by DartEditor (or standalone).
pub serve runs transformers (on the fly code transformations/generation). Some framework depend on transformers being run on the code to make it functional.
I have no idea what this means but I don't use Eclipse/Dart plugin.
[Update regarding the former answers] I tried it but after two
days gave up to learn more and do some other stuff. I just dont
know why it is just not possible to add a simple file to the
root package of my module like the good old package.html file
for the java docs and then all i do is add the Dart libaries
to my project and the Dart plugin adds the nature to it and
creates a builder entry, done. Why do I have to do all the fuzz.
Or even better why cant I just annotate my Module's main class
to form a module and so I can replace the extra files?
To integrate Dart with your Java project create the Dart project independent from your project and move the Dart build output to a directory where you have your other static files.
While development configure your web server to forward to pub serve as explained above.
As already stated in my first answer, this
[Update regarding the JS generation] I can not understand why
dartium is not offering an incremental build of JS files. Even
if it is a single file. It should not be that hard to debundle
the given compile steps. I guess it will be something like
compile a single file and link those then the magical tree
shake and done
is irrelevant. You don't do anything with JavaScript while developing.
If you load the page with a non-Dartium browser pub serve will serve
built JavaScript instead of Dart. Incremental build is in the works
to improve responsiveness. But incremental build is not available
for file generation (would make sense anyway IMHO).
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.
Is there any way to implement write/read file with gwt on client-side?
I tried with java.io.File, java.io.Writer ... I couldn't succeed.
thx in advance!
Update: Please see my own answer for a solution
No, you can't write to files on the client-side. GWT only binds a subset of the Java language. Any file IO would need to happen on the server side through RPCs or some kind of web service.
It's possible with HTML5 in some modern browsers. Try lib-gwt-file. This library can read files from client computer and even supports DND. To see it in action follow this link.
More information on HTML5 FileAPI you can find in the specification.
To download a file from browser memory to the client computer you can use Data URI. Example is here. But this feature is supported by Google Chrome only. Also take a look at the following helpful function. It runs download without reloading current page:
public static native void setWindowHref(String url)/*-{
$wnd.location.href = url;
}-*/;
Another semi-crossbrowser way is Downloadify. It's based on flash. Check this example.
Recently, I've stumbled upon a library called client-io.
A simple library that brings the Flash File API to regular web apps
through GWT. ClientIO will help you offload some of the file
generation functionalities to the client, saving resources and heavy
computation to the server. Working Demo - http://ahome-it.github.io/ahome-client-io/
In GWT the classes in the client folder are only compiled into javascript hence it is not possible to use
java.io
since GWT does not provide compilation of the package
java.io
Hence you have to write text file through RPC only.
I am currently using Netbeans Web Application project. I used dojo and dijit library within my project and I notice that when I start netbeans it scans very slow, I believe part of the slow scanning at startup is the scanning of dojo files. As these files do not change, is there a way to command netbeans to ignore a part of the javascript directory? I believe using a Content Delivery Network (CDN) is a solution but this project would only be accessible via intranet.
Any ideas here?
You'll always want to use Dojo's build system to optimize/minify/concatenate code before deploying. The individual files used for development will load very slowly over a network.
You may also try the public CDN (currently deployed to Google and AOL) using the build layers as deployed there (e.g. dijit.js) to both offset bandwidth and take advantage of caching.
Can I use BIRT within my application instead of deploying as a separate app on the webserver?
I know that BIRT viewer can be integrated with the application by installing it on the server. I went through the process and its very cumbersome. It requires me to import too many JARs and then code too much even for a simple report.
Jasper on the other hand does this elegantly.All I need is 2-3 JARs and 5 lines of code to generate a simple report.
Is it possible to accomplish the same with BIRT?
It is possible to add just the report engine (and possibly the report designer) to your application, and have everything happen via code, instead of URL from the viewer. But you'll have to implement your own viewing functions, e.g. paging through the report, and if you need the report in different output formats, there's code you'll have to write for that, too, instead of letting the viewer application do it.
You can deploy the open source viewer, which will allow you to do this. There is also a BIRT Reporting Web Project you can create using Eclipse's Web Tool Platform that will create a web project for you to run BIRT reports in. (BIRT WTP Integration download)
http://www.eclipse.org/birt/phoenix/intro/intro02.php