Java Reference
In-Depth Information
Listing 8-8.
package com.kyleroche.gaeservices;
import javax.jdo.PersistenceManager;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ImageSource extends HttpServlet{
public void doGet(HttpServletRequest req, HttpServletResponse resp)
throws IOException {
PersistenceManager pm = PMF.get().getPersistenceManager();
Writing the ImageTransform Class
So far, you've created the PersistenceManager class to handle the communication
with the data store, the ImageObject itself, and the servlet to retrieve and render
the image from the data store. The next piece is the most significant. How do you
handle the HTTP POST form that will be sending you the image and apply the
transformation prior to storing the image in the data store? The ImageTransform
servlet that you first added to your project is going to accept the POST parameters
from the HTML form, save the image to the data store, call the App Engine Images
service to transform the image, and display both the original and the transformed
images to the browser.
Copy the code from Listing 8-9 to . Pay close attention to the
line of code in bold print. This is where the transformation is defined. You are telling
the Images service what type of transformation you are going to apply to the image
before you commit the changes.
Search WWH ::

Custom Search