I had the Serve mapping wrong.. Thanks !

On Tuesday, 29 October 2013 12:47:47 UTC+5:30, anuja bothra wrote:
>
> Hi,
>
> I basically want to upload an excel file to blobstore and then parse the 
> file using POI.
>
> I have uploaded the excel file to the blob store using the following .jsp 
> code
>
> <%
>
>     BlobstoreService blobstoreService = 
> BlobstoreServiceFactory.getBlobstoreService();
>
> %>
>
> <form action="<%= blobstoreService.createUploadUrl("/productmetasaver") 
> %>" method="post" enctype="multipart/form-data">
>
>             <input type="text" name="foo">
>
>             <input type="file" name="myFile">
>
>             <input type="submit" value="Submit">
>
>         </form>
>
>
> This part works fine(I can see the file in the blobstore) but when I try 
> to access the file using the below code :
>
>
> public class ProductMetaSaverServlet extends HttpServlet { 
>
>    // private BlobstoreService blobstoreService = 
> BlobstoreServiceFactory.getBlobstoreService();
>
> public void doPost(HttpServletRequest req, HttpServletResponse resp)
>
> throws IOException {     
>
> BlobstoreService blobstoreService = 
> BlobstoreServiceFactory.getBlobstoreService();
>
> java.util.Map<java.lang.String,java.util.List<BlobKey>> blobs = 
> blobstoreService.getUploads(req);
>
>         BlobKey blobKey = blobs.get("myFile").get(0);
>
>         if (blobKey == null) {
>
>          resp.sendRedirect("/");
>
>         } else {
>
>          resp.sendRedirect("/serve?blob-key=" + 
> blobKey.getKeyString().trim());
>
>         }
>
>        
>
> java.util.Map<java.lang.String,java.util.List<FileInfo>> filelist = 
> blobstoreService.getFileInfos(req);
>
>  resp.setContentType("text/html");
>
>       PrintWriter out = resp.getWriter();
>
>       for(String filename : filelist.keySet())
>
>       {
>
>       out.print(filename);
>
>       out.print(filelist.get(filename));
>
>       }
>
>     }
>
> My serve method :
>
> public class Serve extends HttpServlet {
>
>     /**
>
>  * 
>
>  */
>
> private static final long serialVersionUID = 1L;
>
> private BlobstoreService blobstoreService = 
> BlobstoreServiceFactory.getBlobstoreService();
>
>
>     @Override
>
>     public void doGet(HttpServletRequest req, HttpServletResponse res)
>
>         throws IOException {
>
>             BlobKey blobKey = new BlobKey(req.getParameter("blob-key"));
>
>             blobstoreService.serve(blobKey, res);
>
>         }
>
>     }
>
> I get the following error :
>
> *(Error: Not Found*
>
> *The requested URL *
> */upload-success?blob-key=AMIfv94Mrs9e1vk65ws-9jRek-QyhZ14tx3cNI5OgCj1rJvuS_ZLRq77tabioZTWRsAlTx_g6R2R1X1pyEIg7ckYsq_1pXmfFmwAilcPaZ7pYZKKRFOew3iwyCgOGfO4ScgJ-OaYm3kWWF_s9GaZwQmWcYNlwBLDpQ**
>  was 
> not found on this server.) *
>
>
> Can someone please point out what im doing wrong here.
>
> I just need the file path of the uploaded file so that I can pass it to 
> apache POI.
>
>
> Thanks,
>
> Anuja
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Google App Engine" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/google-appengine.
For more options, visit https://groups.google.com/groups/opt_out.

Reply via email to