Java Reference
In-Depth Information
public void setContent( content)
this.content = content;
public void setDate(Date date) { = date;
Writing the PersistenceManagerFactory Class
Now that you've defined the data structure where you'll be storing your images, you
can build the PersistenceManagerFactory class, like you did in Chapter 7, to facilitate
communication with the data store. Copy the code from Listing 8-7 into .
Listing 8-7.
package com.kyleroche.gaeservices;
import javax.jdo.JDOHelper;
import javax.jdo.PersistenceManagerFactory;
public final class PMF {
private static final PersistenceManagerFactory pmfInstance =
private PMF() {}
public static PersistenceManagerFactory get() {
return pmfInstance;
Writing the ImageSource Class
There are two more new classes to create, and then you'll set up the HTML form to
upload your image file for transformation. The file retrieves the
byte array you stored in the data store and renders it back to the browser. It uses an
HTML parameter named “ id” to filter the data-store query. Actually, to be accurate,
you're using the getObjectById method of the PersistenceManager class to retrieve
the image object. Copy the code from Listing 8-8 to the ImageSource servlet you
already created.
Search WWH ::

Custom Search