protected void doGet(HttpServletRequest request, HttpServletResponse response) 
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		JSONObject jb = new JSONObject();
		String userId = request.getParameter("userId");
		String dateTimeInMillis = request.getParameter("dateTimeInMillis");
		dateToQuery.setTime(Long.parseLong(dateTimeInMillis));
		//String username = 
		//new String(request.getParameter("username").getBytes("ISO-8859-1"),"UTF-8"); 
		try{
			connection = new Mongo();
			scheduleDB = connection.getDB("schedule");
			socialCollection = scheduleDB.getCollection("social_" + userId);
			DBObject orderBy = new BasicDBObject();
			orderBy.put("updateTime", -1);
			DBCursor cur = socialCollection.find().sort(orderBy);
			JSONArray ja = new JSONArray();
			int i = 0;
			while(cur.hasNext() && i < 20){
				//ja.add(cur.next());
				JSONObject eventJSONObject= new JSONObject();
				DBObject dbo = cur.next();
				String publisherId = (String)dbo.get("userId");
				String publishedEventId = (String)dbo.get("eventId");
				DBCollection publisherEventCollection = 
						scheduleDB.getCollection("event_"+publisherId);
				DBObject eventQuery = new BasicDBObject();
				eventQuery.put("_id", new ObjectId(publishedEventId));
				DBCursor cur2 = publisherEventCollection.find(eventQuery);
				DBObject dbo2 = cur2.next();
				String eventName = (String)dbo2.get("eventName");
				Date calFrom = (Date)dbo2.get("calFrom");
				Date calTo = (Date)dbo2.get("calTo");
				String locationName = (String)dbo2.get("locationName");
				String locationCoordinate = (String)dbo2.get("locationCoordinate");
				String decription = (String)dbo2.get("decription");
				String photo = (String)dbo2.get("photo");
				String record = (String)dbo2.get("record");
				int commentCount = (Integer)dbo2.get("commentCount");
				String updateTime = (String)dbo2.get("updateTime");
				String commentsString;
				try{
					commentsString = dbo2.get("comments").toString();
					eventJSONObject.put("commentsString", commentsString);
				}catch(NullPointerException npe){
					JSONArray nullArray = new JSONArray();
					eventJSONObject.put("commentsString", nullArray.toString());
				}
				eventJSONObject.put("_id", publishedEventId);
				eventJSONObject.put("eventName", eventName);
				eventJSONObject.put("calFrom", calFrom.getTime());
				eventJSONObject.put("calTo", calTo.getTime());
				eventJSONObject.put("locationName", locationName);
				eventJSONObject.put("locationCoordinate", locationCoordinate);
				eventJSONObject.put("decription", decription);
				eventJSONObject.put("photo", photo);
				eventJSONObject.put("record", record);
				eventJSONObject.put("commentCount", commentCount);
				eventJSONObject.put("updateTime", updateTime);
				eventJSONObject.put("publisherId",publisherId);
				DBCollection userCollection = scheduleDB.getCollection("user");
				DBObject imageQuery = new BasicDBObject();
				imageQuery.put("_id", new ObjectId(publisherId));
				DBCursor cur3 = userCollection.find(imageQuery);
				if(cur3.hasNext()){
					DBObject dbo3 = cur3.next();
					String image = (String)dbo3.get("image");
					String publisherName = (String)dbo3.get("username");
					eventJSONObject.put("publisherImage",image);
					eventJSONObject.put("publisherName",publisherName);
				}else{
					
					break;
				}
				ja.add(eventJSONObject);
				i++;
			}if(cur.hasNext() && i < 20){
				jb.put("result", Primitive.DBSTOREERROR);
			}else{
				jb.put("result", Primitive.ACCEPT);
				jb.put("socialEventArray", ja);
			}
			
		}catch(MongoException e){
			jb.put("result", Primitive.DBCONNECTIONERROR);
		   	e.printStackTrace();
		}
		response.setCharacterEncoding("UTF-8");
		PrintWriter writer = response.getWriter();
		String jbString = new String(jb.toString().getBytes(),"UTF-8");
		writer.write(jbString);
		writer.flush();
		writer.close();
	}