0

Is there any folder that is equivalent to the dynamic web project folder /META-INF/services/ in GWT projects? I need it to add a class path in my class loader.

When using the following example stand alone it works perfectly:

package flyingsaucerpdf;

import java.io.File;
import java.io.FileOutputStream;
import java.io.OutputStream;
import org.xhtmlrenderer.pdf.ITextRenderer;

public class PDFMaker {
    public static void main(String[] args) throws Exception {
        new PDFMaker().go();
    }

    public void go() throws Exception {
        String inputFile = "sample.html";
        String url = new File(inputFile).toURI().toURL().toString();
        String outputFile = "firstdoc.pdf";
        OutputStream os = new FileOutputStream(outputFile);

        ITextRenderer renderer = new ITextRenderer();
        renderer.setDocument(url);
        renderer.layout();
        renderer.createPDF(os);

        os.close();
    }
}

It is the same problem as here I think but the deference that I am using GWT project not dynamic web project.

Community
  • 1
  • 1
mohammad
  • 2,142
  • 7
  • 35
  • 60

2 Answers2

0

I don't see GWT code here. You can write a standard servlet, and call it from your gwt code.

nap.gab
  • 451
  • 4
  • 19
  • i did i have a GWT Project this is a par of my restlit code – mohammad Mar 12 '13 at 22:59
  • 1
    Yes, but in your gwt project you can put this code in a separate class, and write a servlet. Always remeber: gwt isn't a language, you are writing java code. – nap.gab Mar 12 '13 at 23:13
-2

Is this yet another gwt newb confusing client and server code?

This may not be the direct answer you seek, but it goes with the adage -- teach you how to fish rather than giving you a fish.

As I have advised before, I shall advise again. For any newb to understand the client-server issues and their separation, you need to first ...

  1. write JEE (aka J2EE) applications in JSP. (JSPs are translated into JavaEE servlets before being compiled).
  2. write pure html/javascript page without server code.
  3. make your html/javascript do more complex things, like draw a square with a table listing its dimension.
  4. Use JSP to generate that html/javascript page.
  5. Embed JSP variables into that html/javascript page, to dynamically alter the appearance and charts and values of tables.
  6. Make the JSP generate that html/javascript page, where the page will send a request back to the JSP. e.g., user modifies a value on the table specifying a change in shape, from square to rhombus, so the JSP generates a new set of javascript.
  7. Be very familiar with the structure of a war file/directory. Then you will understand which parts of your JSP is client-side code and which part is server-side code. Then, you will understand that Java and Javascript don't mix.
  8. Then, you can begin coding in GWT. Then, you will understand the implication that client-side GWT Java is not compiled into Java platform but into browser's javascript, so that you cannot mix GWT client Java with JEE server Java.
  9. Then, you would understand that when you see some JavaEE code in a GWT project, they are not the GWT client code, and you should not attempt to link them to your GWT client-side Java code.
  10. Then, you would understand client-side GWT Java cannot do things server-side GWT Java can do, vice versa.
  11. Then, you would learn how to make the two sides cooperate.

You need to be familiar with writing applications that combines JEE, HTML and Javascript programming before attempting GWT.

Blessed Geek
  • 21,058
  • 23
  • 106
  • 176