Re: Open a local file with GWT
I tried adding a button when the callback success and on click event of that button, call to window.open(path,_blank,). this didn't work, I think that the thing is that the browser doesn't know how to open that path. The thing I don't understand is why if I open a new tab on firefox or I Explorer or Chrome wirks without a problem. Maybe another solution is not to call a rpc to download the file and instead of that make something like an old servlet that make a call to download browser. I've trying this thing works since a lot of time and I still didn't find a solution. I hope someone could help me with this, Thanks, Federico On Apr 7, 10:13 am, Jason Essington jason.essing...@gmail.com wrote: O.K. 1) what is pdfLink? is that supposed to be link? 2) if you have any kind of Popup blocker, attempting to open a window from the callback will fail. if you want to open a window, it has to happen as a direct result of a user action (onClick, etc) 3) if link is a path to a filesystem file are you sure it is correct? (this is sneaky, but just might work) 4) Technically not causing a problem but, use generics. AsyncCallbackString cb = new AsyncCallbackString{ public void onSuccess(String result) ... } -jason On Apr 7, 2009, at 5:04 AM,ffs1985wrote: Hi I'm trying to make a function that let the user download a file from my application and see it. I could copy the file from server to a local root but when I've tried to open it, does it work on hosted mode but in web mode fails always, no matter what browser I try(IE 7, Firefox and Chrome). My code is the next one: private void openDocument(String documentName) { final ManagerExportAsync manejador = ManagerExport.Util.getInstance (); AsyncCallback callback = new AsyncCallback(){ String link; public void onSuccess(final Object result) { link = (String)result; Window.open(pdfLink,_blank,); } public void onFailure(Throwable caught){} }; manejador.openDocument(User,userId, documentName,callback); } The String link result is something like this file///:C:/test.jpg I don't know what it's wrong. I read somewhere that the problem could be that I'm calling the Window.open inside the callback but I really don't know what is wrong coul someone give me a hand? Any suggestions? Thanks! Federico. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---
Open a local file with GWT
Hi I'm trying to make a function that let the user download a file from my application and see it. I could copy the file from server to a local root but when I've tried to open it, does it work on hosted mode but in web mode fails always, no matter what browser I try(IE 7, Firefox and Chrome). My code is the next one: private void openDocument(String documentName) { final ManagerExportAsync manejador = ManagerExport.Util.getInstance (); AsyncCallback callback = new AsyncCallback(){ String link; public void onSuccess(final Object result) { link = (String)result; Window.open(pdfLink,_blank,); } public void onFailure(Throwable caught){} }; manejador.openDocument(User,userId, documentName,callback); } The String link result is something like this file///:C:/test.jpg I don't know what it's wrong. I read somewhere that the problem could be that I'm calling the Window.open inside the callback but I really don't know what is wrong coul someone give me a hand? Any suggestions? Thanks! Federico. --~--~-~--~~~---~--~~ 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: Open a local file with GWT
Hi sorry, here is the thing, inside my application an user could upload documents. Then in some other time if he wants to see any of this documents he select it from a table and click on a view button on the selected row. There the AsyncCallback that I've wrote is called, this makes a local copy of the file in the machine and returns the path where this local copy was saved. So now that i wrote some context, I will try to give more information: 1) pdfLink is the path were that local copy of the document is saved. 2) Yes but the thing is that I can't do it outside the callback because I must be sure that the file is already created and also the callback is what returns to me that local url where the file is. Unless I sincronize the asyncronic call but I don't know how to do that. 3) I'm sure that the link its correct because just for be sure i test to show it in an alert message and it's ok. 4) I will try with generics but I don't think it's the problem because this should work on previous versions that doesn't support java 5. Thanks for the help, any suggestions will be very helpful Federico. On Apr 7, 10:13 am, Jason Essington jason.essing...@gmail.com wrote: O.K. 1) what is pdfLink? is that supposed to be link? 2) if you have any kind of Popup blocker, attempting to open a window from the callback will fail. if you want to open a window, it has to happen as a direct result of a user action (onClick, etc) 3) if link is a path to a filesystem file are you sure it is correct? (this is sneaky, but just might work) 4) Technically not causing a problem but, use generics. AsyncCallbackString cb = new AsyncCallbackString{ public void onSuccess(String result) ... } -jason On Apr 7, 2009, at 5:04 AM,ffs1985wrote: Hi I'm trying to make a function that let the user download a file from my application and see it. I could copy the file from server to a local root but when I've tried to open it, does it work on hosted mode but in web mode fails always, no matter what browser I try(IE 7, Firefox and Chrome). My code is the next one: private void openDocument(String documentName) { final ManagerExportAsync manejador = ManagerExport.Util.getInstance (); AsyncCallback callback = new AsyncCallback(){ String link; public void onSuccess(final Object result) { link = (String)result; Window.open(pdfLink,_blank,); } public void onFailure(Throwable caught){} }; manejador.openDocument(User,userId, documentName,callback); } The String link result is something like this file///:C:/test.jpg I don't know what it's wrong. I read somewhere that the problem could be that I'm calling the Window.open inside the callback but I really don't know what is wrong coul someone give me a hand? Any suggestions? Thanks! Federico. --~--~-~--~~~---~--~~ 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: Open a local file with GWT
I don't use an Anchor because I want to open a new windows when the user hits click on the view document button that I have on the application. If I use a Anchor, the user must click on my button when the callback returns, the Anchor will appear and then the user must click on Anchor to open the document. I try to save this as an emergency solution. Thanks, Federico On Apr 7, 11:46 am, makoki iagoto...@gmail.com wrote: Well, maybe the matter is that Window.open will be caught by some popup blockers. Why dont you use an Anchor element with a _blank target, this will open a new window and it's not blocked by browsers. First do an asynchronous call to retrieve the url and once you have show and anchor element with a _blank target with your url, the user just needs to click it to download the file On 7 abr, 13:04,ffs1985ffs1...@gmail.com wrote: Hi I'm trying to make a function that let the user download a file from my application and see it. I could copy the file from server to a local root but when I've tried to open it, does it work on hosted mode but in web mode fails always, no matter what browser I try(IE 7, Firefox and Chrome). My code is the next one: private void openDocument(String documentName) { final ManagerExportAsync manejador = ManagerExport.Util.getInstance (); AsyncCallback callback = new AsyncCallback(){ String link; public void onSuccess(final Object result) { link = (String)result; Window.open(pdfLink,_blank,); } public void onFailure(Throwable caught){} }; manejador.openDocument(User,userId, documentName,callback); } The String link result is something like this file///:C:/test.jpg I don't know what it's wrong. I read somewhere that the problem could be that I'm calling the Window.open inside the callback but I really don't know what is wrong coul someone give me a hand? Any suggestions? Thanks! Federico. --~--~-~--~~~---~--~~ 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: Open a local file with GWT
I'm not trying to read files from filesystem from plain javascript, I want to open a new browsers window with a local url. The browser should decide how he will open this file. On Apr 7, 8:56 am, alex.d alex.dukhov...@googlemail.com wrote: You CAN'T read files from filesystem from plain javascript. Applets or Gears are a way to go. Another way is that user just opens your file instead of downloading it ;-) On 7 Apr., 13:04,ffs1985ffs1...@gmail.com wrote: Hi I'm trying to make a function that let the user download a file from my application and see it. I could copy the file from server to a local root but when I've tried to open it, does it work on hosted mode but in web mode fails always, no matter what browser I try(IE 7, Firefox and Chrome). My code is the next one: private void openDocument(String documentName) { final ManagerExportAsync manejador = ManagerExport.Util.getInstance (); AsyncCallback callback = new AsyncCallback(){ String link; public void onSuccess(final Object result) { link = (String)result; Window.open(pdfLink,_blank,); } public void onFailure(Throwable caught){} }; manejador.openDocument(User,userId, documentName,callback); } The String link result is something like this file///:C:/test.jpg I don't know what it's wrong. I read somewhere that the problem could be that I'm calling the Window.open inside the callback but I really don't know what is wrong coul someone give me a hand? Any suggestions? Thanks! Federico. --~--~-~--~~~---~--~~ 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: Open a local file with GWT
I don't know what is a PipedReader if you could send me more information i will appreciate very much Thanks, Federico On Apr 7, 11:21 am, @vi aviral.ban...@gmail.com wrote: Did you try using a PipedReader? On Apr 7, 4:04 pm,ffs1985ffs1...@gmail.com wrote: Hi I'm trying to make a function that let the user download a file from my application and see it. I could copy the file from server to a local root but when I've tried to open it, does it work on hosted mode but in web mode fails always, no matter what browser I try(IE 7, Firefox and Chrome). My code is the next one: private void openDocument(String documentName) { final ManagerExportAsync manejador = ManagerExport.Util.getInstance (); AsyncCallback callback = new AsyncCallback(){ String link; public void onSuccess(final Object result) { link = (String)result; Window.open(pdfLink,_blank,); } public void onFailure(Throwable caught){} }; manejador.openDocument(User,userId, documentName,callback); } The String link result is something like this file///:C:/test.jpg I don't know what it's wrong. I read somewhere that the problem could be that I'm calling the Window.open inside the callback but I really don't know what is wrong coul someone give me a hand? Any suggestions? Thanks! Federico. --~--~-~--~~~---~--~~ 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 -~--~~~~--~~--~--~---