I use a FormField on GWT client and apache commons-io and
commons-fileupload for server to write on public/category and
fileupload now works fine, but I don't understand why sometimes, image
are not loaded into display panel.
yesterday image file are located on public/category/etc and all works.
at 22.30 I do cut&paste category folder on other folder because image
are not loaded!!!!!!!! :)


However thanks to all for supporting!

Daniele.
2009/1/6 gregor <greg.power...@googlemail.com>:
>
> I think the public part is assumed. If your images are located in
> public/category then they should be accessible via the URL:
>
> String imageURL = GWT.getModuleBaseURL() + "category/" + fileName;
>
> if you want to create a directory somewhere else on the host machine
> disk (i.e. not part of the Tomcat set up) to store the images you need
> to do more work. You could use an ordinary HttpServlet (not a GWT RPC
> servet) to do it, something like:
>
>   // assume you have passed "category" and "imageFileName" as
> parameters to the servlet.
>   // in HttpServlet.doGet(..)
>   FileInputStream in = new FileInputStream(new File(UPLOAD_DIRECTORY/
> + category/ + ImageFileName))
>   response.setContentType("image/jpeg"); // or gif,png etc
>   OutputStream out = response.getOutputStream();
>    try {
>            byte[] buffer = new byte[1024];
>            int len;
>            while ((len = in.read(buf)) > 0) {
>                out.write(buffer, 0, len);
>            }
>            in.close();
>            out.close();
>     } catch (IOException e) {
>            // do something
>     }
>
> The effect of that it to make the browser believe it's just getting an
> image from a URL. You can't use GWT RPC because it won't deal with
> binary data (e.g. an image file). Look up "HttpServlet image download"
> on Google for examples.
>
>
>
> On Jan 6, 4:00 pm, Daniele <dany.hat...@gmail.com> wrote:
>> I put category folder under public/ folder.
>> Same problem.
>> I do set UPLOAD_DIRECTORY with
>> ./src/com/webphotogallery/public/category because only public/category
>> doesn't work.
>>
>> I try to create a temp directory on /home/dany/TESI/project and we'll
>> put in directory images that I use in my application
>>
>> Daniele
>>
>> 2009/1/4, gregor <greg.power...@googlemail.com>:
>>
>>
>>
>> > Hi Daniele,
>>
>> > Your problem is that:
>>
>> > private static String UPLOAD_DIRECTORY =
>> > "./src/com/webphotogallery/server/category/";
>>
>> > does not exist under the temporary GWT dev shell Tomcat instance
>> > created when you run hosted mode, whatever your development
>> > environment. To sort this out you will have to think through where in
>> > a production environment the photos would actually be stored.
>>
>> > To do this quick and get it to work in hosted mode, I think if you put
>> > them under the /public directory rather than /server, it might do the
>> > trick.
>>
>> > regards
>> > gregor
>>
>> > On Jan 4, 1:13 pm, Daniele <dany.hat...@gmail.com> wrote:
>> >> It's doesn't work.
>> >> My project directory structure is:
>>
>> >> /home/dany/TESI/projects/WebPhotoGallery/
>> >>   -- build/
>> >>   -- src
>> >>       -- com
>> >>           -- webphotogallery
>> >>               -- server
>> >>                   -- category
>> >>                       -- [...]
>> >>               -- client
>> >>               -- public
>> >>   -- tomcat
>> >>   -- WebConten
>>
>> >> (I use Eclipse with Cypal studio plugin)
>>
>> >> On servlet, the code for create category directory is:
>>
>> >> private static String UPLOAD_DIRECTORY =
>> >> "./src/com/webphotogallery/server/category/";
>> >> [...]
>>
>> >> if((it.getFieldName().equals("categoryBox"))){
>> >>                                 String categoryFolder = it.getString();
>>
>> >>                                 UPLOAD_DIRECTORY = UPLOAD_DIRECTORY +
>> >> categoryFolder;
>> >> [...]
>> >> where categoryFolder is passed by client with a form.
>> >> But when I call setURL() method on client, what URL I
>> >> put??http://localhost:8888/com.webphotogallery.WebPhotoGallery/category/ca...
>> >> not works.
>>
>> >> I'm totally disoriented.
>>
>> >> Thanks.
>>
>> >> Daniele.
>>
>> >> 2008/12/28 Daniele <dany.hat...@gmail.com>:
>>
>> >> > Sorry, but I'm newbie of servlet & GWT...I'm here for learning GWT and
>> >> > servlet :)
>> >> > I try.
>> >> > Thanks.
>>
>> >> > Daniele.
>>
>> >> > 2008/12/28 rakesh wagh <rake...@gmail.com>:
>>
>> >> >> Cannot comment on what you are doing wrong without looking into the
>> >> >> code. However I see no need for setUrl on server side. You should have
>> >> >> a "Servlet" that will parse the parameters, read the appropriate image
>> >> >> file(either file system or db or any doc mgmt system for that matter),
>> >> >> set a proper content type and just spit out the byte stream.
>>
>> >> >> From the client just call this servlet with appropriate params for it
>> >> >> to retrieve the image. In essence:
>> >> >> Image img = new Image();
>> >> >> img.setUrl("/servlet?photoId=39934&width=50");
>>
>> >> >> Rakesh Wagh
>>
>> >> >> On Dec 26, 4:26 pm, Daniele <dany.hat...@gmail.com> wrote:
>> >> >>> I cannot planning image manipulation.
>> >> >>> If images are on client sides, setUrl() etc it works.
>>
>> >> >>> On server side, I have an undefined number of folders that represent
>> >> >>> photo category, but if I put on setUrl() method path to folders on
>> >> >>> server, it's not work.
>>
>> >> >>> 2008/12/26 rakesh wagh <rake...@gmail.com>:
>>
>> >> >>> > ask yourself:
>> >> >>> > Even if you get your image/files using rpc, what will you do with
>> >> >>> > it?
>> >> >>> > I mean there is no real application of getting binary files using
>> >> >>> > rpc
>> >> >>> > yet. Are you planning to do image manipulations like rotation,
>> >> >>> > filters, etc on the client side? js is not yet ready for that.
>> >> >>> > However
>> >> >>> > if you wish, you can get the entire file using rpc method. But
>> >> >>> > sticking it to the image tag is very difficult. Search through the
>> >> >>> > group, some one mentioned how you can embed the actual bytes and
>> >> >>> > construct a img tag that will display the image. Good luck, because
>> >> >>> > that is very non standard and your millage can greatly vary.
>>
>> >> >>> > You might also want to look at Gears, it allows you to store and
>> >> >>> > retrieve Blobs in client database... not sure if it has to do
>> >> >>> > anything
>> >> >>> > with your requirement but will come handy if you are playing a lot
>> >> >>> > with files etc. ..
>>
>> >> >>> > Rakesh Wagh
>>
>> >> >>> > On Dec 24, 8:01 am, Daniele B <dany.hat...@gmail.com> wrote:
>> >> >>> >> Hi.
>> >> >>> >> I work on a photogallery application for my thesis.
>> >> >>> >> I have a problem.
>> >> >>> >> How can I do to retrieve image files stored on a server folder
>> >> >>> >> trought
>> >> >>> >> GWT-RPC?
>>
>> >> >>> >> Thanks at all!
>> >> >>> >> Sorry fo my english!!! :)
>>
>> >> >>> >> Daniele.
> >
>

--~--~---------~--~----~------------~-------~--~----~
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