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 no problem!

If you follow these steps  (using your own paths for the URL of
course), since we have already proved that the new image file has 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 your problem to 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 recompiling/
> >> > deploying the application after loading new image. Does this make a
> >> > difference?
>
> >> > On Jan 20, 8:59 am, Daniele <[email protected]> wrote:
> >> >> Image saving on folder and String[] photo are ok! I write array on a
> >> >> file when click on widget album after uploading and image name it's
> >> >> present.
> >> >> In development shell, appears this message when I open a album widget
> >> >> after uploading of image:
>
> >> >> Resource not found wpimg/album/Sport/image1.jpg. Could a file missing
> >> >> from the public path or a <servlet> tag misconfigured???
>
> >> >> Obviously when I reload application, this message disappear.
>
> >> >> Daniele
>
> >> >> 2009/1/19, Daniele <[email protected]>:
>
> >> >> > I try!
>
> >> >> > 2009/1/18, gregor <[email protected]>:
>
> >> >> >> so if you place a debug point here:
>
> >> >> >>       private static final long serialVersionUID = 403L;
>
> >> >> >>         public String[] getImageName(String category) {
>
> >> >> >>                 File photo = new
> >> >> >> File("src/com/webphotogallery/public/
> >> >> >> wpgimg/album/"
> >> >> >> + category);
> >> >> >>                 //File photo = new File("wpgimg/album/" + category);
>
> >> >> >>                 String[] photoList = photo.list();
>
> >> >> >>                 return photoList;  <<<<<<<< DEBUG
> >> >> >>         }
>
> >> >> >> Does the new image appear in the photoList array?
>
> >> >> >> On Jan 18, 3:32 pm, Daniele <[email protected]> wrote:
> >> >> >>> File are saved into a folder that I choose.
> >> >> >>> I look into a folder when application make a upload call.
> >> >> >>> But image doesn't appear when open a album widget...
>
> >> >> >>> 2009/1/14, Daniele <[email protected]>:
>
> >> >> >>> > I try some.
> >> >> >>> > Thanks.
>
> >> >> >>> > Daniele.
>
> >> >> >>> > 2009/1/14, gregor <[email protected]>:
>
> >> >> >>> >> There's nothing obviously wrong with this, and the fact that the
> >> >> >>> >> uploaded photo appears when you restart server supports that.
> >> >> >>> >> Next
> >> >> >>> >> obvious thing to eliminate may be to check exactly where on your
> >> >> >>> >> disk
> >> >> >>> >> the uploaded photo is actually written to. Perhaps it is not
> >> >> >>> >> where
> >> >> >>> >> you
> >> >> >>> >> expect, and what is happening is that it is being copied over to
> >> >> >>> >> the
> >> >> >>> >> "right" location as part of your deployment/hosted mode running
> >> >> >>> >> procedure when you restart server. If you upload a photo and
> >> >> >>> >> then
> >> >> >>> >> check where it goes while the app is still running, you should
> >> >> >>> >> be
> >> >> >>> >> able
> >> >> >>> >> to confirm that one way or another.
>
> >> >> >>> >> On Jan 14, 1:52 pm, Daniele <[email protected]> wrote:
> >> >> >>> >>> Code of upload
>
> >> >> >>> >>> [CODE]
> >> >> >>> >>> package com.webphotogallery.server;
>
> >> >> >>> >>> import java.io.File;
> >> >> >>> >>> import java.io.IOException;
> >> >> >>> >>> import java.io.PrintWriter;
> >> >> >>> >>> import java.util.Iterator;
> >> >> >>> >>> import java.util.List;
>
> >> >> >>> >>> import javax.servlet.ServletException;
> >> >> >>> >>> import javax.servlet.http.HttpServlet;
> >> >> >>> >>> import javax.servlet.http.HttpServletRequest;
> >> >> >>> >>> import javax.servlet.http.HttpServletResponse;
>
> >> >> >>> >>> import org.apache.commons.fileupload.FileItem;
> >> >> >>> >>> import org.apache.commons.fileupload.FileItemFactory;
> >> >> >>> >>> import org.apache.commons.fileupload.FileUploadException;
> >> >> >>> >>> import org.apache.commons.fileupload.disk.DiskFileItemFactory;
> >> >> >>> >>> import
> >> >> >>> >>> org.apache.commons.fileupload.servlet.FileCleanerCleanup;
> >> >> >>> >>> import org.apache.commons.fileupload.servlet.ServletFileUpload;
> >> >> >>> >>> import org.apache.commons.io.FileCleaningTracker;
>
> >> >> >>> >>> public class UploadPhoto extends HttpServlet{
>
> >> >> >>> >>>         /*
> >> >> >>> >>>          *
> >> >> >>> >>>          */
>
> >> >> >>> >>>         private static final long serialVersionUID = 144332L;
>
> >> >> >>> >>>         public void service(HttpServletRequest
> >> >> >>> >>> request,HttpServletResponse
> >> >> >>> >>> response)
> >> >> >>> >>>                         throws ServletException, IOException {
>
> >> >> >>> >>>                 FileItemFactory factory = new
> >> >> >>> >>> DiskFileItemFactory();
> >> >> >>> >>>                 ServletFileUpload upload = new
> >> >> >>> >>> ServletFileUpload(factory);
> >> >> >>> >>>                 String UPLOAD_DIRECTORY =
> >> >> >>> >>> "./src/com/webphotogallery/public/wpgimg/album/";
> >> >> >>> >>>                 //String UPLOAD_DIRECTORY = "wpgimg/album/";
>
> >> >> >>> >>>                 List<FileItem> items = null;
>
> >> >> >>> >>>                 try {
> >> >> >>> >>>                                 items =
> >> >> >>> >>> upload.parseRequest(request);
> >> >> >>> >>>                 }
> >> >> >>> >>>                         catch (FileUploadException e) {
> >> >> >>> >>>                                 e.printStackTrace();
> >> >> >>> >>>                 }
>
> >> >> >>> >>>                         Iterator iter = items.iterator();
> >> >> >>> >>>                         while(iter.hasNext())
> >> >> >>> >>>                         {
> >> >> >>> >>>                                 FileItem it =
> >> >> >>> >>> (FileItem)iter.next();
>
> >> >> >>> >>>                                 if(it.isFormField())
>
> >> >> >>> >>> UPLOAD_DIRECTORY+=it.getString()
> >> >> >>> >>> +
> >> >> >>> >>> "/";
>
> >> >> >>> >>>                                 else
> >> >> >>> >>>                                 {
> >> >> >>> >>>                                         File uploadedFile = new
> >> >> >>> >>> File(UPLOAD_DIRECTORY + it.getName());
>
> >> >> >>> >>>                                         try{
>
> >> >> >>> >>> it.write(uploadedFile);
> >> >> >>> >>>                                         }catch (Exception e) {
>
> >> >> >>> >>> e.printStackTrace();
> >> >> >>> >>>                                                 }
> >> >> >>> >>>                                 }
> >> >> >>> >>>                         }
> >> >> >>> >>>         }}
>
> >> >> >>> >>> [/CODE]
>
> >> >> >>> >>> Code of servlet wich return String[] of images
> >> >> >>> >>> [CODE]
>
> >> >> >>> >>> package com.webphotogallery.server;
>
> >> >> >>> >>> import java.io.File;
>
> >> >> >>> >>> import com.google.gwt.user.server.rpc.RemoteServiceServlet;
> >> >> >>> >>> import com.webphotogallery.client.LoadPhotoFromAlbum;
>
> >> >> >>> >>> public class LoadPhotoFromAlbumImpl extends
> >> >> >>> >>> RemoteServiceServlet
> >> >> >>> >>> implements LoadPhotoFromAlbum{
>
> >> >> >>> >>>         /**
> >> >> >>> >>>          *
> >> >> >>> >>>          */
> >> >> >>> >>>         private static final long serialVersionUID = 403L;
>
> >> >> >>> >>>         public String[] getImageName(String category) {
>
> >> >> >>> >>>                 File photo = new
> >> >> >>> >>> File("src/com/webphotogallery/public/wpgimg/album/"
> >> >> >>> >>> + category);
> >> >> >>> >>>                 //File photo = new File("wpgimg/album/" +
> >> >> >>> >>> category);
>
> >> >> >>> >>>                 String[] photoList = photo.list();
>
> >> >> >>> >>>                 return photoList;
> >> >> >>> >>>         }
>
> >> >> >>> >>> }
>
> >> >> >>> >>> [/CODE]
>
> >> >> >>> >>> Daniele.
>
> >> >> >>> >>> 2009/1/14, gregor <[email protected]>:
>
> >> >> >>> >>> > Perhaps you are building a data structure to hold a map of
> >> >> >>> >>> > image
> >> >> >>> >>> > names
> >> >> >>> >>> > for the different albums that is done once and once only in
> >> >> >>> >>> > one
> >> >> >>> >>> > of
> >> >> >>> >>> > your servlets? That would explain why when you add a new
> >> >> >>> >>> > image
> >> >> >>> >>> > it
> >> >> >>> >>> > does
> >> >> >>> >>> > not appear on your album lists until you restart the server.
>
> >> >> >>> >>> > If you post the code for your file upload servlet (the one
> >> >> >>> >>> > that
> >> >> >>> >>> > uploads a new image) and your RPC servlet that returns lists
> >> >> >>> >>> > of
> >> >> >>> >>> > image
> >> >> >>> >>> > names for a given album, we might be able to help you sort it
> >> >> >>> >>> > out
>
> >> >> >>> >>> > regards
> >> >> >>> >>> > gregor
>
> >> >> >>> >>> > On Jan 14, 8:56 am, mon3y <[email protected]> wrote:
> >> >> >>> >>> >> Hmmm..i just read that and it confused me
>
> >> >> >>> >>> >> What i meant to say is. Every time you send a photo to your
> >> >> >>> >>> >> servlet
> >> >> >>> >>> >> add a timestamp
>
> >> >> >>> >>> >> myPhoto + System.getCurrentTime() + . jpg;
>
> >> >> >>> >>> >> Then your are going to have to keep and array of timestamps
> >> >> >>> >>> >> for
> >> >> >>> >>> >> each
> >> >> >>> >>> >> photo. So when you load the photos you know which timestamp
> >> >> >>> >>> >> belongs
> >> >> >>> >>> >> to
> >> >> >>> >>> >> which photo.
>
> >> >> >>> >>> >> Just an idea.
>
> >> >> >>> >>> >> HTH
> >> >> >>> >>> >> :)
>
> >> >> >>> >>> >> On Jan 14, 2:02 am, Daniele B <[email protected]> wrote:
>
> >> >> >>> >>> >> > I've a problem with my photogallery application.
> >> >> >>> >>> >> > Application work like this:
> >> >> >>> >>> >> > On textbox enter a album name.
>
> ...
>
> read more »
--~--~---------~--~----~------------~-------~--~----~
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