package requestHandlers.djonDB;

import java.io.IOException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import org.json.simple.JSONObject;

import requestHandlers.RequestHandler;
import Util.JSONUtil;
import Util.djonDBUtil;

public class registerH_djon implements RequestHandler {

	@Override
	public void processRequest(Object user, HttpServletRequest req,
			HttpServletResponse res, Object[] services, Object log)
			throws ServletException, IOException {
		// TODO Auto-generated method stub
		JSONObject json = JSONUtil.HttpRequest2JSON(req);
		if(djonDBUtil.addUser(json))
		{
			res.sendRedirect("login.html");
		}
		else
		{
			res.sendRedirect("register.jsp");
		}
	}

}
