When I see the file
http://code.google.com/intl/it-IT/appengine/docs/java/jrewhitelist.html, I
see GAME supports classes and javax.dom.Trasform DomSource to write to an
XML file. .
I then I did the following:
CLIENT-SIDE:
MAIN:
....
RPCService rpc = new RPCService();
//rpc.testRPC(rooto, callback);
rpc.creaXML(nickname,pass,email2,gio,mes,ann,callback);
........
AsyncCallback callback = new AsyncCallback()
{
public void onFailure(Throwable caught)
{
Window.alert("Failure!");
}
public void onSuccess(Object result)
{
Window.alert("Success");
System.out.println((String)result);
}
};
....
-----------------------------------------------------------------------------------------------------------
package de.vogella.gwt.helloworld.client;
import com.google.gwt.user.client.rpc.RemoteService;
public interface MyService extends RemoteService {
//public String testRPC(String message);
public void creaXML(String nickname,String pass,String email2,String
gio,String mes, String ann);
}
---------------------------------------------------------------------------------------------------------
package de.vogella.gwt.helloworld.client;
import com.google.gwt.core.client.GWT;
import com.google.gwt.user.client.rpc.AsyncCallback;
import com.google.gwt.user.client.rpc.ServiceDefTarget;
public class RPCService implements MyServiceAsync {
MyServiceAsync service = (MyServiceAsync)
GWT.create(MyService.class);
ServiceDefTarget endpoint = (ServiceDefTarget) service;
public RPCService()
{
endpoint.setServiceEntryPoint(GWT.getModuleBaseURL() +
"rpc");
}
/*
public void testRPC(String message, AsyncCallback callback)
{
service.testRPC(message, callback);
}
*/
public void creaXML(String nickname,String pass,String
email2,String gio,String mes, String ann,AsyncCallback callback)
{
service.creaXML(nickname, pass, email2, gio, mes, ann,
callback);
}
}
------------------------------------------------------------------------------------------------------------
package de.vogella.gwt.helloworld.client;
import java.io.File;
import org.w3c.dom.Document;
import com.google.gwt.user.client.rpc.AsyncCallback;
public interface MyServiceAsync {
//void testRPC(String message, AsyncCallback<String> callback);
void creaXML(String nickname,String pass,String email2,String
gio,String mes, String ann,AsyncCallback<Void> callback);
}
------------------------------------------------------------------------------------------------------------
SERVER -SIDE:
package de.vogella.gwt.helloworld.server;
import java.io.*;
import org.w3c.dom.*;
import org.w3c.dom.Document;
import org.xml.sax.SAXException;
import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.*;
import javax.xml.transform.dom.DOMSource;
import javax.xml.transform.stream.StreamResult;
import de.vogella.gwt.helloworld.client.MyService;
import com.google.gwt.user.server.rpc.RemoteServiceServlet;
public class MyServiceImpl extends RemoteServiceServlet implements
MyService {
public void creaXML(String nickname,String pass,String email2,String
gio,String mes, String ann){
/*
XML format (keywords are space delimited):
<utenti> <--giĆ presente
<utente>
<nick>...</nick>
<psw>...</psw>
<mail>...</mail>
<datan>
<gg>...</gg>
<mm>...</mm>
<aa>...</aa>
</datan>
</utente>
</utenti>
*/
String dest = "utenti.xml";
Document doc = null;
DocumentBuilder db = null;
//Istanziazione di DocumentBuilderFactory
DocumentBuilderFactory dbf =
DocumentBuilderFactory.newInstance();
//Istanziazione di DocumentBuilder
try{
db = dbf.newDocumentBuilder();
}
catch(ParserConfigurationException pce){
System.err.println("Errore per DocumentBuilder");
}
try {
doc = db.parse("utenti.xml");
} catch (SAXException se) {
// TODO Auto-generated catch block
} catch (IOException ioe){
System.err.println(ioe);
}
Node root = doc.getDocumentElement();
//root=<utenti>
Node utente = doc.createElement("utente");
root.appendChild(utente);
Node nick = doc.createElement("nick");
Node Tnick = doc.createTextNode(nickname);
nick.appendChild(Tnick);
utente.appendChild(nick);
Node password = doc.createElement("psw");
Node Tpass = doc.createTextNode(pass);
password.appendChild(Tpass);
utente.appendChild(password);
Node email = doc.createElement("mail");
Node Tmail = doc.createTextNode(email2);
email.appendChild(Tmail);
utente.appendChild(email);
Node datan = doc.createElement("datan");
utente.appendChild(datan);
Node giorni = doc.createElement("gg");
Node Tgg = doc.createTextNode(gio);
giorni.appendChild(Tgg);
datan.appendChild(giorni);
Node mesi = doc.createElement("mm");
Node Tmm = doc.createTextNode(mes);
mesi.appendChild(Tmm);
datan.appendChild(mesi);
Node anni = doc.createElement("aa");
Node Taa = doc.createTextNode(ann);
anni.appendChild(Taa);
datan.appendChild(anni);
try {
DOMSource DOMSource source = new (doc);
StreamResult sr = new StreamResult (dest);
TransformerFactory tf =
TransformerFactory.newInstance ();
Transformer tf.newTransformer TRANSF = ();
transf.transform (source, sr);
}
catch (TransformerConfigurationException tce)
{
System.out.println (tce.getMessage ());
}
catch (TransformerException te)
{
System.out.println (te.getMessage ());
}
}
-----------------------------------------------------------------------------------------------------------
module GWT:
<?xml version="1.0" encoding="UTF-8"?>
<module rename-to='de_vogella_gwt_helloworld'>
<!-- Inherit the core Web Toolkit stuff. -->
<inherits name='com.google.gwt.user.User'/>
<!-- Inherit the default GWT style sheet. You can change -->
<!-- the theme of your GWT application by uncommenting -->
<!-- any one of the following lines. -->
<inherits name='com.google.gwt.user.theme.standard.Standard'/>
<!-- <inherits name='com.google.gwt.user.theme.chrome.Chrome'/> -->
<!-- <inherits name='com.google.gwt.user.theme.dark.Dark'/> -->
<!-- Other module inherits -->
<inherits name='com.google.gwt.xml.XML'/>
<inherits name='com.google.gwt.http.HTTP'/>
<!-- Specify the app entry point class. -->
<entry-point class='de.vogella.gwt.helloworld.client.HelloGwt'/>
<!-- Specify the paths for translatable code -->
<source path='client'/>
<source path='shared'/>
<inherits name="com.google.gwt.search.Search"/>
<servlet path="/rpc"
class="de.vogella.gwt.helloworld.server.MyServiceImpl" />
</module>
-------------------------------------------------------------------------------------------------------------
WEB.XML
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE web-app
PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.3//EN"
"http://java.sun.com/dtd/web-app_2_3.dtd">
<web-app>
<!-- Servlets -->
<!-- Default page to serve -->
<welcome-file-list>
<welcome-file>De_vogella_gwt_helloworld.html</welcome-file>
</welcome-file-list>
<servlet>
<servlet-name>rPCImpl</servlet-name>
<servlet-class>de.vogella.gwt.helloworld.server.MyServiceImpl</
servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>rPCImpl</servlet-name>
<url-pattern>/de_vogella_gwt_helloworld/rpc</url-pattern>
</servlet-mapping>
</web-app>
-------------------------------------------------------------------------------------------------------------
Starting the application I got the following error:
[ERROR] javax.servlet.ServletContext log: Exception while dispatching
incoming RPC call
com.google.gwt.user.server.rpc.UnexpectedException: Service method
'public abstract void
de.vogella.gwt.helloworld.client.MyService.creaXML (java.lang.String,
java.lang.String, java.lang. String, java.lang.String,
java.lang.String, java.lang.String) 'Threw an unexpected exception:
javax.xml.transform.TransformerFactoryConfigurationError: Provider not
found org.apache.xalan.processor.TransformerFactoryImpl
at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure
(RPC.java: 378)
....
What does this mean?
Okay still do so?
Thanks to all
Sebe
--
You received this message because you are subscribed to the Google Groups
"Google App Engine for Java" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/google-appengine-java?hl=en.