First Draft of Project3 -- Group of Qi and Liu

Setcontenttypeimagepngcharsetiso 8859 1 url url null

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: resp.setContentType("image/png;charset=ISO-8859-1"); URL url = null; String urladdr = ""; String email = ""; String password = ""; email = req.getParameter("Email"); password = req.getParameter("Password"); // ImageInfo imgInfo ; // PngReader pngr = null; // PngWriter pngw = null; if(email.equals("")||password.equals("")){ req.getRequestDispatcher("/index.html").forward(req, resp); } else{ OutputStream outStream = resp.getOutputStream(); email + password; urladdr = "https://chart.googleapis.com/chart?chs=350x350&cht=qr&chl=" + url = new URL(urladdr); if(url!=null){ InputStream inputStream = url.openStream(); try{ byte byteArray = new byte[inputStream.available()]; inputStream.read(byteArray); outStream.write(byteArray); outStream.flush(); if(outStream!=null) outStream.close(); } catch(Exception e){ e.printStackTrace(); } } } // resp.getWriter().println(pngr); // resp.sendRedirect(urladdr); } } 3.2 Data Storing: package webpackage; import javax.jdo.JDOHelper; import javax.jdo.PersistenceManager; import javax.jdo.PersistenceManagerFactory; import com.google.appengine.api.datastore.Key; import com.google.appengine.api.datastore.KeyFactory; import webpackage.PMF; public class pmInstance { public static void main(String args) { // TODO Auto-generated method stub PersistenceManager pm = PMF.get().getPersistenceManager(); int RandNum=(int)(Math.random()*1000); Key key = KeyFactory.createKey(UserInfo.class.getSimpleName(), "admin@example.com"); if(key!=null){ UserInfo UserData =...
View Full Document

Ask a homework question - tutors are online