Google App Engine how to get an object from the servlet ?
- by Frank
I have the following class objects in Google App Engine's dadastore, I can see them from the "Datastore Viewer " :
import javax.jdo.annotations.IdGeneratorStrategy;
import javax.jdo.annotations.IdentityType;
import javax.jdo.annotations.PersistenceCapable;
import javax.jdo.annotations.Persistent;
import javax.jdo.annotations.PrimaryKey;
@PersistenceCapable(identityType=IdentityType.APPLICATION)
public class Contact_Info_Entry implements Serializable
{
@PrimaryKey
@Persistent(valueStrategy=IdGeneratorStrategy.IDENTITY)
Long Id;
public static final long serialVersionUID=26362862L;
String Contact_Id="",First_Name="",Last_Name="",Company_Name="",Branch_Name="",Address_1="",Address_2="",City="",State="",Zip="",Country="";
double D_1,D_2;
boolean B_1,B_2;
Vector<String> A_Vector=new Vector<String>();
public Contact_Info_Entry() { }
......
}
How can my java applications get the object from a servlet url ? For instance if have an instance of Contact_Info_Entry who's Contact_Id is "ABC-123", and my App Id is : nm-java
When my java program accesses the url :
"http://nm-java.appspot.com/Check_Contact_Info?Contact_Id=ABC-123
How will the Check_Contact_Info servlet get the object from datastore and return it to my app ?
public class Check_Contact_Info_Servlet extends HttpServlet
{
static boolean Debug=true;
public void doGet(HttpServletRequest request,HttpServletResponse response) throws IOException
{
}
...
protected void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException,IOException { doGet(request,response); }
}
Frank