Re: Open a local file with GWT
On Mon, Apr 13, 2009 at 11:31 PM, Arun wrote: > > HI, > > i am new to GWT, I have similar query. I want to open a file which is > place somewhere in server file system (i.e. a directory on server > contains some directory and files in it). I have to represent it in > tree structure and display the file on click of leaf Node. > > I am paused at opening a file on click event. I want to open it in a > widget ( every time a new leaf node click on tree a file would be > opened opened in same window/widget replacing the old one). > > could any one tell me what approach i should follow? There may be some Java RPC stuff that will do this for you, if you have Java available on the server. If your server is Apache based and allows "Index" (or the equivilent for another server technology), then you could parse the HTML output from a CGI get of the requisite directory. Otherwise, you'll need a server-side process to accept a file name request, perform the file lookup and return the results to your client. Just like Javascript, there's nothing inherent in GWT that performs server side directory traversal. --~--~-~--~~~---~--~~ 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, i am new to GWT, I have similar query. I want to open a file which is place somewhere in server file system (i.e. a directory on server contains some directory and files in it). I have to represent it in tree structure and display the file on click of leaf Node. I am paused at opening a file on click event. I want to open it in a widget ( every time a new leaf node click on tree a file would be opened opened in same window/widget replacing the old one). could any one tell me what approach i should follow? any link or suggestions are appreciated. thanks in advance. --arun. On Apr 11, 12:54 am, ffs1985 wrote: > 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 toopenthat > path. The thing I don't understand is why if Iopena new > tab on firefox or I Explorer or Chrome wirks without a problem. > > Maybe another solution is not to call a rpc to download thefileand > 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 wrote: > > > O.K. > > > 1) what is pdfLink? is that supposed to be link? > > 2) if you have any kind of Popup blocker, attempting toopena window > > from the callback will fail. if you want toopena window, it has to > > happen as a direct result of a user action (onClick, etc) > > 3) if link is a path to a filesystemfileare you sure it is correct? > > (this is sneaky, but just might work) > > > 4) Technically not causing a problem but, use generics. > > > AsyncCallback cb = new AsyncCallback{ > > 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 afile > > > from my application and see it. I could copy thefilefrom server to a > > > local root but when I've tried toopenit, 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.openinside 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 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 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. > > AsyncCallback cb = new AsyncCallback{ > 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
It's actually the same thing - don't you think? If you can do smth. like Window.open("file:///C:\mycreditcard-number.txt") then you also can go through it though you have full access to popup's Window and Document objects. But may be i'm misunderstanding smth. here completely. On 8 Apr., 06:37, ffs1985 wrote: > 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" 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,ffs1985 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
Hi, I am facing some king of this problem too. What I want to show the preview of a image which is reside in the local file system of the remote server. The path of this image is residing in the database like c:\images\sunset.png How I will show the preview on the GWT panel. If the PipedReader can help in this this will be great as I do not know about piped reader. Regards, Vaibhav ---Original Message--- From: ffs1985 Date: 04/08/09 10:09:44 To: Google Web Toolkit Subject: 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" wrote: > Did you try using a PipedReader? > > On Apr 7, 4:04 pm,ffs1985 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" wrote: > Did you try using a PipedReader? > > On Apr 7, 4:04 pm,ffs1985 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" 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,ffs1985 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 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 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,ffs1985 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
1) That's the local copy on the remote server, right? 2) You could always be sneaky :D. I wonder if a Button.click() would bypass the blocker - my guess being now as that would be a flaw in the popup-blocker. One way though would be to do something like in the async callback, display some kind of clickable message on the screen informing the user it's ready - they hit ok, you display the doc, bypassing the adblocker. And you should know, at least with IE & FF, whether or not it's a popup-blocker issue as the information bar should appear. 3). I think he meant can you actually hit the file by entering the address in the browser (not if the string looked OK). 4) Like he said, it's not the issue - just cleaner programming style. On Wed, Apr 8, 2009 at 12:27 AM, ffs1985 wrote: > > 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 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. > > > > AsyncCallback cb = new AsyncCallback{ > >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
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 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. > > AsyncCallback cb = new AsyncCallback{ > 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
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, ffs1985 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
Did you try using a PipedReader? On Apr 7, 4:04 pm, ffs1985 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
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. AsyncCallback cb = new AsyncCallback{ public void onSuccess(String result) ... } -jason On Apr 7, 2009, at 5:04 AM, ffs1985 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
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, ffs1985 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 -~--~~~~--~~--~--~---
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 -~--~~~~--~~--~--~---