Package com.adamtron.blobup

Source Code of com.adamtron.blobup.BlobUploadServlet

package com.adamtron.blobup;

import javax.servlet.http.HttpServlet;
import java.io.IOException;
import java.util.Map;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import com.google.appengine.api.blobstore.BlobKey;
import com.google.appengine.api.blobstore.BlobstoreService;
import com.google.appengine.api.blobstore.BlobstoreServiceFactory;

@SuppressWarnings("serial")
public class BlobUploadServlet extends HttpServlet {
    private BlobstoreService blobstoreService = BlobstoreServiceFactory.getBlobstoreService();

    public void doGet(HttpServletRequest req, HttpServletResponse res)
        throws ServletException, IOException {
       
        res.setContentType("text/plain");
        res.getWriter().println("BlobServe!");
    }
   
    public void doPost(HttpServletRequest req, HttpServletResponse res)
        throws ServletException, IOException {

        java.util.Map<java.lang.String,java.util.List<BlobKey>> keys = blobstoreService.getUploads(req);
       
        BlobKey blobKey = keys.get("myFile").get(0);

        res.sendRedirect("/blobup/listblobs.jsp");
       
    }
}
TOP

Related Classes of com.adamtron.blobup.BlobUploadServlet

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.