Nothing works!!!

For Gregory:
Application see new photo uploaded when I click on refresh button on
gwt browser implementation.
        
Maybe I have understanding problem.

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 all file present 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 <dany.hat...@gmail.com>:
> I try.
>
> P.S.
> If solution work, it's not important if are better or not :)!!!
>
> 2009/1/23, seanowenha...@googlemail.com <seanowenha...@googlemail.com>:
>>
>> I had a similar problem.
>>
>> The problem I 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 <greg.power...@googlemail.com> wrote:
>>> Hi Danielle,
>>>
>>> I might have twigged what the problem is if you are getting this
>>> problem in 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 difficult problem. You need to be quite
>>> certain on this point. You can check this yourself  by creating an
>>> Image in client for a file name that does not exist and running hosted
>>> mode. It won't find it, and if you copy the image file to /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 <greg.power...@googlemail.com> 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 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 <dany.hat...@gmail.com> wrote:
>>>
>>> > > I don't understand..
>>>
>>> > > 2009/1/20, gregor <greg.power...@googlemail.com>:
>>>
>>> > > > 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 <dany.hat...@gmail.com> 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 <greg.power...@googlemail.com>:
>>>
>>> > > >> > 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 <dany.hat...@gmail.com> 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 <dany.hat...@gmail.com>:
>>>
>>> > > >> >> > I try!
>>>
>>> > > >> >> > 2009/1/18, gregor <greg.power...@googlemail.com>:
>>>
>>> > > >> >> >> 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 <dany.hat...@gmail.com> 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 <dany.hat...@gmail.com>:
>>>
>>> > > >> >> >>> > I try some.
>>> > > >> >> >>> > Thanks.
>>>
>>> > > >> >> >>> > Daniele.
>>>
>>> > > >> >> >>> > 2009/1/14, gregor <greg.power...@googlemail.com>:
>>>
>>> > > >> >> >>> >> 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 <dany.hat...@gmail.com>
>>> > > >> >> >>> >> 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
>>> > > >> >> >>> >>>                                 {
>>>
>>> ...
>>>
>>> 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 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
-~----------~----~----~----~------~----~------~--~---

Reply via email to