Re: GWT + UI Design (best practices)
On Mon, Oct 19, 2009 at 4:54 AM, Thomas Broyer t.bro...@gmail.com wrote: The problem is that your designer won't use ui:mph or GWT widgets, and it probably won't use CssResource specific syntax helpers (@def, @if user.agent ie6 { }, etc.) so you'll have to copy/paste/adapt, and rinse/repeat when the designer has/wants to change something. Ideally (imo), the designer will start by making a pure HTML mockup and then transform it into an *.ui.xml, and only then the programmer enters into play (eventually tweaking the ui.xml to add ui:field and the like; ideally in coordination with the designer) Right I suppose that is the best solution for now.UIBinder is GWT2.0 only, correct? I havn't made the change yet, I am still using 1.7. Last night I did some design work using normal design tools (Fireworks,Photoshop etc), and as long as you are good about labeling the items so the CSS exports correctly (with readable/usable names). It is possible to get fairly GWT-friendly CSS. Then I just have to create my basic controls in GWT and give them the same label names for styles and everything seems to work. One thing that helped alot was following this trick: http://blog.sudhirj.com/2009/05/vertical-and-horizontal-flow-panels-in.html That gives you div-only based horizontal/vertical flow panels. It always confused me as to why I kept losing styles when I would implement HorizontalPanels or VerticalPanels. I guess that is just one of those situations where you need some old-school CSS/HTML knowledge. Cause while GWT lowers the bar so application-centric developers (like myself) can get involved, it doesn't COMPLETELY hide us from needing that basic CSS information. Sometimes I forget that! :) Anyway, thanks for the help. I look forward to digging into UIBinder when 2.0 is released. -pj --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
GWT + UI Design (best practices)
I have used GWT for a while now, both on a large project and on small experimental projects. However, I am still somewhat of a newbie... One thing I am confused about is the ideal workflow for a UI designer when working with a GWT project. In a perfect world, I would want everyone to be working on something that would actually be used, even in the design phase. However, if a designer makes a HTML mockup of a design, how can I leverage that in GWT? What do other projects do?Other than using some of the CSS and the images by hand, I see no way to easily use the html itself.Is this what UIBinder is supposed to provide? I really want something that would take in a html design and spit out the GWT source code. -pj --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Read Xml File from RPC Servlet
Good you solved your problem. But you should really check out this page on the gwt incubator...might help you with your login process, and making it (more) secure: http://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecurityFAQ -pj On Sat, Oct 3, 2009 at 6:18 PM, Nickelnext nickeln...@gmail.com wrote: It really was a stupid question. I solved the problem, simply using a java class. That's why i did not found anything on the web :P Bye all! --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
(de)Serialization of gwt rpc objects
My project works fine under hosted mode, but I tried a test deployment last night and ran into issues with deserializing gwt rpc objects. It looks to me like the serialization is working fine, and finding the gwt.rpc whitelist file, which lists my various classes. However, once on the server, it complains that the object cannot be deserialized due to security issues with using java.io.serializable. I suspect that this might be a problem specific to my deployment, but I thought I would ask to see if anyone had any suggestions. Everyone seems to quote directly from the FAQ the line ...the serialization policy file must be deployed to your web server as a public resource and needs to be accessible from a *RemoteServiceServlethttp://google-web-toolkit.googlecode.com/svn/javadoc/1.4/com/google/gwt/user/server/rpc/RemoteServiceServlet.html * via *ServletContext.getResource()http://java.sun.com/products/servlet/2.3/javadoc/javax/servlet/ServletContext.html#getResource%28java.lang.String%29 *. If the serialization whitelist policy file is not deployed properly, your GWT application will run in 1.3.3 compatibility mode and refuse to serialize types implementing *java.io.Serializable*. However, as I said, the whitelist policy file IS found, cause the objects are serialized. However, (heres the rub), on my server I share a tomcat server with other customers of my ISP, thus the ISP forces me to put my WEB-INF in a 'servlet' folder of my public_html. I have to change the servlet mappings in my xml file to make this work. I am assuming that due to this weirdness the gwt.rpc file is not found on the server side, thus cannot deserialize? That would make sense, but I just can't figure out where to put it!The faq is extremely non-helpful with its must be deployed properly, uggg. Anyone know more details on this? Or have any suggestions? thanks in advance! -pj --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: CommandPattern vs Server side Event Bus?
Yeah, I have thought the same thing as I was implementing MVP/CommandPattern. I have a few eventbus events that I handle with EventHandlers, but then I have the whole gwt rpc mechanism that uses my own generic action classes. Combining the two might be a good move, however it might get tricky crossing the great wall of javascript. I am no gwt expert, so I don't know how tight a coupling you can get from your server side stuff and GwtEvent (assuming you still want to use eventhandlers). I am sure its doable though. -pj On Tue, Sep 29, 2009 at 3:37 PM, Chris christopher.burr...@gmail.comwrote: Just had a quick question... I can see the benefits of the CommandPattern to some extent, what I'm not sure about is why, if we're using an Event Bus on the client side, one might not try and use an event bus on the server side too with an event bridge (you might say) in the middle. - Each event would define whether it propagates to the server. - The clients would be listening for events and all they would see is their relevant events being fired. They wouldn't know whether the event originated from the server and the client. - The server components would be listening on to the server-side event bus. In this case, the server would just fire off its response in the form of an event that all other server components could see and if need be this would propagate to the clients. Just wondering what people think of that pattern? I'm rather new to GWT and want to make my app as simple as possible, and it seems to me it would be rather nice if my Client Module says: I need a list of names, Server Module sees message someone needs a list of names. Server Module says Someone needed a list of names and here it is... I guess in that way, the response can be shared by many clients. The bridge in the middle could do some caching/filtering in the middle, since clearly not all events would need to be propagated to the server... Just some thoughts... --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: advantages of hibernate
Hello, I was in a similar situationlots of technology around and everyone seems to talk about hibernate.As far as I can tell, the advantages are being able to refer to your objects AS OBJECTS, yet have them persisted in the database. ie: you don't have to write the code to persist them yourself. If you were making a huge app, this might be necessary. For smaller operations, I think the best bet is just writing the resultset code yourself.You get better control over what happens, and personally, I think its always better to understand whats going on behind the scenes before I jump into the new automated way of doing things. Plus, there is always: K.I.S.S. -pj On Fri, Sep 25, 2009 at 9:26 AM, ces princess_ce...@yahoo.com wrote: Hi guys! I'm new in GWT... I want to create a web app that will show a table from a database and I would like to know if I should use Hibernate and not the usual way in Java of fetching data from DB (i.e. resultset)? What are its advantages? thanks in advance for any information you'll give... :D --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Cookies and RPC
Client side (cookie gets stored in the users browser). But looking at your whole question, it appears you are doing some sort of user authentication? (ie: sign on).You should read this FAQ: http://code.google.com/p/google-web-toolkit-incubator/wiki/LoginSecurityFAQ Describes using session id's, and using BCrypt. -pj On Thu, Sep 24, 2009 at 9:31 AM, Thomas Holmes thomas.j.hol...@gmail.comwrote: Yep, I found that API when I did a Google Search ... So, I tried the code: String cookie = Cookie.getCookie (myCookieName); And I must have got some sort of error, because my code stopped, and there were no other log statements. So, I guess I was asking if this code has to be on the client side, server side, or both? Thanks! Tom On Sep 23, 11:01 pm, Dominik Steiner dominik.j.stei...@googlemail.com wrote: Hi Tom, not sure I understand yourcookiequestion, but in GWT you can query for cookies using the class com.google.gwt.user.client.Cookie and there have a look at the method /** * Gets thecookieassociated with the given name. * * @param name the name of thecookieto be retrieved * @return thecookie'svalue, or codenull/code if thecookie doesn't exist */ public static String getCookie(String name) So in your GWT code you would check if acookieexists like this Stringcookie=Cookie.getCookie(myCookieName); if(cookie!= null){ //cookieexists } HTH Dominik On 23 Sep., 12:00, Thomas Holmes thomas.j.hol...@gmail.com wrote: I have the demo StockWatcher Application working. I have client/ server side code working for the most part. I can use a Spring DAO class, make a call to the database to get Hibernate POJO's, and then convert that data to GWT-RPC DTO classes ... seems to work ok. I am using a TestAdvDataSource demo app for SmartGWT and GWT-RPC DataSource, and it is coming along well. Just having a few issues getting the data to appear, but I am working on that. So ... the question is, in my existing Spring Application, a user is capable of signing on and I put the users ID in acookie. So, where do I get thecookie? Do I get it from the server/TestServiceImpl code? I expect I would get the cookies from the request, and be able to use that data to filter what I want from the database. Or, would I get thecookiein the client/TestDataSource code and then pass that as an argument to the server/TestServiceImpl? Thanks! Tom --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
GWT + mysql (noob questions)
I am writing a fairly large web app using GWT in Eclipse.My background is as a c++ desktop developer, so while I have used java before, sometimes I stumble on easy stuff. Anyway, I am currently attempting to implement a database to store data from my webapp. I am far from an expert in SQL, but I have done some desktop programming of SQL before, so I feel comfortable enough doing SELECTs and whatnot. (Most recently I did some development using the iPhone Sqlite stuff). Can someone point me to a good tutorial or something that gives an example of storing simple user data in a database from a GWT app? I found a servlet based java/mysql example, so I am concentrating on classes like datasource right now. I can only assume the SQL stuff needs to be contained on the server side of a GWT app anyway, so I was going to start there. But I had questions like: - what is the process for connecting to a database in hosted mode? Is just left to me to get something like MySql installed locally, and then follow instructions like listed here ( http://humblecode.blogspot.com/2009/05/gwt-16-using-jndi-datasource.html) in order to connect? - when I do deploy to a live webserver, is it just a matter of switching the database config (username/password, database name etc)? (as long as I have everything setup in mysql on my live webserver obviously) - how does 'Hibernate' fit into all this? I read about it, and see it mentioned everywhere.It looks like a library for persisting my java objects in the database, rather than pulling information out of my objects and storing the data only? Is that accurate?If so, I could write my persistance layer in such a way that I could start by storing the data raw (Strings, longs whatever), then later as my app becomes more complex, I could implement Hibernate to start storing my model objects directly? Thanks in advance! -pj --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: GWT + mysql (noob questions)
Thanks for the information. I feel fairly comfortable with GWT and GWT-RPC now. I implemented the command pattern MVP pattern as per Ray Ryans talk, for my communication over RPC. That gave me a pretty good crash course! I am sure there are details in there I'll be learning along the way though! As for Hibernate, I am just trying to decide if its something to invest time in now. Cause I really hate using technology just for whiz-bang/bandwagon reasons. It sounds like hibernate, when integrated into my app, allows me to avoid having to worry about the lower level SELECTs parsing results etcetc? All that code is handled by hibernate, so I can just make calls to classes for accessing/storing data and everything is persisted behind the scenes for me by hibernate? Is that correct? -pj On Wed, Sep 23, 2009 at 12:30 PM, Trevis trevistho...@gmail.com wrote: I dont have any tutorials at hand but your understanding of where the DB code lies is correct. It's totally on the server side and has nothing to do with GWT. Your GWT app would get access to the data via RPC. The RPC methods would in turn get data from the DB. Hibernate is an ORM (object relational mapper) which allows you to tie Classes to DB tables in a way that is largely transparent to your application. One problem though in using hibernate with GWT is that the classes created via hibernate cant be serialized to the client via RPC (not that i know of anyway) so a lot of people use different libraries to make clones of the faux-POJO's so that they can be serialized. (I do this in the project that i'm working on but i did it by hand) (um, POJO means plain old java object). If you're interested in using hibernate you should probably use it from the start because retrofitting the application after the fact would on undoubtedly be extremely painful. But with that said and with as much as i love hibernate if you're using all of these new technologies together for the first time you may become overwhelmed and hibernate is a fairly involved framework so you might be better off getting a good grip on GWT and GWT's RPC mechanism first. but as always, ymmv On Sep 23, 10:53 am, PJ Gray pj4...@gmail.com wrote: I am writing a fairly large web app using GWT in Eclipse.My background is as a c++ desktop developer, so while I have used java before, sometimes I stumble on easy stuff. Anyway, I am currently attempting to implement a database to store data from my webapp. I am far from an expert in SQL, but I have done some desktop programming of SQL before, so I feel comfortable enough doing SELECTs and whatnot. (Most recently I did some development using the iPhone Sqlite stuff). Can someone point me to a good tutorial or something that gives an example of storing simple user data in a database from a GWT app? I found a servlet based java/mysql example, so I am concentrating on classes like datasource right now. I can only assume the SQL stuff needs to be contained on the server side of a GWT app anyway, so I was going to start there. But I had questions like: - what is the process for connecting to a database in hosted mode? Is just left to me to get something like MySql installed locally, and then follow instructions like listed here ( http://humblecode.blogspot.com/2009/05/gwt-16-using-jndi-datasource.html) in order to connect? - when I do deploy to a live webserver, is it just a matter of switching the database config (username/password, database name etc)? (as long as I have everything setup in mysql on my live webserver obviously) - how does 'Hibernate' fit into all this? I read about it, and see it mentioned everywhere.It looks like a library for persisting my java objects in the database, rather than pulling information out of my objects and storing the data only? Is that accurate?If so, I could write my persistance layer in such a way that I could start by storing the data raw (Strings, longs whatever), then later as my app becomes more complex, I could implement Hibernate to start storing my model objects directly? Thanks in advance! -pj --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Eclipse client server separation
I don't understand what the problem is that the original poster is having? I have Client/Server/Shared folders for implementing the command pattern and it seems to be working fine. I have compiled to javascript and run under a browser as well. I took most the ideas from the gwt-dispatch project ( http://code.google.com/p/gwt-dispatch/) They also have a client/server/shared structure in their code. -pj On Wed, Sep 23, 2009 at 12:33 PM, David Durham david.durham...@gmail.comwrote: I tried creating a working development environment with 3 projects: - Client - Server - Shared It was very complicated and needed a symbolic link from Shared to client - for the compilation to JavaScript. I think you have a decent plan, creating 3 projects. You should not need symbolic links if you're using the GWT module concept properly. http://code.google.com/webtoolkit/doc/1.6/DevGuideOrganizingProjects.html#DevGuideModules -Dave --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: Testing MVP Applications when using Overlay Types
Couldn't you do something like make the class that actually does the parsing be a dependency of the callback (ie passed in). Then create a mock version of that class that just returns whatever data (for verification)? This mock version wouldn't be based off the JSNI overlay abstract class, while your 'real' one was.Heck if you wanted, you could always implement the JSON parsing by hand for the mock class, without using the overlay.it is, after all, just a way of making parsing easier, correct? Then your testing could verify not only the flow of your app, but the JSON parsing as well. -pj On Wed, Sep 23, 2009 at 3:05 PM, Matt Raible m...@raibledesigns.com wrote: Hello all, I've recently converted my GWT application to use MVP, specifically using the gwt-presenter project. I'm also using Overlay Types and RequestBuilder to talk to JSON-based services on the backend. Since Overlay Types use JSNI, it's not possible to do any JSON parsing in unit tests. The problem with not being able to do any JSON parsing is the callbacks will often call eventBus.fireEvent(GwtEvent) after the JSON parsing has happened. This means I can't fully test the flow of a presenter if event firing happens in a callback. I wrote up a detailed explanation of this issue on my blog[1]. Does anyone here have any suggestions on how I might go about solving this problem? Thanks, Matt [1] http://raibledesigns.com/rd/entry/building_gwt_applications_with_mvp --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
(Issue 2374) Generic Methods on RPC....
(I posted this to the gwt-dispatch list, but figure I'd mention it here toolarger audience and whatnot) I am implementing the command pattern as per Ray Ryan's fantastic talk. I have it working, however I ran across a known issue in GWT when implementing my servlet (Which Ray Ryan skips over in his talk :) ).If you implement your actions/responses exactly as he has them in the slides, your servlet won't work, due to what appears to be a bug in the GWT (issue 2374). Basically, the wrong code gets generated due to the use of templates, and when the servlet tries to match up the required methods in the service, it can't find your execute method, even though you have implemented it. I worked around it like so: (in my rpcserviceimpl.java) public T extends Response T execute(ActionT action) { if (action.getClass().equals(MyActionClass.class) ) return (T) execute( (MyActionClass) action ); // actually I throw if i get here, but to keep this short return null; } Obviously, not type safe, but if my action class matches, then the return type better be MyActionResponse or I have a bigger issue! I noticed another command pattern implementation on google code that worked around this issue by passing the action class in an annotation, however I couldn't tell from that code if that workaround/hack was any better than mine above. Would using the annotation make it type safe? Is what I have the best work around for now? Is this working on trunk GWT 2.0?Is there a different work around I am not seeing? -pj --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Vertical Collapsible Panel?
I was looking around at some of the custom widget libraries (gwt-ext etc), and I like the collapsible panel widget a bunch, but I was wondering if anyone knew of a library that made one that is vertical, and opens to form a column-ish panel.So you could have a bunch of vertical bars, click on a bar and open a panel? thanks in advance! -pj --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Re: GWT + Eclipse + Subversion?
Thanks for the help. I messed around with it a bit more, and just kept getting frustrated. Uggg, just isn't this hard if I want a non-integrated solution in XCodewhy is it here? Anyway, I settled on just zipping up my whole folder and putting the zip in source control. Big hammer solution, I know...but whatever, I was wasting too much time figuring out stuff that should 'just work'. When I get some free cycles I'll take my questions to an Eclipse related forum and maybe make some progress. thanks again! (just got twitter oauth working in my GWT app last night! woohoo!!!) -pj On Sat, Sep 12, 2009 at 3:33 PM, Jeff Chimene jchim...@gmail.com wrote: On 09/12/2009 10:41 AM, PJ Gray wrote: So maybe I am not fully understanding the versioning situation. I did some research last night, and attempted to get my project under source control, without any luck. It appears to me that I am required to use Subclipse as my subversion client because of some special way that Eclipse handles projects? I don't think so. I think Subclipse is popular because it's a good Subversion client. However, there may be other Eclipse Subversion clients. If that is the case, then I suppose I'll take my question to an Eclipse-specific forum. However, it seems like I should be able to use whatever client I want! Probably not in the way that I think you mean that statement. Eclipse SVN clients are designed to integrate into the Eclipse environment. It's not really a matter of bolting-on any SVN client. IDE users expect the functional bar to be set higher than that. I have to admit that I don't know Versions, but even if it is a GUI, and there is no Eclipse plugin, it's only going to work as an external to Eclipse. If you rely want to stick with Versions, you'll have to figure out why Eclipse lost its mind when the source went into SVN. However, when I would add things mentioned in these emails to source control on my desktop, then checkout on my laptop, the GWT project was no longer listed in the Eclipse workspace. Even when I added everything in the hidden folders to source control, it still wasn't listed in the workspace. I couldn't find the special sauce that told Eclipse that my project was part of the workspace, and how it was configured. Just to be clear: you ADDed the source of an existing Eclipse project to Subversion via Versions? I'm guessing that somehow that shifted the project contents underneath Eclipse, and it got confused. But, I can't really tell from this description. It sounds like the next step is to get a working Eclipse project back. I'd checkout the SVN source and then import it as an existing project (since you added the Eclipse .project and .settings/ to SVN) You're right, this is not a GWT-related topic. You have to tell Eclipse where to find your SVN repository. To do that, you'll have to install an Eclipse SVN plugin. If you don't want to do that, you'll have to manage your repository outside Eclipse, and figure out why Eclipse lost the project after adding that project to the repository. If you decide to use Subclipse, be sure to understand that to get the best performance, you must install the JavaHL library. The Subclipse client will work w/o JavaHL, but it will lack some features. The Subclipse wiki goes into detail about that issue. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
twitter4j + gwt + oauth....
Sure manhere is what I am doing, but please read the notes afterwards, cause I am still learning and I think parts of this process are either not secure and/or won't work in practice. But it did work at 4am last night (and I had only had like 4 beers :) ) I used twitter4j, and followed this blog post: http://jeungun.wordpress.com/2009/09/03/quick-and-dirty-twitter4j-oauth-for-web-apps/ The main difference being that I didn't use 2 servlets. I have one 'twitterservice' servlet that sits on the server, and I do GWT-RPC to talk to that let it do all the heavy lifting. (also acts as a proxy for the same origin issues). The basic workflow is: - check if I have a access token cookie already - if I have the token cookie, give it to twitter4j, and make calls right away. - if no cookie yet, check for a RequestToken on the server, if none, show 'login with twitter' button - on click of the button, call 'getoauthURL' gwt-rpc on servlet - in getOAuthURL I persist the RequestToken on the server temporarily, and return the oauth URL - back in the clientside, I do a window load to the URL, and let the user authorize the app - once authorized, twitter redirects back to my apps listed URL (see note below) - now back in the client side we still don't have an access cookie, but we DO have a request token - so, this time, call 'getAccessToken' gwt-rpc on the servlet. - save the access token secret in cookies for the future. Notes: - I persist the request token on the servlet. This is probably due to my lack of web programming background (20+ years of desktop programming, just started with the web now!). Can I do that? Is it safe to just save something in a variable on the server side, or is the servlet instance shared with everyone, thus this process only works in development when I am the only one connecting? This isn't really an issue I suppose, cause I could always store the request token on the client side in a cookie, the same way I do the access token later. - That leads to my second note/question... is it 'safe and secure' to store the access token secret in a cookie? Is that the expected way of doing it in this case? I do pass the token and secret during the gwt-rpc calls, so I don't know if that defeats the purpose when you expose the secret like that. - Lastly, one gotcha (at least for development) is that twitter won't redirect to localhost, so I just put in my blog url. It redirects there after authorization, but it doesn't matter cause we persist the request token prior to leaving the page, so just go back to localhost by hand, and everything should be happy. -pj On Sun, Sep 13, 2009 at 12:18 PM, Jeff Chimene jchim...@gmail.com wrote: On 09/13/2009 08:39 AM, PJ Gray wrote: Thanks for the help. I messed around with it a bit more, and just kept getting frustrated. Uggg, just isn't this hard if I want a non-integrated solution in XCodewhy is it here? Anyway, I settled on just zipping up my whole folder and putting the zip in source control. Big hammer solution, I know...but whatever, I was wasting too much time figuring out stuff that should 'just work'. When I get some free cycles I'll take my questions to an Eclipse related forum and maybe make some progress. thanks again! (just got twitter oauth working in my GWT app last night! woohoo!!!) By way of thanks, would you please post some code? -pj On Sat, Sep 12, 2009 at 3:33 PM, Jeff Chimene jchim...@gmail.com mailto:jchim...@gmail.com wrote: On 09/12/2009 10:41 AM, PJ Gray wrote: So maybe I am not fully understanding the versioning situation. I did some research last night, and attempted to get my project under source control, without any luck. It appears to me that I am required to use Subclipse as my subversion client because of some special way that Eclipse handles projects? I don't think so. I think Subclipse is popular because it's a good Subversion client. However, there may be other Eclipse Subversion clients. If that is the case, then I suppose I'll take my question to an Eclipse-specific forum. However, it seems like I should be able to use whatever client I want! Probably not in the way that I think you mean that statement. Eclipse SVN clients are designed to integrate into the Eclipse environment. It's not really a matter of bolting-on any SVN client. IDE users expect the functional bar to be set higher than that. I have to admit that I don't know Versions, but even if it is a GUI, and there is no Eclipse plugin, it's only going to work as an external to Eclipse. If you rely want to stick with Versions, you'll have to figure out why Eclipse lost its mind when the source went into SVN. However, when I would add things mentioned in these emails to source control on my
Re: GWT + Eclipse + Subversion?
So maybe I am not fully understanding the versioning situation. I did some research last night, and attempted to get my project under source control, without any luck. It appears to me that I am required to use Subclipse as my subversion client because of some special way that Eclipse handles projects? If that is the case, then I suppose I'll take my question to an Eclipse-specific forum. However, it seems like I should be able to use whatever client I want! However, when I would add things mentioned in these emails to source control on my desktop, then checkout on my laptop, the GWT project was no longer listed in the Eclipse workspace. Even when I added everything in the hidden folders to source control, it still wasn't listed in the workspace. I couldn't find the special sauce that told Eclipse that my project was part of the workspace, and how it was configured. Unless someone has a link or solution, I'll take this to a Eclipse-specific forum...the more I think about it, the more I figure it is not a GWT or GWT Plugin question at all. -pj On Fri, Sep 11, 2009 at 1:54 PM, Rajeev Dayal rda...@google.com wrote: Hi Jeff, I admit that this is confusing, as the war folder is treated as both an input and output folder. I think that the above recommendations are good. You should version everything in the war folder, except for those artifacts that are automatically generated from your source. Artifacts that are generated from your source are: war/WEB-INF/classes (by Eclipse's java compiler) war/module name (by GWT's compiler) If you see any other artifacts and wonder whether or not they should be versioned, please post back here. Rajeev On Fri, Sep 11, 2009 at 11:43 AM, Jarda jaroslav.zar...@gmail.com wrote: folders under war that i don't have under version control: war/project war/WEB-INF/classes On Sep 11, 3:32 am, PJ Gray pj4...@gmail.com wrote: I am new to GWT and I have been using the plugin in Eclipse. I have written my first project, and feel confident in using the toolkit now. And I feel fairly comfortable using subversion (I use the awesome 'Versions' client). I wouldn't say I am an expert, as it always seems to 'just work' so I never really have to troubleshoot much. However, I am struggling trying to find documentation on how, exactly, to get my GWT/Eclipse project into subversion. I did a simple 'add' from the top level (src/war) directories. However, that imported thousands of files, way more than I thought should be checked in. As I looked closer, I figure I must need to separate out the src from the compiled javascript...that seems obvious. However, it is unclear what exactly in the war directory needs to be under source control and what is compiled or changes regularly. I did some investigation, googling and whatnot, but I really only found websites complaining that with 1.6 the war directory got polluted and a few people had workarounds, but usually they either didn't work completely, or were using components that I wasn't. So whats the simple answer here? I am using 1.7, is there a doc or webpage that explains what I should be keeping in source control? Why is there no output folder, or is that what the 'war' folder is supposed to be? Any help would be appreciated, I realize this might be basic 101 stuff to alot of you, so I apologize if it has been answered a million times...just include a link with your snarky RTFM comment and I'll be happy! -pj graywww.saygoodnight.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-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 -~--~~~~--~~--~--~---