Hi again, GAE don't allow to use FileWriter, but I need to write an XML file! I noticed it from here: http://code.google.com/intl/it-IT/appengine/docs/java/jrewhitelist.html
I can use the classes: javax.xml.transform.Transformer javax.xml.transform.dom.DOMSource ..... that allow writing to an XML file So I tried to do so: 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); DOMSource sorgente = new DOMSource (doc); StreamResult sr = new StreamResult (dest); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transf; try { transf = tf.newTransformer(); } 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 On Jan 3, 11:41 pm, "a...@mechnicality.com" <a...@mechnicality.com> wrote: > On 1/3/2011 2:29 PM, A. Stevko wrote:> Can you use > com.google.appengine.api.datastore.Text ? > > |Text| wraps around a string of unlimited size. > >http://code.google.com/appengine/docs/java/javadoc/com/google/appengi... > > Nope - its 3D vertex and animation data - basically integer and floating > point binary values. The > whole point of putting it in a blobstore is to avoid having lots of > complicated code on the client > to parse and process the data. The server processes it, caches it, and makes > it available via a > URN-based keying system. > > One possible option is to binhex it, I suppose, but that isn't very > attractive, requiring an extra > processing step on the client. I think I'll just stick to using Amazon EC2 > for my web services! > Thanks for the suggestions, however. > > Regards > > Alan > > > > > > > On Mon, Jan 3, 2011 at 2:12 PM, a...@mechnicality.com > > <mailto:a...@mechnicality.com> > > <a...@mechnicality.com <mailto:a...@mechnicality.com>> wrote: > > > On 1/3/2011 2:05 PM, Matthew Hill wrote: > >> Can't you store it in the DB? -- > > > According to the GAE docs: > > > maximum entity size 1 megabyte > > > Most of my entities *start* at 1 MB and go up to maybe 500+ (its 3D > > data) > > > So, I assumed that, no, I couldn't store it in the DB :-) > > > Alan > > >> You received this message because you are subscribed to the Google > >> Groups "Google Web > >> Toolkit" group. > >> To post to this group, send email to > >> google-web-toolkit@googlegroups.com > >> <mailto:google-web-toolkit@googlegroups.com>. > >> To unsubscribe from this group, send email to > >> google-web-toolkit+unsubscr...@googlegroups.com > >> <mailto:google-web-toolkit+unsubscr...@googlegroups.com>. > >> For more options, visit this group > >> athttp://groups.google.com/group/google-web-toolkit?hl=en. > > > -- > > You received this message because you are subscribed to the Google > > Groups "Google Web Toolkit" > > group. > > To post to this group, send email to google-web-toolkit@googlegroups.com > > <mailto:google-web-toolkit@googlegroups.com>. > > To unsubscribe from this group, send email to > > google-web-toolkit+unsubscr...@googlegroups.com > > <mailto:google-web-toolkit%2bunsubscr...@googlegroups.com>. > > For more options, visit this group > > athttp://groups.google.com/group/google-web-toolkit?hl=en. > > > -- > > -- A. Stevko > > =========== > > "If everything seems under control, you're just not going fast enough." M. > > Andretti > > > -- > > You received this message because you are subscribed to the Google Groups > > "Google Web Toolkit" group. > > To post to this group, send email to google-web-tool...@googlegroups.com. > > To unsubscribe from this group, send email to > > google-web-toolkit+unsubscr...@googlegroups.com. > > For more options, visit this group > > athttp://groups.google.com/group/google-web-toolkit?hl=en. > > -- > Alan Chaney > CTO and Founder, Mechnicality, Inc.www.mechnicality.com -- You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group. To post to this group, send email to google-web-tool...@googlegroups.com. To unsubscribe from this group, send email to google-web-toolkit+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.