I think to use GWT's version of tomcat because application it's not
implemented for business world, but only for my thesis.
However link it's good to bookmarks! :)

2009/1/7 Nick <[email protected]>:
>
> Gregor wrote "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 can add your external directory to tomcat's path.  So basically D:
> \images could be pathed to localhost:8080/YourApp/images
> Then you can access them very easily using GWT by creating an Image
> object and calling setURL("images/mycat.jpg");
> Look at this to set up your path: 
> http://whatwouldnickdo.com/wordpress/157/tomcat-images-directory/
>
>
> On Jan 6, 12:06 pm, gregor <[email protected]> wrote:
>> I think the public part is assumed. If yourimagesare located in
>> public/category then they should be accessible via the URL:
>>
>> String imageURL = GWT.getModuleBaseURL() + "category/" + fileName;
>>
>> if you want to create adirectorysomewhere else on the host machine
>> disk (i.e. not part of theTomcatset up) to store theimagesyou 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 <[email protected]> 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 tempdirectoryon /home/dany/TESI/project and we'll
>> > put indirectoryimagesthat I use in my application
>>
>> > Daniele
>>
>> > 2009/1/4, gregor <[email protected]>:
>>
>> > > Hi Daniele,
>>
>> > > Your problem is that:
>>
>> > > private static String UPLOAD_DIRECTORY =
>> > > "./src/com/webphotogallery/server/category/";
>>
>> > > does not exist under the temporary GWT dev shellTomcatinstance
>> > > 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 /publicdirectoryrather than /server, it might do the
>> > > trick.
>>
>> > > regards
>> > > gregor
>>
>> > > On Jan 4, 1:13 pm, Daniele <[email protected]> wrote:
>> > >> It's doesn't work.
>> > >> My projectdirectorystructure 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 categorydirectoryis:
>>
>> > >> 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 <[email protected]>:
>>
>> > >> > 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 <[email protected]>:
>>
>> > >> >> 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 <[email protected]> wrote:
>> > >> >>> I cannot planning image manipulation.
>> > >> >>> Ifimagesare 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 <[email protected]>:
>>
>> > >> >>> > 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 <[email protected]> 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 [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