Hi Daniele,
I've got nearly the same problem.
Could you please tell me how you fixed the problem?

At first I tried it with the public-folder. Result: The same problem
as it is discussed here.
After that I thought, it would be smart to put the images
on server-side into the WebContent/images folder. But it was not: If I
try to load (@Client!) an image
GWT tells me that module WebContent/images could not be loaded.
Does anybody know how to create a proper URL that adresses my
WebContent folder? Or do I have to
specify the location in my definition xml (later web.xml...) ?

Thanks in advance,
Placebo

On 24 Jan., 19:07, Daniele <[email protected]> wrote:
> Now all work!!! :)
> Thanks a lot for supporting and patience!!
> If I have time, I try one solution you described to me
>
> regards
> Daniele
>
> 2009/1/24 gregor <[email protected]>:
>
>
>
> > I think you understand theproblemnow.
>
> > If you wish to continue trying to get round this (i.e. continue to use
> > the Image newPhoto = new Image("category/photoName) approach) then you
> > will have to search around the Internet to see if someone has a good
> > solution for it (that also works in GWT hosted mode BTW!). Remember,
> > what you are doing is trying to use a very simple method to read the
> > new dynamically added photos (just by short relative URL) instead of
> > using a more robust persistence mechanism The public folder is not
> > designed to handle dynamic data like that, it's meant for static HTML,
> > CSS, js, image files etc. so you are hitting problems. There may be a
> > way to do it, I don't know. Someone must have tried before I suppose.
>
> > The alternative is to create a more robust mechanism for storing your
> > photo albums, setting it up automatically when you deploy the
> > application. One way to do this is to follow these steps:
>
> > 1) Place your "start up" example albums in, say, \src\albums. When you
> > deploy to real Tomcat copy this folder to WEB-INF\classes\album. This
> > means it is in the classpath for both development and deployment.
> > 2) Add an override init() method to your LoadPhotoFromAlbum RPC
> > servlet (or any other sevlet you always call before that). In this
> > method examine if you have already created the real photo album on
> > disk (i.e. you have preciously run the application on this server),
> > and if not copy the start up album to set it up. In a real Tomcat
> > instance you can specify a start up servlet in web.xml to do this, but
> > you can't (easily) do this in GWT hosted mode). Because you put the
> > the start up albums in classes\albums & src\albums, you can get at
> > them using \albums.
> > 3) You need a relative disk location to store the photo album that is
> > separate from your web application folders but still portable. You
> > can, for example, place it relative to your Tomcat instance
> > directories. To get the directory paths you can examine System
> > properties. This, for example, works for JBoss, Tomcat and GWT hosted
> > mode Tomcat:
>
> >   private static String getSystemBaseDir() {
> >        // try JBoss
> >        String dir = System.getProperty("jboss.server.home.dir");
> >        if (dir!=null) {
> >            log.info("Using JBoss: " + dir);
> >            return dir +File.separator + "data";
> >        }
> >        // try Tomcat
> >        dir = System.getProperty("catalina.home");
> >        if (dir!=null) {
> >            log.info("Using Tomcat: " + dir);
> >            return dir;
> >        }
> >        // otherwise GWT hosted mode default
> >        dir = System.getProperty("user.dir");
> >        log.info("Using default dir: " + dir);
> >        return dir;
> >    }
>
> > use this to create and subsequently query your album directory
> > structure under the main Tomcat home directory, but not under the
> > webapps directory, or your own application's directory. If in any
> > doubt about which system properties are available, just put this in a
> > servlet:
>
> >        Properties props = System.getProperties();
> >        props.list(System.out);
>
> > 4) Use a Filedownload HttpServlet to get the images instead of using
> > Image(url) thatreads the photofileand writes it to the servlet
> > response output stream. Search this group for examples of that, and
> > there are many examples on the net.
>
> > This will definitely work, and it will also work in GWT hosted mode,
> > Tomcat, and any other servlet container or application server you add
> > support for in that getSystemBaseDir() method.
>
> > regards
> > gregor
>
> > On Jan 24, 12:24 pm, Daniele <[email protected]> wrote:
> >> Nothing works!!!
>
> >> For Gregory:
> >> Application see new photo uploaded when I click on refresh button on
> >> gwt browser implementation.
>
> >> Maybe I have understandingproblem.
>
> >> Images uploaded necessarily go on public directory because client
> >> don't have access to other directory on server or local machine, ok?
> >> When application starting, it's copy allfilepresent on public
> >> directory and put it on public directory of gwt compilation output
> >> (usually call com.package.modulename).
> >> I think error probabilly is on UPLOAD_DIRECTORY path on server side.
> >> Whats proper path for UPLOAD_DIRECTORY??
> >> If I set UPLOAD_DIRECTORY= "images/album/" application give me an
> >> error (resource not found or similar)...if I set
> >> UPLOAD_DIRECTORY="src/com/webphotogallery/public/album/" I go into
> >> error because this directory it's not seen by application when run,
> >> but only when I click on reload button..
>
> >> My idea are correct?
>
> >> Daniele
>
> >> (SORRY FOR MY ENGLISH!!! :) Many words are generated by Google Translate! 
> >> :) )
>
> >> 2009/1/23, Daniele <[email protected]>:
>
> >> > I try.
>
> >> > P.S.
> >> > If solution work, it's not important if are better or not :)!!!
>
> >> > 2009/1/23, [email protected] <[email protected]>:
>
> >> >> I had a similarproblem.
>
> >> >> TheproblemI have is caused by cacheing of the images which can be
> >> >> circumvented with the following hack.
>
> >> >> img.setUrl( the_normal_url + "?" + String.valueOf(Math.Random() ) );
>
> >> >> Why does it work, the browser sees it as a new url so does not use the
> >> >> cached image, the server ignores everything after the question mark so
> >> >> returns the image you are after.
>
> >> >> There must be a better solution than this, if you know one please post
> >> >> here!
>
> >> >> good luck.
>
> >> >> On Jan 22, 2:48 pm, gregor <[email protected]> wrote:
> >> >>> Hi Danielle,
>
> >> >>> I might have twigged what theproblemis if you are getting this
> >> >>>problemin hosted mode. In hosted mode, the GWT dev shell creates a
> >> >>> temporary Tomcat instance, but it does not seem to copy the public or
> >> >>> client folders to that instance, only the servlets and server side
> >> >>> stuff. I think it just reads the client and public folders from your
> >> >>> source tree and loads them internally so it can run the browser
> >> >>> simulation via Java (so you can debug your client in Java etc). It
> >> >>> will only pick up the new image if you click refresh.
>
> >> >>> If it does not pick it up if you click refresh, but does if you
> >> >>> recompile, you have a more difficultproblem. You need to be quite
> >> >>> certain on this point. You can check this yourself  by creating an
> >> >>> Image in client for afilename that does not exist and running hosted
> >> >>> mode. It won't find it, and if you copy the imagefileto /public
> >> >>> whist it is still running it still won't find it. But if you hit
> >> >>> refresh it will.
>
> >> >>> Gregor
>
> >> >>> On Jan 21, 7:28 pm, gregor <[email protected]> wrote:
>
> >> >>> > OK, say I have test project com.willow.sandbox.Sandbox.gwt.xml
>
> >> >>> > I run project in hosted mode and URL in the hosted mode browser when 
> >> >>> > I
> >> >>> > run it is:
>
> >> >>> >    http://localhost:8888/com.willow.sandbox.SandBox/SandBox.html
>
> >> >>> > I manually put an image in
> >> >>> > c:\....\src\com\willow\sandbox\public\images
> >> >>> > \star.gif
>
> >> >>> > I display this image in panel like so in my test GWT application:
>
> >> >>> >     someWidget.add(new Image(images/star.gif);
>
> >> >>> > I run application again and It works fine. Now, still in same hosted
> >> >>> > mode session, I select "compile/browse". This displays my application
> >> >>> > in my system default browser, but as part of that process it also
> >> >>> > compiles all the javascirpt, HTML files etc and sets up the public
> >> >>> > folder - including my image, start.gif  This also works, so I close
> >> >>> > this browser tab for now.
>
> >> >>> > I know open new browser tab and enter this URL (but I do *not* stop
> >> >>> > the hosted mode run - this won't work if you do that because the GWT
> >> >>> > hosted mode Tomcat will be also stopped):
>
> >> >>> >      http://localhost:8888/com.willow.sandbox.SandBox/images/star.gif
>
> >> >>> > So my system browser finds and displays the star.gif image noproblem!
>
> >> >>> > If you follow these steps  (using your own paths for the URL of
> >> >>> > course), since we have already proved that the new imagefilehas been
> >> >>> > correctly saved (because String[] photoList = photo.list(); picked it
> >> >>> > up), then you should be able to display the new image in your system
> >> >>> > browser, thus proving beyond reasonable doubt it is really there.
>
> >> >>> > That will further isolate yourproblemto either some error in your
> >> >>> > client side code (however unlikely that may seem since it works when
> >> >>> > you reboot), or something weird going on with browser caching.
>
> >> >>> > regards
> >> >>> > gregor
>
> >> >>> > On Jan 21, 5:27 pm, Daniele <[email protected]> wrote:
>
> >> >>> > > I don't understand..
>
> >> >>> > > 2009/1/20, gregor <[email protected]>:
>
> >> >>> > > > There's something weird about this. Have you tried (while the
> >> >>> > > > image
> >> >>> > > > is
> >> >>> > > > in "limbo", i.e. just after you've saved it) copying exactly the
> >> >>> > > > same
> >> >>> > > > URL string as your GWT client code produces into your browser/new
> >> >>> > > > browser tab?
>
> >> >>> > > > On Jan 20, 12:31 pm, Daniele <[email protected]> wrote:
> >> >>> > > >> Yes.
> >> >>> > > >> Error is not introduced when I make the refresh through the
> >> >>> > > >> push-button or reboot application.
> >> >>> > > >> I am becoming crazy for this bug!!! :)
>
> >> >>> > > >> Daniele.
>
> >> >>> > > >> 2009/1/20, gregor <[email protected]>:
>
> >> >>> > > >> > Have you tried hitting the refresh button rather than
>
> ...
>
> Erfahren Sie mehr »
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Google Web Toolkit" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/Google-Web-Toolkit?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to