Hi Daniele, Are you trying to use these images as components of an image bundle or some sort of compile-time structure?
If so, don't do it that way. Cheers, jec On Jan 20, 1: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. > >>> >>> >> > On FileUpload widget, select image to upload on server. > >>> >>> >> > When user click on album widget, program send a GWT-RPC call to > >>> >>> >> > a > >>> >>> >> > servlet which send back string array of images URL. > >>> >>> >> > But when I upload a new photo, it's not viewed...only when I > >>> >>> >> > restart > >>> >>> >> > application new photo are view. > > >>> >>> >> > Sorry for 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 -~----------~----~----~----~------~----~------~--~---
