Problem with HTTPSession in GWT
Hello everyone I'm new in GWT ... I would like to implement sessions in my Web App Basically I want that a session starts at the click of a button (handle an event) and ends at the click of another button (other handle an event). It's possible? Someone please, can you tell me how to do it step by step? You give me a big help. Is it Okay this code??: Main (client-side): Button b1 = new Button("b1"); b1.addClickHandler(new ClickHandler) { public voin onClick(){ .. rpc.setSession(callback); //rpc call the service... } } Button b2 = new Button("b2"); b1.addClickHandler(new ClickHandler) { public voin onClick(){ .. rpc.exitSession(callback); } } // import com.google.gwt.user.client.rpc.RemoteService; public interface MySession extends RemoteService { public void setSession(); public void exitSession(); } // import com.google.gwt.user.client.rpc.AsyncCallback; public interface MySessionAsync { void setSession(AsyncCallback callback); void exitSession(AsyncCallback callback); } // import de.vogella.gwt.helloworld.client.MySession; public class MySessionImpl extends RemoteServiceServlet implements MySession { HttpSession httpSession; @Override public void setSession() { httpSession = getThreadLocalRequest().getSession(); httpSession = this.getThreadLocalRequest().getSession(); httpSession.setAttribute("b", "1"); } @Override public void exitSession() { httpSession = this.getThreadLocalRequest().getSession(); httpSession.invalidate(); // kill session } } What I do is I connect with my Web application to another web page, if I click the back button of my browser that I return to my web app with the session still alive ... How can I do? I hope I have explained well what my problem ... Thank you and have a nice day JD -- 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. 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.
I can't call a RPC in a FlexTable
Hello there, I have this event in a FlexTable.. flextTable.addClickHandler(new ClickHandler(){ public void onClick(ClickEvent event) { int cellIndex = flexTable.getCellForEvent(event).getCellIndex(); int rowIndex = flexTable.getCellForEvent(event).getRowIndex(); if ((rowIndex==0)||(rowIndex==2)){//se clicco sul primo risultato... rpc.setWeb(flexTable.getText(0,0),flexTable.getText(1,0),callback); . (I define rpc in the main class...) If I launch this method in another part of the code, it work fine. There is a solution?? Thank for reply and good week, Sebe -- 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.
What mean this exception??
7:33:37.803 [ERROR] [de_vogella_gwt_helloworld] Uncaught exception escaped com.google.gwt.core.client.JavaScriptException: (null): null at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java: 237) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java: 126) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java: 561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeBoolean(ModuleSpace.java: 184) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeBoolean(JavaScriptHost.java: 35) at com.google.gwt.user.client.rpc.impl.RpcStatsContext.isStatsAvailable(RpcStatsContext.java) at com.google.gwt.user.client.rpc.impl.RequestCallbackAdapter.onResponseReceived(RequestCallbackAdapter.java: 221) at com.google.gwt.http.client.Request.fireOnResponseReceived(Request.java: 287) at com.google.gwt.http.client.RequestBuilder $1.onReadyStateChange(RequestBuilder.java:395) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java: 39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java: 157) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessagesWhileWaitingForReturn(BrowserChannelServer.java: 326) at com.google.gwt.dev.shell.BrowserChannelServer.invokeJavascript(BrowserChannelServer.java: 207) at com.google.gwt.dev.shell.ModuleSpaceOOPHM.doInvoke(ModuleSpaceOOPHM.java: 126) at com.google.gwt.dev.shell.ModuleSpace.invokeNative(ModuleSpace.java: 561) at com.google.gwt.dev.shell.ModuleSpace.invokeNativeObject(ModuleSpace.java: 269) at com.google.gwt.dev.shell.JavaScriptHost.invokeNativeObject(JavaScriptHost.java: 91) at com.google.gwt.core.client.impl.Impl.apply(Impl.java) at com.google.gwt.core.client.impl.Impl.entry0(Impl.java:214) at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java: 25) at java.lang.reflect.Method.invoke(Method.java:597) at com.google.gwt.dev.shell.MethodAdaptor.invoke(MethodAdaptor.java:103) at com.google.gwt.dev.shell.MethodDispatch.invoke(MethodDispatch.java:71) at com.google.gwt.dev.shell.OophmSessionHandler.invoke(OophmSessionHandler.java: 157) at com.google.gwt.dev.shell.BrowserChannelServer.reactToMessages(BrowserChannelServer.java: 281) at com.google.gwt.dev.shell.BrowserChannelServer.processConnection(BrowserChannelServer.java: 531) at com.google.gwt.dev.shell.BrowserChannelServer.run(BrowserChannelServer.java: 352) at java.lang.Thread.run(Thread.java:619) Someone has already happened? Thanks a lot Sebe -- 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.
deploy GWT app with Tomcat istead GAE..
Hello everyone I have a GWT application, created using the tutorial of Google Code .. but I would deploy it to Tomcat. Can someone tell me the basics to use Eclipse with Tomcat instead of Jetty / Google App Engine? At the moment I'm a bit confused and did not find anything on the Internet that can help me Thanks to all Regards Sebe -- 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.
Re: Write document in Server-side
Alan, thanks for everything ... First, this is a job for a university project, I must not publish it to websites! I need to recover what a user has clicked. Second: G is mandatory to use App Engine with GWT? (required to use Google Search API) Third: if not are there other solutions, you know of any tutorials or sites to tell me to use the database? It 'the only possible solution for my case? Really Thanks Sebe On Jan 4, 7:53 pm, "a...@mechnicality.com" wrote: > On 1/4/2011 10:35 AM, Sebe wrote: > > > I want to create a custom user profile using the Google Search API > > (http://code.google.com/p/gwt-google-apis/wiki/ > > AJAXSearchGettingStarted). With these APIs can retrieve the results of > > a Google's search engine (web, image, video ). Here's what I do: > > when the user "Foo" click on a result, the information must be stored > > in a custom file for user "foo " (for example foo.xml . > > > I create me a custom profile for each user that contains the values > > that a user clicks from search results page. > > > Sorry for my english ... > > > I do not know if I explained it well .. > > > Sebe > > If you want to use GAE (or really any other kind of server) for this > solution, you should learn > about database entities. > > GAE won't let you write files. Other web app servers will, but anyway, > writing a file each time the > user clicks on your form is a very, very, very bad idea! I don't really have > the time to explain why > I think its such a bad idea, but, really, it is. I've developed a large > number of web applications > on different platforms in both Java and PHP, including a large music > aggregation site and number of > "user created content" sites and learning about how databases work is a key > requirement for any > modern web programmer. > > I'm trying to say this as simply as possible - GAE is a platform which > already has mechanisms to do > what you want to do. It provides a persistent store using two mechanisms, JDO > and JPA, which are > meant for exactly the kind of application you have in mind. Please read about > these and work through > the examples. > > As a very brief introduction, to store and retrieve your data you could > create an 'entity' which > contains the information the user provides. That entity can be a simple POJO, > with just a few > getters and setters. Then you can map that to the database and all the work > will be done for you. > > If you need to make that entity available as an XML file then you can create > a Restful service that > will do it for you. > > Good luck! > > 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-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.
Re: Write document in Server-side
I want to create a custom user profile using the Google Search API (http://code.google.com/p/gwt-google-apis/wiki/ AJAXSearchGettingStarted). With these APIs can retrieve the results of a Google's search engine (web, image, video ). Here's what I do: when the user "Foo" click on a result, the information must be stored in a custom file for user "foo " (for example foo.xml . I create me a custom profile for each user that contains the values that a user clicks from search results page. Sorry for my english ... I do not know if I explained it well .. Sebe On Jan 4, 7:26 pm, "a...@mechnicality.com" wrote: > Sebe > > On 1/4/2011 9:40 AM, Sebe wrote: > > > HI, > > I have already discussed here but did not find what I was looking for > > (http://groups.google.com/group/google-web-toolkit/browse_thread/ > > thread/e7a880a22a129bfa?hl=en). > > > For my web application I use GWT 2.1.0 with Eclipse 1.3.8 and App > > Engine. > > I would like to write the values obtained as a parameter (from the > > TextBox) in an XML file. > > I know that is not possible to write client-side file. But I think you > > can do in server-side. > > > I set the RPC call (see the tutorial). > > I can not use the java.io.File class to write (because G App Engine > > does not provide for this class, I saw here: > >http://code.google.com/intl/it-IT/appengine/docs/java/jrewhitelist. > > html). > > > But I can use classes to write to files as Transform and DOMSource .. > > I'd be surprised in you could... see: > > http://code.google.com/appengine/kb/java.html#writefile > > - it says: > > "Writing to local files is not supported in App Engine due to the distributed > nature of your > application. Instead, data which must be persisted should be stored in the > distributed datastore > <http://code.google.com/appengine/docs/java/datastore/overview.html>. For > more information see the > documentation on the runtime sandbox > <http://code.google.com/appengine/docs/java/runtime.html#The_Sandbox>." > > In fact, in the whitelist java.io.File is shown as being supported, but I > think that's to allow you > to READ files which are part of the uploaded application. You cannot write a > file to the local > filing system - its simply not allowed. > > As others said earlier, you can persist data in the data base. > > Please explain *why* you want to write an XML file to the server filing > system. What is your use > case? It looks like you are trying to store user data (name password etc.) > The correct way in GAE to > do this is to create a persistent entity and store the info in the database. > > Alan > > > > > This is my code in 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 { > > > /* > > //implementazione del metodo funzionante > > public String testRPC(String message) > > { > > Date now = new Date(); > > String dtm = > > DateFormat.getTimeInstance(DateFormat.MEDIUM).format(now); > > > return "Ecco il messaggio inviato '" + message +"' > > quando sono > > precisamente le : " + dtm; > > } > > */ > > > //metodo che inserisce il nuovo iscritto > > public void creaXML(String nickname,String pass,String email2,String > > gio,String mes, String ann){ > > > /* > > XML format (keywords are space delimited): > > <--gi� presente > > > > ... > > ... > > ... > > > > ... > > ... > > ... > > > > > > > > */ > > > String dest = "utenti.xml"; > >
Write document in Server-side
System.out.println("ci sono"); try{ DOMSource sorgente = new DOMSource (doc); StreamResult sr = new StreamResult (dest); TransformerFactory tf = TransformerFactory.newInstance(); Transformer transf = tf.newTransformer(); transf.transform(sorgente,sr); } catch (TransformerConfigurationException tce) { System.out.println(tce.getMessage()); } catch (TransformerException te) { System.out.println(te.getMessage()); } } } If I start the application I have this 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) ... Can anyone tell me if I'm doing the right thing? What error? Thank you all for further clarification Regards Sebe -- 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.
Re: How to write file with GWT?
I was wrong to write the code on the server-side .. 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 ()); } now gives me this 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 is it? Thank very much On Jan 4, 11:46 am, Sebe wrote: > 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 callback); > > void creaXML(String nickname,String pass,String email2,String > gio,String mes, String ann,AsyncCallback 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.*;
Re: How to write file with GWT?
c.getDocumentElement(); //root= 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: - WEB.XML http://java.sun.com/dtd/web-app_2_3.dtd";> De_vogella_gwt_helloworld.html rPCImpl de.vogella.gwt.helloworld.server.MyServiceImpl rPCImpl /de_vogella_gwt_helloworld/rpc - 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" 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> > > mailto:a...@mechnicality.com>> wrote: > > > On 1/3/2011 2:05 PM, Matthew Hill wrote: > >> Can
Re: How to write file with GWT?
Sorry, but if I disable GAE from Eclipse, I do not run the application. Possible solutions? Where did I go wrong in the code? Thanks to all Regards Sebe On Jan 3, 11:43 pm, "a...@mechnicality.com" wrote: > This one is pretty interesting - I'll look into it further. > > Thanks agai > > Alan > > On 1/3/2011 2:37 PM, A. Stevko wrote: > > > > > I bookmarked this blog entry a while ago which has a recipe for posting > > into the blobstore from > > app engine. > >http://jeremyblythe.blogspot.com/2010/10/manipulating-images-in-blobs... > > > One other note - I suspect using the ByteArrayOutputStream for hundreds of > > megabytes is going to > > run into the java runtime memory limit. I'm not sure what the limit is. The > > error logs show > > "Exceeded soft memory limit with"... > > > On Mon, Jan 3, 2011 at 2:29 PM, A. Stevko > <mailto:andy.ste...@gmail.com>> > > 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... > > > On Mon, Jan 3, 2011 at 2:12 PM, a...@mechnicality.com > > <mailto: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 at > >> http://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 > > > -- > > -- 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.
Re: How to write file with GWT?
Vi posto il mio caso cosi vedete dove sbaglio (grazie in anticipo): CLIENT SIDE: final String nickname=textNickReg.getText(); final String pass=textPassReg.getText(); final String email2=textMail.getText(); final String gio=valueListBoxGG.getValue().toString(); final String mes=valueListBoxMM.getValue().toString(); final String ann=valueListBoxAA.getValue().toString(); RequestBuilder builder = new RequestBuilder(RequestBuilder.POST, url); try{ Request response = builder.sendRequest(url, new RequestCallback() { public void onError(Request request, Throwable exception) { Window.alert("errore nel sistema"); } public void onResponseReceived(Request request, Response response) { Document xmlDoc = XMLParser.parse(response.getText()); Element root = xmlDoc.getDocumentElement(); // root= Element utente = xmlDoc.createElement("utente"); root.appendChild(utente); Element nick = xmlDoc.createElement("nick"); Text nickTest = xmlDoc.createTextNode(nickname); Element password = xmlDoc.createElement("psw"); Text pswTest = xmlDoc.createTextNode(pass); Element email = xmlDoc.createElement("mail"); Text mailTest = xmlDoc.createTextNode(email2); Element datan = xmlDoc.createElement("datan"); utente.appendChild(datan); String rooto = root.toString(); RPCService rpc = new RPCService(); rpc.testRPC(rooto, 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); } --- package de.vogella.gwt.helloworld.client; import com.google.gwt.user.client.rpc.AsyncCallback; public interface MyServiceAsync { void testRPC(String message, AsyncCallback callback); } --- 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); } } - SERVER SIDE: package de.vogella.gwt.helloworld.server; import java.text.DateFormat; import java.util.Date; import java.io.*; import de.vogella.gwt.helloworld.client.MyService; import com.google.gwt.user.server.rpc.RemoteServiceServlet; public class MyServiceImpl extends RemoteServiceServlet implements MyService { //implementazione del metodo public String testRPC(String message) { Date now = new Date(); String dtm = DateFormat.getTimeInstance(DateFormat.MEDIUM).format(now); FileOutputStream fos; DataOutputStream dos; //ERROR!!! try { BufferedWriter out = new BufferedWriter (new FileWri
Re: How to write file with GWT?
Hi Alan, thanks for the response I can not figure out is how to save content from client-side textbox as a parameter via an XML file. The work to be done into server's package right? I'm working with Eclipse and I use Google Apple Engine.. You know give me a hand? Or know of a tutorial that explains how it works? I'm desperate .. Thanks very much Regards On Jan 3, 4:46 pm, "a...@mechnicality.com" wrote: > The stack trace says it all... > > com.example.foobar.client.RPCInterface.testRPC (java.lang.String)' > Threw an unexpected exception: java. lang.NoClassDefFoundError: > java.io.FileWriter is a restricted class. Please see the Google App > Engine developer's guide for more details. > > You appear to have your test module in the com.example.foobar.client package. > > ^ > > This means that the GWT compiler will compile that module and it looks to me > like that contains a > reference to java.io.FileWriter - as the stack trace message says, the > developer's guide will > explain to you exactly what the problem is but the 'executive summary' is > that java.io.FileWriter > can't be used in GWT 'client' code because it can't be compiled to > Javascript. > > The rule in GWT is: > > 1. things that will only be run as javascript on the client should be in the > your.module.client.* > packages > 2. things that will only be run on the server should be in the > your.module.server.* packages > 3. things that will be shared by the client code should be in the > your.module.shared.* packages - > IMHO these should be kept to a minimum. > > You must make sure that you have both client and shared in the > your.module.Module.gwt.xml file > > Java classes used in 1. and 3. above must be restricted to those classes > supported by the GWT > compiler - see > > http://code.google.com/webtoolkit/doc/latest/RefJreEmulation.html > > for more details. Its all in the docs or has already been covered on this list > > HTH > > Alan > > On 1/3/2011 6:19 AM, Sebe wrote: > > > Hello to all ... > > I have to write an XML doc with GWT. I discovered that you can not do > > client-side but it can be done with server-side. > > > So I setup the synchronous and asynchronous client-side: > > > package com.example.foobar.client ; > > > import com.google.gwt.user.client.rpc.RemoteService; > > > public interface extends RPCInterface RemoteService { > > > testRPC public String (String message); > > } > > -- > > - > > > package com.example.foobar.client ; > > > import com.google.gwt.user.client.rpc.AsyncCallback; > > > public interface RPCInterfaceAsync { > > > testRPC void (String message, AsyncCallback callback); > > > } > > -- > > --- > > > while on the server-side I did: > > > import java.io.BufferedWriter; > > import java.io.DataOutputStream; > > import java.io.FileOutputStream; > > import java.io.FileWriter; > > import java.io.IOException; > > import java.text.DateFormat; > > import java.util.Date; > > > import com.google.gwt.user.server.rpc.RemoteServiceServlet; > > import com.example.foobar.client.RPCInterface; > > > public class extends RPCImpl RemoteServiceServlet implements > > RPCInterface { > > private static final long serialVersionUID = 1L; > > > testRPC public String (String message) > > { > > > Date now = new Date (); > > Dtm DateFormat.getTimeInstance String = (DateFormat.MEDIUM.) Format > > (now); > > > try { > > BufferedWriter out = new BufferedWriter (new FileWriter ("test.txt")); > > out.write (message); > > out.close (); > > } Catch (IOException e) { > > } > > > return "This is my message" + message; > > > } > > > } > > -- > > -- - > > I have not forgotten anything in the matter, because before you use > > the class FileWriter and BufferedWriter the program run smoothly. > > I have these errors: > > > ERROR] javax.servlet.ServletContext log: Exception while dispatching > > incoming RPC call > > com.google.gwt.user.server.rpc.UnexpectedException: Service method > > 'public abstract
How to write file with GWT?
Hello to all ... I have to write an XML doc with GWT. I discovered that you can not do client-side but it can be done with server-side. So I setup the synchronous and asynchronous client-side: package com.example.foobar.client ; import com.google.gwt.user.client.rpc.RemoteService; public interface extends RPCInterface RemoteService { testRPC public String (String message); } -- - package com.example.foobar.client ; import com.google.gwt.user.client.rpc.AsyncCallback; public interface RPCInterfaceAsync { testRPC void (String message, AsyncCallback callback ); } -- --- while on the server-side I did: import java.io.BufferedWriter; import java.io.DataOutputStream; import java.io.FileOutputStream; import java.io.FileWriter; import java.io.IOException; import java.text.DateFormat; import java.util.Date; import com.google.gwt.user.server.rpc.RemoteServiceServlet; import com.example.foobar.client.RPCInterface; public class extends RPCImpl RemoteServiceServlet implements RPCInterface { private static final long serialVersionUID = 1L; testRPC public String (String message) { Date now = new Date (); Dtm DateFormat.getTimeInstance String = (DateFormat.MEDIUM.) Format (now); try { BufferedWriter out = new BufferedWriter (new FileWriter ("test.txt")); out.write (message); out.close (); } Catch (IOException e) { } return "This is my message" + message; } } -- -- - I have not forgotten anything in the matter, because before you use the class FileWriter and BufferedWriter the program run smoothly. I have these errors: ERROR] javax.servlet.ServletContext log: Exception while dispatching incoming RPC call com.google.gwt.user.server.rpc.UnexpectedException: Service method 'public abstract java.lang.String com.example.foobar.client.RPCInterface.testRPC (java.lang.String)' Threw an unexpected exception: java. lang.NoClassDefFoundError: java.io.FileWriter is a restricted class. Please see the Google App Engine developer's guide for more details. at com.google.gwt.user.server.rpc.RPC.encodeResponseForFailure (RPC.java: 378) at com.google.gwt.user.server.rpc.RPC.invokeAndEncodeResponse (RPC.java: 581) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processCall (RemoteServiceServlet.java: 207) at com.google.gwt.user.server.rpc.RemoteServiceServlet.processPost (RemoteServiceServlet.java: 243) at com.google.gwt.user.server.rpc.AbstractRemoteServiceServlet.doPost (AbstractRemoteServiceServlet.java: 62) at javax.servlet.http.HttpServlet.service (HttpServlet.java: 713) at javax.servlet.http.HttpServlet.service (HttpServlet.java: 806) at org.mortbay.jetty.servlet.ServletHolder.handle (ServletHolder.java: 511) at org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter (ServletHandler.java: 1166) at com.google.appengine.api.blobstore.dev.ServeBlobFilter.doFilter (ServeBlobFilter.java: 58) at org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter (ServletHandler.java: 1157) at com.google.apphosting.utils.servlet.TransactionCleanupFilter.doFilter (TransactionCleanupFilter.java: 43) at org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter (ServletHandler.java: 1157) at com.google.appengine.tools.development.StaticFileFilter.doFilter (StaticFileFilter.java: 122) at org.mortbay.jetty.servlet.ServletHandler $ CachedChain.doFilter (ServletHandler.java: 1157) at org.mortbay.jetty.servlet.ServletHandler.handle (ServletHandler.java: 388) at org.mortbay.jetty.security.SecurityHandler.handle (SecurityHandler.java: 216) at org.mortbay.jetty.servlet.SessionHandler.handle (SessionHandler.java: 182) at org.mortbay.jetty.handler.ContextHandler.handle (ContextHandler.java: 765) at org.mortbay.jetty.webapp.WebAppContext.handle (WebAppContext.java: 418) at com.google.apphosting.utils.jetty.DevAppEngineWebAppContext.handle (DevAppEngineWebAppContext.java: 70) at org.mortbay.jetty.handler.HandlerWrapper.handle (HandlerWrapper.java: 152) com.google.appengine.tools.development.JettyContainerService at $ ApiProxyHandler.handle (JettyContainerService.java: 349) at org.mortbay.jetty.handler.HandlerWrapper.handle (HandlerWrapper.java: 152) at org.mortbay.jetty.Server.handle (server.jar: 326) at org.mortbay.jetty.HttpConnection.handleRequest (HttpConnection.java: 542) org.mortbay.jetty.HttpConnection at $ RequestHandler.content (HttpConnection.java: 938) at org.mortbay.jetty.HttpParser.parseNext (HttpParser.java: 755) at org.mortbay.jetty.HttpParser.parseAvailable (HttpParser.java: 218) at org.mortbay.jetty.HttpConnection.handle (HttpConnection.java: 404) at org.mortbay.io.nio.SelectChannelEndPoint.run (SelectChannelEndPoint.java: 409) org.mortbay.thread.QueuedThreadPool at $ PoolThread.run (QueuedThreadPool.java: 582)
obtain search's results for other pages
Hello everyone .. To view the results of a search using a Java WebApp use this code: control.addSearchResultsHandler (new SearchResultsHandler () { public void onSearchResults (SearchResultsEvent event) { JsArray event.getResults results = (); for (int i = 0; i http://groups.google.com/group/google-web-toolkit?hl=en.
Problem using CSS...
Hello everyone .. First, sorry for my English. I have a problem that I can not fix using a web application. That is, it's weird. Using the GWT plugin for Eclipse, I can create a web application that already gives me the default client side and server as the html page where to start the webapp and the associated style sheet. By putting a little widget they can "change" through the method setStyleName (String style) where an associate style by inserting the sheet. css. {} style passed as a parameter in the method. The strange thing is that, trying again today with new widgets can not be made to the formatting. It 's like if you did not read the new rule included. I tried in every way: - I commented on the reference to the css in the HTML page but with the previous widget style rule "running" back to the default system (that means you find the style sheet) - assigning the style "old " (whatever works for instance) to the new widget formats them .. - So the question is on the inclusion of new rules, which again, I tried again many times, but not me the notes (the widgets do not change a comma) Does anyone have any suggestions? It 's very important to me ... Waiting for an answer, thank you all. Greetings -- 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.
How to write an XML doc with GWT?
By the Panel can retrieve values through the class and documents XMLParser com.google.gwt.xml.client .*; Now I would write / save to file. xml. I tried with the class Transformer (not good because it's the books javax.dom ..) and even with a BufferedReader raising exceptions. Does anyone have an idea on how to implement it? There would be very grateful ... Sebe -- 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.
Writing to an XML file
Hello everyone, I'm new in GWT, and I can not solve a problem. I can not write to an XML file. I tried to look at the documentation but I did not understand much. Someone can give me a hand? Thank you for your cooperation! -- 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.